src/roadveh_cmd.cpp
changeset 11133 a75c67ae67b0
parent 11106 f51503265cb2
equal deleted inserted replaced
11125:856f16065654 11133:a75c67ae67b0
   168 
   168 
   169 /** Build a road vehicle.
   169 /** Build a road vehicle.
   170  * @param tile tile of depot where road vehicle is built
   170  * @param tile tile of depot where road vehicle is built
   171  * @param flags operation to perform
   171  * @param flags operation to perform
   172  * @param p1 bus/truck type being built (engine)
   172  * @param p1 bus/truck type being built (engine)
   173  * @param p2 bit 0 when set, the unitnumber will be 0, otherwise it will be a free number
   173  * @param p2 unused
   174  */
   174  */
   175 CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
   175 CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
   176 {
   176 {
   177 	CommandCost cost;
   177 	CommandCost cost;
   178 	Vehicle *v;
   178 	Vehicle *v;
   202 	}
   202 	}
   203 
   203 
   204 	v = vl[0];
   204 	v = vl[0];
   205 
   205 
   206 	/* find the first free roadveh id */
   206 	/* find the first free roadveh id */
   207 	unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_ROAD);
   207 	unit_num = (flags & DC_AUTOREPLACE) ? 0 : GetFreeUnitNumber(VEH_ROAD);
   208 	if (unit_num > _settings_game.vehicle.max_roadveh)
   208 	if (unit_num > _settings_game.vehicle.max_roadveh)
   209 		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
   209 		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
   210 
   210 
   211 	if (flags & DC_EXEC) {
   211 	if (flags & DC_EXEC) {
   212 		int x;
   212 		int x;