diff options
author | bjarni <bjarni@openttd.org> | 2005-01-26 19:43:22 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2005-01-26 19:43:22 +0000 |
commit | 7b242e2ea99c1a68007cf598a50f65fb2f7d003c (patch) | |
tree | dca7881124ee7b0eb0ecd257dec1396341054248 | |
parent | 65b55ffafea844378b2025cdc2f4b9b01d236f34 (diff) | |
download | openttd-7b242e2ea99c1a68007cf598a50f65fb2f7d003c.tar.xz |
(svn r1690) - Fix: [autoreplace] Cheaters can no longer exploit autoreplace to get vehicles, that's not invented yet
- Fix: [autoreplace] Fixed a stupid bug introduced in r1687, that made a crash if anybody tried to autoreplace anything but an aircraft
-rw-r--r-- | vehicle.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1352,8 +1352,12 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) if (!CheckOwnership(v->owner)) return CMD_ERROR; // makes sure that we do not replace a plane with a helicopter or vise versa - if (HASBIT(AircraftVehInfo(old_engine_type)->subtype, 0) != HASBIT(AircraftVehInfo(new_engine_type)->subtype, 0)) return CMD_ERROR; + if (v->type == VEH_Aircraft) { + if (HASBIT(AircraftVehInfo(old_engine_type)->subtype, 0) != HASBIT(AircraftVehInfo(new_engine_type)->subtype, 0)) return CMD_ERROR; + } + // makes sure that the player can actually buy the new engine. Renewing is still allowed to outdated engines + if (!HASBIT(DEREF_ENGINE(new_engine_type)->player_avail, v->owner) && old_engine_type != new_engine_type) return CMD_ERROR; switch (v->type) { case VEH_Train: build_cost = EstimateTrainCost(RailVehInfo(new_engine_type)); break; |