(svn r20392) -Fix [FS#3993]: Prevent buying bankrupt companies when you'd get too many vehicles.

This commit is contained in:
alberth
2010-08-06 20:26:01 +00:00
parent 5cfc029523
commit 422a1ad242
3 changed files with 25 additions and 1 deletions

View File

@@ -1600,6 +1600,9 @@ CommandCost CmdBuyCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
/* Do not allow companies to take over themselves */
if (target_company == _current_company) return CMD_ERROR;
/* Disable taking over when not allowed. */
if (!MayCompanyTakeOver(_current_company, target_company)) return CMD_ERROR;
/* Get the cost here as the company is deleted in DoAcquireCompany. */
CommandCost cost(EXPENSES_OTHER, c->bankrupt_value);