(svn r13691) -Codechange: make it easier to determine whether a command is ran in the context of autoreplace or not

This commit is contained in:
smatz
2008-07-09 20:55:47 +00:00
parent e9a1142e0d
commit a47b118a80
6 changed files with 21 additions and 21 deletions

View File

@@ -170,7 +170,7 @@ void RoadVehUpdateCache(Vehicle *v)
* @param tile tile of depot where road vehicle is built
* @param flags operation to perform
* @param p1 bus/truck 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
*/
CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
@@ -204,7 +204,7 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v = vl[0];
/* find the first free roadveh id */
unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_ROAD);
unit_num = (flags & DC_AUTOREPLACE) ? 0 : GetFreeUnitNumber(VEH_ROAD);
if (unit_num > _settings_game.vehicle.max_roadveh)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);