diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -85,14 +85,7 @@ CommandCost CmdBuildVehicle(TileIndex ti /* 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);