Changeset - r12477:069be9651c2d
[Not reviewed]
master
0 1 0
rubidium - 15 years ago 2009-07-23 08:47:14
rubidium@openttd.org
(svn r16924) -Fix (r16922): selling or sending to depot, what's the difference? :)
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/vehicle_cmd.cpp
Show inline comments
 
@@ -151,49 +151,49 @@ CommandCost CmdMassStartStopVehicle(Tile
 

	
 
		if (CmdSucceeded(ret)) {
 
			return_value = CommandCost();
 
			/* We know that the command is valid for at least one vehicle.
 
			 * If we haven't set DC_EXEC, then there is no point in continueing because it will be valid */
 
			if (!(flags & DC_EXEC)) break;
 
		}
 
	}
 

	
 
	return return_value;
 
}
 

	
 
/** Sells all vehicles in a depot
 
 * @param tile Tile of the depot where the depot is
 
 * @param flags type of operation
 
 * @param p1 Vehicle type
 
 * @param p2 unused
 
 */
 
CommandCost CmdDepotSellAllVehicles(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 
{
 
	VehicleList list;
 

	
 
	CommandCost cost(EXPENSES_NEW_VEHICLES);
 
	VehicleType vehicle_type = (VehicleType)GB(p1, 0, 8);
 
	uint sell_command = GetCmdSendToDepot(vehicle_type);;
 
	uint sell_command = GetCmdSellVeh(vehicle_type);;
 

	
 
	/* Get the list of vehicles in the depot */
 
	BuildDepotVehicleList(vehicle_type, tile, &list, &list);
 

	
 
	for (uint i = 0; i < list.Length(); i++) {
 
		CommandCost ret = DoCommand(tile, list[i]->index, 1, flags, sell_command);
 
		if (CmdSucceeded(ret)) cost.AddCost(ret);
 
	}
 

	
 
	if (cost.GetCost() == 0) return CMD_ERROR; // no vehicles to sell
 
	return cost;
 
}
 

	
 
/** Autoreplace all vehicles in the depot
 
 * Note: this command can make incorrect cost estimations
 
 * Luckily the final price can only drop, not increase. This is due to the fact that
 
 * estimation can't predict wagon removal so it presumes worst case which is no income from selling wagons.
 
 * @param tile Tile of the depot where the vehicles are
 
 * @param flags type of operation
 
 * @param p1 Type of vehicle
 
 * @param p2 If bit 0 is set, then either replace all or nothing (instead of replacing until money runs out)
 
 */
 
CommandCost CmdDepotMassAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 
{
0 comments (0 inline, 0 general)