mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Fix #9392: Return a valid value with GetBuildWithRefitCapacity when AIs are maxed out in vehicles (#9393)
This commit is contained in:
parent
b14681891d
commit
76b8343777
@ -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
|
/* 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
|
* 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. */
|
* 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 (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
|
/* If we are refitting we need to temporarily purchase the vehicle to be able to
|
||||||
|
Loading…
Reference in New Issue
Block a user