diff --git a/src/road_map.h b/src/road_map.h index df9ec2ab15..e55c2621ba 100644 --- a/src/road_map.h +++ b/src/road_map.h @@ -205,6 +205,21 @@ static inline bool HasRoadTypeTram(TileIndex t) return GetRoadTypeTram(t) != INVALID_ROADTYPE; } +/** + * Get the present road types of a tile. + * @param t The tile to query. + * @return Present road types. + */ +static inline RoadTramTypes GetPresentRoadTramTypes(TileIndex t) +{ + RoadTramTypes result = (RoadTramTypes)0; + if (MayHaveRoad(t)) { + if (GetRoadTypeRoad(t) != INVALID_ROADTYPE) result |= RTTB_ROAD; + if (GetRoadTypeTram(t) != INVALID_ROADTYPE) result |= RTTB_TRAM; + } + return result; +} + /** * Check if a tile has a road or a tram road type. * @param t The tile to check. diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 3a31932178..d4debb02f9 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2460,7 +2460,7 @@ public: if (IsDepotTile(tile) && GetDepotVehicleType(tile) == this->vli.vtype) { if (this->vli.type != VL_DEPOT_LIST) return; if (!IsInfraTileUsageAllowed(this->vli.vtype, this->vli.company, tile)) return; - if (this->vli.vtype == VEH_ROAD && GetPresentRoadTypes(Depot::Get(this->vli.index)->xy) != GetRoadTypes(tile)) return; + if (this->vli.vtype == VEH_ROAD && GetPresentRoadTramTypes(Depot::Get(this->vli.index)->xy) != GetPresentRoadTramTypes(tile)) return; DestinationID dest = (this->vli.vtype == VEH_AIRCRAFT) ? GetStationIndex(tile) : GetDepotIndex(tile); DoCommandP(0, this->vli.index | (this->vli.vtype << 16) | (OT_GOTO_DEPOT << 20), dest, CMD_MASS_CHANGE_ORDER);