summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSamuXarick <43006711+SamuXarick@users.noreply.github.com>2021-08-11 18:21:34 +0100
committerGitHub <noreply@github.com>2021-08-11 19:21:34 +0200
commit76b83437775ccae7e722fc41d7e4564b64188776 (patch)
tree83a86a5d22a2b38ffba721e7500291594e5fb619 /src
parentb14681891dce4b0060308d6a477a22c4f0b77edd (diff)
downloadopenttd-76b83437775ccae7e722fc41d7e4564b64188776.tar.xz
Fix #9392: Return a valid value with GetBuildWithRefitCapacity when AIs are maxed out in vehicles (#9393)
Diffstat (limited to 'src')
-rw-r--r--src/vehicle_cmd.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp
index 499b3b3eb..f3e0a99b8 100644
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -124,7 +124,7 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
/* Check whether we can allocate a unit number. Autoreplace does not allocate
* an unit number as it will (always) reuse the one of the replaced vehicle
* and (train) wagons don't have an unit number in any scenario. */
- UnitID unit_num = (flags & DC_AUTOREPLACE || (type == VEH_TRAIN && e->u.rail.railveh_type == RAILVEH_WAGON)) ? 0 : GetFreeUnitNumber(type);
+ UnitID unit_num = (flags & DC_QUERY_COST || flags & DC_AUTOREPLACE || (type == VEH_TRAIN && e->u.rail.railveh_type == RAILVEH_WAGON)) ? 0 : GetFreeUnitNumber(type);
if (unit_num == UINT16_MAX) return_cmd_error(STR_ERROR_TOO_MANY_VEHICLES_IN_GAME);
/* If we are refitting we need to temporarily purchase the vehicle to be able to