diff options
author | rubidium <rubidium@openttd.org> | 2011-10-15 20:42:32 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2011-10-15 20:42:32 +0000 |
commit | de27205e6c8aec594f7ae3b8205e8a1d60c24751 (patch) | |
tree | 84a180f9001812109677d95c57ee446178dada0d /src/company_cmd.cpp | |
parent | 16e1314f58fa96915d79ca8419465ab2e5e8639e (diff) | |
download | openttd-de27205e6c8aec594f7ae3b8205e8a1d60c24751.tar.xz |
(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
Diffstat (limited to 'src/company_cmd.cpp')
-rw-r--r-- | src/company_cmd.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index 07b8e3f92..91ac65861 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -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; } |