diff options
author | pasky <pasky@openttd.org> | 2005-03-06 16:53:00 +0000 |
---|---|---|
committer | pasky <pasky@openttd.org> | 2005-03-06 16:53:00 +0000 |
commit | 4a6a7028a906e5affd50aceaa3a1992b3bbb308b (patch) | |
tree | 9829b688e524b56d6d0813d9e1028519d064d8ea | |
parent | eb3671b6476e895f98527c2f51ea54274ade9b73 (diff) | |
download | openttd-4a6a7028a906e5affd50aceaa3a1992b3bbb308b.tar.xz |
(svn r1946) Fix: [AInew] Allow DC_QUERY_COST even on tiles with no depot built. This is used by the ai_new for deciding if it can afford the vehicles before actually building the depot. Was broken in r1728. Signed-Off-By: TrueLight ;-)
-rw-r--r-- | roadveh_cmd.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/roadveh_cmd.c b/roadveh_cmd.c index eca9c65b7..93f6927a1 100644 --- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -121,16 +121,17 @@ int32 CmdBuildRoadVeh(int x, int y, uint32 flags, uint32 p1, uint32 p2) if (!IsEngineBuildable(p1, VEH_Road)) return CMD_ERROR; - if (!IsTileDepotType(tile, TRANSPORT_ROAD)) return CMD_ERROR; - - if (_map_owner[tile] != _current_player) return CMD_ERROR; - SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES); cost = EstimateRoadVehCost(p1); if (flags & DC_QUERY_COST) return cost; + /* 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_ROAD)) return CMD_ERROR; + if (_map_owner[tile] != _current_player) return CMD_ERROR; + v = AllocateVehicle(); if (v == NULL || IsOrderPoolFull()) return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); |