forked from mirror/OpenTTD
(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:
@@ -770,13 +770,14 @@ void CompanyAdminUpdate(const Company *company)
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever a company goes bankrupt in order to notify admins.
|
||||
* @param company_id The company that went bankrupt.
|
||||
* Called whenever a company is removed in order to notify admins.
|
||||
* @param company_id The company that was removed.
|
||||
* @param reason The reason the company was removed.
|
||||
*/
|
||||
void CompanyAdminBankrupt(CompanyID company_id)
|
||||
void CompanyAdminRemove(CompanyID company_id, CompanyRemoveReason reason)
|
||||
{
|
||||
#ifdef ENABLE_NETWORK
|
||||
if (_network_server) NetworkAdminCompanyRemove(company_id, ADMIN_CRR_BANKRUPT);
|
||||
if (_network_server) NetworkAdminCompanyRemove(company_id, (AdminCompanyRemoveReason)reason);
|
||||
#endif /* ENABLE_NETWORK */
|
||||
}
|
||||
|
||||
@@ -843,7 +844,6 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
}
|
||||
|
||||
if (_network_server) {
|
||||
CompanyID old_playas = ci->client_playas;
|
||||
ci->client_playas = c->index;
|
||||
NetworkUpdateClientInfo(ci->client_id);
|
||||
|
||||
@@ -882,6 +882,9 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
break;
|
||||
|
||||
case 2: { // Delete a company
|
||||
CompanyRemoveReason reason = (CompanyRemoveReason)GB(p2, 0, 2);
|
||||
if (reason >= CRR_END) return CMD_ERROR;
|
||||
|
||||
Company *c = Company::GetIfValid(company_id);
|
||||
if (c == NULL) return CMD_ERROR;
|
||||
|
||||
@@ -905,7 +908,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
CompanyID c_index = c->index;
|
||||
delete c;
|
||||
AI::BroadcastNewEvent(new AIEventCompanyBankrupt(c_index));
|
||||
CompanyAdminBankrupt(c_index);
|
||||
CompanyAdminRemove(c_index, (CompanyRemoveReason)reason);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user