(svn r25865) -Codechange: Refactor detecting of depot vehicle type of a tile to a new function, GetDepotVehicleType (cirdan, LordAro)

This commit is contained in:
zuu
2013-10-13 20:11:05 +00:00
parent 12ddbb7cb1
commit cef1c47f18
4 changed files with 20 additions and 22 deletions

View File

@@ -85,14 +85,7 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
/* 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);