summaryrefslogtreecommitdiff
path: root/aircraft_cmd.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-05-11 13:31:14 +0000
committerbjarni <bjarni@openttd.org>2006-05-11 13:31:14 +0000
commit2e05a16959ff23ff504f823a9d2b8d92a9a3f873 (patch)
treefc7719c3c53e3f59a9936181309d7e95d37f5698 /aircraft_cmd.c
parent06156142d4857acb6ed04166c28b2ec787ec9c10 (diff)
downloadopenttd-2e05a16959ff23ff504f823a9d2b8d92a9a3f873.tar.xz
(svn r4826) -Fix: [autoreplace] fixed possible problem when autoreplacing and was number of vehicles (of a type, not total) was reached
now the new vehicle gets the same number as the old one, completely removing the problem where we could run out of numbers since we don't have to find free numbers for the new vehicles, autoreplace should be somewhat faster, specially in late games NOTE: in CmdBuildRailVehicle(), bit 0 and 1 in p2 have been switched to make the meaning of bit 0 consistent with the other build commands. CmdCloneVehicle() is modified to follow this as well
Diffstat (limited to 'aircraft_cmd.c')
-rw-r--r--aircraft_cmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index 54b881537..fd7dad834 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -158,7 +158,7 @@ static int32 EstimateAircraftCost(EngineID engine_type)
/** Build an aircraft.
* @param tile tile of depot where aircraft is built
* @param p1 aircraft 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 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
@@ -186,7 +186,7 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
}
- unit_num = GetFreeUnitNumber(VEH_Aircraft);
+ unit_num = (HASBIT(p2, 0) == true) ? 0 : GetFreeUnitNumber(VEH_Aircraft);
if (unit_num > _patches.max_aircraft)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);