1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-21 19:32:54 +01:00

Codechange: Make RoadStopType an enum class. (#13340)

This commit is contained in:
Peter Nelson
2025-01-19 21:43:17 +00:00
committed by GitHub
parent 65665ccb78
commit 5f0e4cd646
11 changed files with 61 additions and 57 deletions

View File

@@ -578,7 +578,7 @@ static bool NeighbourHasReachableRoad(::RoadType rt, TileIndex start_tile, DiagD
EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
DiagDirection entrance_dir = DiagdirBetweenTiles(tile, front);
RoadStopType stop_type = road_veh_type == ROADVEHTYPE_TRUCK ? ROADSTOP_TRUCK : ROADSTOP_BUS;
RoadStopType stop_type = road_veh_type == ROADVEHTYPE_TRUCK ? RoadStopType::Truck : RoadStopType::Bus;
StationID to_join = ScriptStation::IsValidStation(station_id) ? station_id : INVALID_STATION;
return ScriptObject::Command<CMD_BUILD_ROAD_STOP>::Do(tile, 1, 1, stop_type, drive_through, entrance_dir, ScriptObject::GetRoadType(), ROADSTOP_CLASS_DFLT, 0, to_join, station_id != ScriptStation::STATION_JOIN_ADJACENT);
}

View File

@@ -217,10 +217,10 @@ template <bool Tfrom, bool Tvia>
if (!IsValidStation(station_id)) return false;
if (!ScriptRoad::IsRoadTypeAvailable(road_type)) return false;
for (const RoadStop *rs = ::Station::Get(station_id)->GetPrimaryRoadStop(ROADSTOP_BUS); rs != nullptr; rs = rs->next) {
for (const RoadStop *rs = ::Station::Get(station_id)->GetPrimaryRoadStop(RoadStopType::Bus); rs != nullptr; rs = rs->next) {
if (HasBit(::GetPresentRoadTypes(rs->xy), (::RoadType)road_type)) return true;
}
for (const RoadStop *rs = ::Station::Get(station_id)->GetPrimaryRoadStop(ROADSTOP_TRUCK); rs != nullptr; rs = rs->next) {
for (const RoadStop *rs = ::Station::Get(station_id)->GetPrimaryRoadStop(RoadStopType::Truck); rs != nullptr; rs = rs->next) {
if (HasBit(::GetPresentRoadTypes(rs->xy), (::RoadType)road_type)) return true;
}