(svn r16559) -Codechange: introduce Company::IsValidAiID() and Company::IsValidHumanID(), don't use IsHumanCompany() where possible

This commit is contained in:
smatz
2009-06-10 22:05:01 +00:00
parent 0b66eb938f
commit a2567c84a0
14 changed files with 47 additions and 38 deletions

View File

@@ -487,7 +487,7 @@ static void CompanyCheckBankrupt(Company *c)
case 3: {
/* XXX - In multiplayer, should we ask other companies if it wants to take
over when it is a human company? -- TrueLight */
if (IsHumanCompany(c->index)) {
if (!c->is_ai) {
SetDParam(0, STR_NEWS_COMPANY_IN_TROUBLE_TITLE);
SetDParam(1, STR_NEWS_COMPANY_IN_TROUBLE_DESCRIPTION);
SetDParamStr(2, cni->company_name);
@@ -532,7 +532,7 @@ static void CompanyCheckBankrupt(Company *c)
ChangeNetworkOwner(c->index, COMPANY_SPECTATOR);
ChangeOwnershipOfCompanyItems(c->index, INVALID_OWNER);
if (!IsHumanCompany(c->index)) AI::Stop(c->index);
if (c->is_ai) AI::Stop(c->index);
CompanyID c_index = c->index;
delete c;
@@ -1528,7 +1528,7 @@ static void DoAcquireCompany(Company *c)
}
_current_company = old_company;
if (!IsHumanCompany(c->index)) AI::Stop(c->index);
if (c->is_ai) AI::Stop(c->index);
DeleteCompanyWindows(ci);
InvalidateWindowClassesData(WC_TRAINS_LIST, 0);