diff options
Diffstat (limited to 'ship_cmd.c')
-rw-r--r-- | ship_cmd.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ship_cmd.c b/ship_cmd.c index 3cb66e430..1d6e1383d 100644 --- a/ship_cmd.c +++ b/ship_cmd.c @@ -811,7 +811,7 @@ void ShipsYearlyLoop(void) /** Build a ship. * @param tile tile of depot where ship is built * @param p1 ship type being built (engine) - * @param p2 unused + * @param p2 bit 0 when set, the unitnumber will be 0, otherwise it will be a free number */ int32 CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) { @@ -833,8 +833,9 @@ int32 CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (!IsTileOwner(tile, _current_player)) return CMD_ERROR; v = AllocateVehicle(); - if (v == NULL || IsOrderPoolFull() || - (unit_num = GetFreeUnitNumber(VEH_Ship)) > _patches.max_ships) + unit_num = (HASBIT(p2, 0) == true) ? 0 : GetFreeUnitNumber(VEH_Ship); + + if (v == NULL || IsOrderPoolFull() || unit_num > _patches.max_ships) return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); if (flags & DC_EXEC) { |