summaryrefslogtreecommitdiff
path: root/ship_cmd.c
diff options
context:
space:
mode:
authorpasky <pasky@openttd.org>2005-03-06 16:58:42 +0000
committerpasky <pasky@openttd.org>2005-03-06 16:58:42 +0000
commita0c157eea846ad7ee938efcd7d471660b31c120f (patch)
treec8f1ccfcf0da0b87bbe86b9899005f1257497f27 /ship_cmd.c
parent4a6a7028a906e5affd50aceaa3a1992b3bbb308b (diff)
downloadopenttd-a0c157eea846ad7ee938efcd7d471660b31c120f.tar.xz
(svn r1947) As in r1946, permit DC_QUERY_COST even on non-depot tiles - so that it works for the ai_new. It is de iure not a bug yet but let's be safe against future annoying headaches. Signed-Off-By: TrueLight
Diffstat (limited to 'ship_cmd.c')
-rw-r--r--ship_cmd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ship_cmd.c b/ship_cmd.c
index e5a186089..9fd1ea195 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -878,16 +878,17 @@ int32 CmdBuildShip(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (!IsEngineBuildable(p1, VEH_Ship)) return CMD_ERROR;
- if (!IsTileDepotType(tile, TRANSPORT_WATER)) return CMD_ERROR;
-
- if (_map_owner[tile] != _current_player) return CMD_ERROR;
-
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
value = EstimateShipCost(p1);
if (flags & DC_QUERY_COST)
return value;
+ /* The ai_new queries the vehicle cost before building the route,
+ * so we must check against cheaters no sooner than now. --pasky */
+ if (!IsTileDepotType(tile, TRANSPORT_WATER)) return CMD_ERROR;
+ if (_map_owner[tile] != _current_player) return CMD_ERROR;
+
v = AllocateVehicle();
if (v == NULL || IsOrderPoolFull() ||
(unit_num = GetFreeUnitNumber(VEH_Ship)) > _patches.max_ships)