summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2005-01-26 19:03:01 +0000
committerbjarni <bjarni@openttd.org>2005-01-26 19:03:01 +0000
commitecb954fd9db59ab04f68c49dfac659150913aaa6 (patch)
tree26937aa3bb93638b3b5fccbf06bf816f15a91074
parent8742b63fa1912fb55798f4f4d2fba41e07c92ef5 (diff)
downloadopenttd-ecb954fd9db59ab04f68c49dfac659150913aaa6.tar.xz
(svn r1687) - Feature: [autoreplace] server now checks for plane<->helicopter replacement and reject replacement if needed
-rw-r--r--vehicle.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/vehicle.c b/vehicle.c
index d9b0e1768..7fad142fe 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1351,6 +1351,9 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
// check that it's the vehicle's owner that requested the replace
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;
+
switch (v->type) {
case VEH_Train: build_cost = EstimateTrainCost(RailVehInfo(new_engine_type)); break;