From 4c84db16361c17e6c3def857b400b9a974f90d44 Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 1 Sep 2009 12:57:04 +0000 Subject: (svn r17345) -Fix [FS#2769]: one wasn't offered to take over bankrupt companies anymore; caused by the introduction NoAI, although NewAI had the same problem too. --- src/economy.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/economy.cpp') 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); } -- cgit v1.2.3-70-g09d2