File diff r20820:091f1b7bab33 → r20821:e1ecbf7996ac
src/vehicle_cmd.cpp
Show inline comments
 
@@ -82,20 +82,13 @@ CommandCost CmdBuildAircraft   (TileInde
 
 */
 
CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 
{
 
	/* Elementary check for valid location. */
 
	if (!IsDepotTile(tile) || !IsTileOwner(tile, _current_company)) return CMD_ERROR;
 

	
 
	VehicleType type;
 
	switch (GetTileType(tile)) {
 
		case MP_RAILWAY: type = VEH_TRAIN;    break;
 
		case MP_ROAD:    type = VEH_ROAD;     break;
 
		case MP_WATER:   type = VEH_SHIP;     break;
 
		case MP_STATION: type = VEH_AIRCRAFT; break;
 
		default: NOT_REACHED(); // Safe due to IsDepotTile()
 
	}
 
	VehicleType type = GetDepotVehicleType(tile);
 

	
 
	/* Validate the engine type. */
 
	EngineID eid = GB(p1, 0, 16);
 
	if (!IsEngineBuildable(eid, type, _current_company)) return_cmd_error(STR_ERROR_RAIL_VEHICLE_NOT_AVAILABLE + type);
 

	
 
	const Engine *e = Engine::Get(eid);