Mercurial > hg > openttd
changeset 15726:88dadfb384f8 draft
(svn r20393) -Fix [FS#3993]: Prevent taking over competitors when you'd get too many vehicles.
author | alberth <alberth@openttd.org> |
---|---|
date | Fri, 06 Aug 2010 20:28:16 +0000 |
parents | 597cad644741 |
children | e7ce9e72e50f |
files | src/economy.cpp |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/economy.cpp +++ b/src/economy.cpp @@ -1517,8 +1517,12 @@ /* Those lines are here for network-protection (clients can be slow) */ if (GetAmountOwnedBy(c, COMPANY_SPECTATOR) == 0) return cost; - /* We can not buy out a real company (temporarily). TODO: well, enable it obviously */ - if (GetAmountOwnedBy(c, COMPANY_SPECTATOR) == 1 && !c->is_ai) return cost; + if (GetAmountOwnedBy(c, COMPANY_SPECTATOR) == 1) { + if (!c->is_ai) return cost; // We can not buy out a real company (temporarily). TODO: well, enable it obviously. + + if (GetAmountOwnedBy(c, _current_company) == 3 && !MayCompanyTakeOver(_current_company, target_company)) return_cmd_error(STR_ERROR_TOO_MANY_VEHICLES_IN_GAME); + } + cost.AddCost(CalculateCompanyValue(c) >> 2); if (flags & DC_EXEC) {