mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-29 09:29:10 +00:00
(svn r23031) -Fix [FS#4804]: for the admin "bots" there was no distinction between bankruptcy and manual removal of companies even though the API suggested that
This commit is contained in:
@@ -19,6 +19,12 @@
|
||||
#include "tcp_admin.h"
|
||||
#include "../../debug.h"
|
||||
|
||||
/* Make sure that these enums match. */
|
||||
assert_compile((int)CRR_MANUAL == (int)ADMIN_CRR_MANUAL);
|
||||
assert_compile((int)CRR_AUTOCLEAN == (int)ADMIN_CRR_AUTOCLEAN);
|
||||
assert_compile((int)CRR_BANKRUPT == (int)ADMIN_CRR_BANKRUPT);
|
||||
assert_compile((int)CRR_END == (int)ADMIN_CRR_END);
|
||||
|
||||
/**
|
||||
* Create the admin handler for the given socket.
|
||||
* @param s The socket to communicate over.
|
||||
@@ -55,13 +61,13 @@ NetworkRecvStatus NetworkAdminSocketHandler::HandlePacket(Packet *p)
|
||||
case ADMIN_PACKET_ADMIN_CHAT: return this->Receive_ADMIN_CHAT(p);
|
||||
case ADMIN_PACKET_ADMIN_RCON: return this->Receive_ADMIN_RCON(p);
|
||||
|
||||
case ADMIN_PACKET_SERVER_FULL: return this->Receive_SERVER_FULL(p);
|
||||
case ADMIN_PACKET_SERVER_BANNED: return this->Receive_SERVER_BANNED(p);
|
||||
case ADMIN_PACKET_SERVER_ERROR: return this->Receive_SERVER_ERROR(p);
|
||||
case ADMIN_PACKET_SERVER_PROTOCOL: return this->Receive_SERVER_PROTOCOL(p);
|
||||
case ADMIN_PACKET_SERVER_WELCOME: return this->Receive_SERVER_WELCOME(p);
|
||||
case ADMIN_PACKET_SERVER_NEWGAME: return this->Receive_SERVER_NEWGAME(p);
|
||||
case ADMIN_PACKET_SERVER_SHUTDOWN: return this->Receive_SERVER_SHUTDOWN(p);
|
||||
case ADMIN_PACKET_SERVER_FULL: return this->Receive_SERVER_FULL(p);
|
||||
case ADMIN_PACKET_SERVER_BANNED: return this->Receive_SERVER_BANNED(p);
|
||||
case ADMIN_PACKET_SERVER_ERROR: return this->Receive_SERVER_ERROR(p);
|
||||
case ADMIN_PACKET_SERVER_PROTOCOL: return this->Receive_SERVER_PROTOCOL(p);
|
||||
case ADMIN_PACKET_SERVER_WELCOME: return this->Receive_SERVER_WELCOME(p);
|
||||
case ADMIN_PACKET_SERVER_NEWGAME: return this->Receive_SERVER_NEWGAME(p);
|
||||
case ADMIN_PACKET_SERVER_SHUTDOWN: return this->Receive_SERVER_SHUTDOWN(p);
|
||||
|
||||
case ADMIN_PACKET_SERVER_DATE: return this->Receive_SERVER_DATE(p);
|
||||
case ADMIN_PACKET_SERVER_CLIENT_JOIN: return this->Receive_SERVER_CLIENT_JOIN(p);
|
||||
|
@@ -99,7 +99,9 @@ DECLARE_ENUM_AS_BIT_SET(AdminUpdateFrequency)
|
||||
enum AdminCompanyRemoveReason {
|
||||
ADMIN_CRR_MANUAL, ///< The company is manually removed.
|
||||
ADMIN_CRR_AUTOCLEAN, ///< The company is removed due to autoclean.
|
||||
ADMIN_CRR_BANKRUPT ///< The company went belly-up.
|
||||
ADMIN_CRR_BANKRUPT, ///< The company went belly-up.
|
||||
|
||||
ADMIN_CRR_END ///< Sentinel for end.
|
||||
};
|
||||
|
||||
/** Main socket handler for admin related connections. */
|
||||
|
@@ -1643,8 +1643,7 @@ static void NetworkAutoCleanCompanies()
|
||||
/* Is the company empty for autoclean_unprotected-months, and is there no protection? */
|
||||
if (_settings_client.network.autoclean_unprotected != 0 && _network_company_states[c->index].months_empty > _settings_client.network.autoclean_unprotected && StrEmpty(_network_company_states[c->index].password)) {
|
||||
/* Shut the company down */
|
||||
DoCommandP(0, 2 | c->index << 16, 0, CMD_COMPANY_CTRL);
|
||||
NetworkAdminCompanyRemove(c->index, ADMIN_CRR_AUTOCLEAN);
|
||||
DoCommandP(0, 2 | c->index << 16, CRR_AUTOCLEAN, CMD_COMPANY_CTRL);
|
||||
IConsolePrintF(CC_DEFAULT, "Auto-cleaned company #%d with no password", c->index + 1);
|
||||
}
|
||||
/* Is the company empty for autoclean_protected-months, and there is a protection? */
|
||||
@@ -1658,8 +1657,7 @@ static void NetworkAutoCleanCompanies()
|
||||
/* Is the company empty for autoclean_novehicles-months, and has no vehicles? */
|
||||
if (_settings_client.network.autoclean_novehicles != 0 && _network_company_states[c->index].months_empty > _settings_client.network.autoclean_novehicles && vehicles_in_company[c->index] == 0) {
|
||||
/* Shut the company down */
|
||||
DoCommandP(0, 2 | c->index << 16, 0, CMD_COMPANY_CTRL);
|
||||
NetworkAdminCompanyRemove(c->index, ADMIN_CRR_AUTOCLEAN);
|
||||
DoCommandP(0, 2 | c->index << 16, CRR_AUTOCLEAN, CMD_COMPANY_CTRL);
|
||||
IConsolePrintF(CC_DEFAULT, "Auto-cleaned company #%d with no vehicles", c->index + 1);
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user