From 447ec39f49e89689dc9070fe88c8eafc39a60fbe Mon Sep 17 00:00:00 2001 From: smatz Date: Wed, 9 Jul 2008 20:55:47 +0000 Subject: (svn r13691) -Codechange: make it easier to determine whether a command is ran in the context of autoreplace or not --- src/aircraft_cmd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/aircraft_cmd.cpp') diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 7ad8486a4..dbdf6bd89 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -261,7 +261,7 @@ uint16 AircraftDefaultCargoCapacity(CargoID cid, const AircraftVehicleInfo *avi) * @param tile tile of depot where aircraft is built * @param flags for command * @param p1 aircraft type being built (engine) - * @param p2 bit 0 when set, the unitnumber will be 0, otherwise it will be a free number + * @param p2 unused * return result of operation. Could be cost, error */ CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) @@ -286,7 +286,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); } - UnitID unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_AIRCRAFT); + UnitID unit_num = (flags & DC_AUTOREPLACE) ? 0 : GetFreeUnitNumber(VEH_AIRCRAFT); if (unit_num > _settings_game.vehicle.max_aircraft) return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); -- cgit v1.2.3-54-g00ecf