summaryrefslogtreecommitdiff
path: root/src/economy.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-08-06 20:26:01 +0000
committeralberth <alberth@openttd.org>2010-08-06 20:26:01 +0000
commit422a1ad24286594285ec6dc14182dd29a92ea21a (patch)
treeffa575483ded0f88d1b214c97955d112c6947b7b /src/economy.cpp
parent5cfc0295236de7f1d32ca23519f35a3ee883f220 (diff)
downloadopenttd-422a1ad24286594285ec6dc14182dd29a92ea21a.tar.xz
(svn r20392) -Fix [FS#3993]: Prevent buying bankrupt companies when you'd get too many vehicles.
Diffstat (limited to 'src/economy.cpp')
-rw-r--r--src/economy.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index ed9212cd2..a9a61850d 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -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);