(svn r17542) -Fix: don't access variables in the company struct after it has been deleted

-Cleanup: remove some never-used code
This commit is contained in:
yexo
2009-09-14 22:09:50 +00:00
parent bdc86b7280
commit 6fb7012bc6
2 changed files with 4 additions and 16 deletions

View File

@@ -1553,8 +1553,11 @@ CommandCost CmdBuyCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
/* Do not allow companies to take over themselves */
if ((CompanyID)p1 == _current_company) return CMD_ERROR;
/* Get the cost here as the company is deleted in DoAcquireCompany. */
CommandCost cost(EXPENSES_OTHER, c->bankrupt_value);
if (flags & DC_EXEC) {
DoAcquireCompany(c);
}
return CommandCost(EXPENSES_OTHER, c->bankrupt_value);
return cost;
}