diff options
Diffstat (limited to 'src/economy.cpp')
-rw-r--r-- | src/economy.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/economy.cpp b/src/economy.cpp index 997c882d8..335889d83 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -506,16 +506,6 @@ static void CompanyCheckBankrupt(Company *c) AI::BroadcastNewEvent(new AIEventCompanyInTrouble(c->index)); break; case 3: { - /* XXX - In multiplayer, should we ask other companies if it wants to take - over when it is a human company? -- TrueLight */ - 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); - AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, NS_COMPANY_TROUBLE, cni); - break; - } - /* Check if the company has any value.. if not, declare it bankrupt * right now */ Money val = CalculateCompanyValue(c); @@ -1560,15 +1550,17 @@ CommandCost CmdSellShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1 CommandCost CmdBuyCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) { Company *c = Company::GetIfValid(p1); + if (c == NULL) return CMD_ERROR; - /* Disable takeovers in multiplayer games */ - if (c == NULL || _networking) return CMD_ERROR; + /* Disable takeovers when not asked */ + if (!HasBit(c->bankrupt_asked, _current_company)) return CMD_ERROR; + + /* Disable taking over the local company in single player */ + if (!_networking && _local_company == c->index) return CMD_ERROR; /* Do not allow companies to take over themselves */ if ((CompanyID)p1 == _current_company) return CMD_ERROR; - if (!c->is_ai) return CMD_ERROR; - if (flags & DC_EXEC) { DoAcquireCompany(c); } |