mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r20393) -Fix [FS#3993]: Prevent taking over competitors when you'd get too many vehicles.
This commit is contained in:
parent
422a1ad242
commit
3536357cc6
@ -1517,8 +1517,12 @@ CommandCost CmdBuyShareInCompany(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
|||||||
/* Those lines are here for network-protection (clients can be slow) */
|
/* Those lines are here for network-protection (clients can be slow) */
|
||||||
if (GetAmountOwnedBy(c, COMPANY_SPECTATOR) == 0) return cost;
|
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) {
|
||||||
if (GetAmountOwnedBy(c, COMPANY_SPECTATOR) == 1 && !c->is_ai) return cost;
|
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);
|
cost.AddCost(CalculateCompanyValue(c) >> 2);
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
|
Loading…
Reference in New Issue
Block a user