Codechange: Use consistent name for bay road stops

As of #10494, this is how we describe original dead-end road stops.
This commit is contained in:
Tyler Trahan 2023-10-22 17:27:57 -04:00
parent 5f442c9127
commit 1f41e773d6
12 changed files with 22 additions and 22 deletions

View File

@ -1220,7 +1220,7 @@ static void CheckCaches()
/* Strict checking of the road stop cache entries */ /* Strict checking of the road stop cache entries */
for (const RoadStop *rs : RoadStop::Iterate()) { for (const RoadStop *rs : RoadStop::Iterate()) {
if (IsStandardRoadStopTile(rs->xy)) continue; if (IsBayRoadStopTile(rs->xy)) continue;
assert(rs->GetEntry(DIAGDIR_NE) != rs->GetEntry(DIAGDIR_NW)); assert(rs->GetEntry(DIAGDIR_NE) != rs->GetEntry(DIAGDIR_NW));
rs->GetEntry(DIAGDIR_NE)->CheckIntegrity(rs); rs->GetEntry(DIAGDIR_NE)->CheckIntegrity(rs);

View File

@ -247,7 +247,7 @@ protected:
inline bool CanExitOldTile() inline bool CanExitOldTile()
{ {
/* road stop can be left at one direction only unless it's a drive-through stop */ /* road stop can be left at one direction only unless it's a drive-through stop */
if (IsRoadTT() && IsStandardRoadStopTile(m_old_tile)) { if (IsRoadTT() && IsBayRoadStopTile(m_old_tile)) {
DiagDirection exitdir = GetRoadStopDir(m_old_tile); DiagDirection exitdir = GetRoadStopDir(m_old_tile);
if (exitdir != m_exitdir) { if (exitdir != m_exitdir) {
m_err = EC_NO_WAY; m_err = EC_NO_WAY;
@ -278,7 +278,7 @@ protected:
/** return true if we can enter m_new_tile from m_exitdir */ /** return true if we can enter m_new_tile from m_exitdir */
inline bool CanEnterNewTile() inline bool CanEnterNewTile()
{ {
if (IsRoadTT() && IsStandardRoadStopTile(m_new_tile)) { if (IsRoadTT() && IsBayRoadStopTile(m_new_tile)) {
/* road stop can be entered from one direction only unless it's a drive-through stop */ /* road stop can be entered from one direction only unless it's a drive-through stop */
DiagDirection exitdir = GetRoadStopDir(m_new_tile); DiagDirection exitdir = GetRoadStopDir(m_new_tile);
if (ReverseDiagDir(exitdir) != m_exitdir) { if (ReverseDiagDir(exitdir) != m_exitdir) {
@ -402,7 +402,7 @@ protected:
/* Single tram bits and standard road stops cause reversing. */ /* Single tram bits and standard road stops cause reversing. */
if (IsRoadTT() && ((IsTram() && GetSingleTramBit(m_old_tile) == ReverseDiagDir(m_exitdir)) || if (IsRoadTT() && ((IsTram() && GetSingleTramBit(m_old_tile) == ReverseDiagDir(m_exitdir)) ||
(IsStandardRoadStopTile(m_old_tile) && GetRoadStopDir(m_old_tile) == ReverseDiagDir(m_exitdir)))) { (IsBayRoadStopTile(m_old_tile) && GetRoadStopDir(m_old_tile) == ReverseDiagDir(m_exitdir)))) {
/* reverse */ /* reverse */
m_new_tile = m_old_tile; m_new_tile = m_old_tile;
m_new_td_bits = TrackdirToTrackdirBits(ReverseTrackdir(m_old_td)); m_new_td_bits = TrackdirToTrackdirBits(ReverseTrackdir(m_old_td));

View File

@ -695,7 +695,7 @@ static bool CanEnterTileOwnerCheck(Owner owner, TileIndex tile, DiagDirection en
if (IsTileType(tile, MP_RAILWAY) || // Rail tile (also rail depot) if (IsTileType(tile, MP_RAILWAY) || // Rail tile (also rail depot)
HasStationTileRail(tile) || // Rail station tile/waypoint HasStationTileRail(tile) || // Rail station tile/waypoint
IsRoadDepotTile(tile) || // Road depot tile IsRoadDepotTile(tile) || // Road depot tile
IsStandardRoadStopTile(tile)) { // Road station tile (but not drive-through stops) IsBayRoadStopTile(tile)) { // Road station tile (but not drive-through stops)
return IsTileOwner(tile, owner); // You need to own these tiles entirely to use them return IsTileOwner(tile, owner); // You need to own these tiles entirely to use them
} }
@ -768,7 +768,7 @@ static DiagDirection GetTileSingleEntry(TileIndex tile, TransportType type, uint
if (type != TRANSPORT_WATER && IsDepotTypeTile(tile, type)) return GetDepotDirection(tile, type); if (type != TRANSPORT_WATER && IsDepotTypeTile(tile, type)) return GetDepotDirection(tile, type);
if (type == TRANSPORT_ROAD) { if (type == TRANSPORT_ROAD) {
if (IsStandardRoadStopTile(tile)) return GetRoadStopDir(tile); if (IsBayRoadStopTile(tile)) return GetRoadStopDir(tile);
if ((RoadTramType)subtype == RTT_TRAM) return GetSingleTramBit(tile); if ((RoadTramType)subtype == RTT_TRAM) return GetSingleTramBit(tile);
} }

View File

@ -2487,7 +2487,7 @@ CommandCost CmdConvertRoad(DoCommandFlag flags, TileIndex tile, TileIndex area_s
} }
uint num_pieces = CountBits(GetAnyRoadBits(tile, rtt)); uint num_pieces = CountBits(GetAnyRoadBits(tile, rtt));
if (tt == MP_STATION && IsStandardRoadStopTile(tile)) { if (tt == MP_STATION && IsBayRoadStopTile(tile)) {
num_pieces *= ROAD_STOP_TRACKBIT_FACTOR; num_pieces *= ROAD_STOP_TRACKBIT_FACTOR;
} else if (tt == MP_ROAD && IsRoadDepot(tile)) { } else if (tt == MP_ROAD && IsRoadDepot(tile)) {
num_pieces *= ROAD_DEPOT_TRACKBIT_FACTOR; num_pieces *= ROAD_DEPOT_TRACKBIT_FACTOR;

View File

@ -45,7 +45,7 @@ RoadStop *RoadStop::GetNextRoadStop(const RoadVehicle *v) const
/* The vehicle cannot go to this roadstop (different roadtype) */ /* The vehicle cannot go to this roadstop (different roadtype) */
if (!HasTileAnyRoadType(rs->xy, v->compatible_roadtypes)) continue; if (!HasTileAnyRoadType(rs->xy, v->compatible_roadtypes)) continue;
/* The vehicle is articulated and can therefore not go to a standard road stop. */ /* The vehicle is articulated and can therefore not go to a standard road stop. */
if (IsStandardRoadStopTile(rs->xy) && v->HasArticulatedPart()) continue; if (IsBayRoadStopTile(rs->xy) && v->HasArticulatedPart()) continue;
/* The vehicle can actually go to this road stop. So, return it! */ /* The vehicle can actually go to this road stop. So, return it! */
return rs; return rs;
@ -215,7 +215,7 @@ void RoadStop::ClearDriveThrough()
*/ */
void RoadStop::Leave(RoadVehicle *rv) void RoadStop::Leave(RoadVehicle *rv)
{ {
if (IsStandardRoadStopTile(rv->tile)) { if (IsBayRoadStopTile(rv->tile)) {
/* Vehicle is leaving a road stop tile, mark bay as free */ /* Vehicle is leaving a road stop tile, mark bay as free */
this->FreeBay(HasBit(rv->state, RVS_USING_SECOND_BAY)); this->FreeBay(HasBit(rv->state, RVS_USING_SECOND_BAY));
this->SetEntranceBusy(false); this->SetEntranceBusy(false);
@ -232,7 +232,7 @@ void RoadStop::Leave(RoadVehicle *rv)
*/ */
bool RoadStop::Enter(RoadVehicle *rv) bool RoadStop::Enter(RoadVehicle *rv)
{ {
if (IsStandardRoadStopTile(this->xy)) { if (IsBayRoadStopTile(this->xy)) {
/* For normal (non drive-through) road stops /* For normal (non drive-through) road stops
* Check if station is busy or if there are no free bays or whether it is a articulated vehicle. */ * Check if station is busy or if there are no free bays or whether it is a articulated vehicle. */
if (this->IsEntranceBusy() || !this->HasFreeBay() || rv->HasArticulatedPart()) return false; if (this->IsEntranceBusy() || !this->HasFreeBay() || rv->HasArticulatedPart()) return false;

View File

@ -893,7 +893,7 @@ static Trackdir RoadFindPathToDest(RoadVehicle *v, TileIndex tile, DiagDirection
/* Road depot owned by another company or with the wrong orientation */ /* Road depot owned by another company or with the wrong orientation */
trackdirs = TRACKDIR_BIT_NONE; trackdirs = TRACKDIR_BIT_NONE;
} }
} else if (IsTileType(tile, MP_STATION) && IsStandardRoadStopTile(tile)) { } else if (IsTileType(tile, MP_STATION) && IsBayRoadStopTile(tile)) {
/* Standard road stop (drive-through stops are treated as normal road) */ /* Standard road stop (drive-through stops are treated as normal road) */
if (!IsTileOwner(tile, v->owner) || GetRoadStopDir(tile) == enterdir || v->HasArticulatedPart()) { if (!IsTileOwner(tile, v->owner) || GetRoadStopDir(tile) == enterdir || v->HasArticulatedPart()) {
@ -908,7 +908,7 @@ static Trackdir RoadFindPathToDest(RoadVehicle *v, TileIndex tile, DiagDirection
trackdirs = TRACKDIR_BIT_NONE; trackdirs = TRACKDIR_BIT_NONE;
} else { } else {
/* Proper station type, check if there is free loading bay */ /* Proper station type, check if there is free loading bay */
if (!_settings_game.pf.roadveh_queue && IsStandardRoadStopTile(tile) && if (!_settings_game.pf.roadveh_queue && IsBayRoadStopTile(tile) &&
!RoadStop::GetByTile(tile, rstype)->HasFreeBay()) { !RoadStop::GetByTile(tile, rstype)->HasFreeBay()) {
/* Station is full and RV queuing is off */ /* Station is full and RV queuing is off */
trackdirs = TRACKDIR_BIT_NONE; trackdirs = TRACKDIR_BIT_NONE;
@ -1535,7 +1535,7 @@ again:
if (v->current_order.IsType(OT_LEAVESTATION)) v->current_order.Free(); if (v->current_order.IsType(OT_LEAVESTATION)) v->current_order.Free();
} }
if (IsStandardRoadStopTile(v->tile)) rs->SetEntranceBusy(true); if (IsBayRoadStopTile(v->tile)) rs->SetEntranceBusy(true);
StartRoadVehSound(v); StartRoadVehSound(v);
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP); SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
@ -1740,7 +1740,7 @@ Trackdir RoadVehicle::GetVehicleTrackdir() const
return DiagDirToDiagTrackdir(GetRoadDepotDirection(this->tile)); return DiagDirToDiagTrackdir(GetRoadDepotDirection(this->tile));
} }
if (IsStandardRoadStopTile(this->tile)) { if (IsBayRoadStopTile(this->tile)) {
/* We'll assume the road vehicle is facing outwards */ /* We'll assume the road vehicle is facing outwards */
return DiagDirToDiagTrackdir(GetRoadStopDir(this->tile)); // Road vehicle in a station return DiagDirToDiagTrackdir(GetRoadStopDir(this->tile)); // Road vehicle in a station
} }

View File

@ -2828,7 +2828,7 @@ bool AfterLoadGame()
/* The road owner of standard road stops was not properly accounted for. */ /* The road owner of standard road stops was not properly accounted for. */
if (IsSavegameVersionBefore(SLV_172)) { if (IsSavegameVersionBefore(SLV_172)) {
for (auto t : Map::Iterate()) { for (auto t : Map::Iterate()) {
if (!IsStandardRoadStopTile(t)) continue; if (!IsBayRoadStopTile(t)) continue;
Owner o = GetTileOwner(t); Owner o = GetTileOwner(t);
SetRoadOwner(t, RTT_ROAD, o); SetRoadOwner(t, RTT_ROAD, o);
SetRoadOwner(t, RTT_TRAM, o); SetRoadOwner(t, RTT_TRAM, o);

View File

@ -211,7 +211,7 @@ RoadStop *Station::GetPrimaryRoadStop(const RoadVehicle *v) const
/* The vehicle cannot go to this roadstop (different roadtype) */ /* The vehicle cannot go to this roadstop (different roadtype) */
if (!HasTileAnyRoadType(rs->xy, v->compatible_roadtypes)) continue; if (!HasTileAnyRoadType(rs->xy, v->compatible_roadtypes)) continue;
/* The vehicle is articulated and can therefore not go to a standard road stop. */ /* The vehicle is articulated and can therefore not go to a standard road stop. */
if (IsStandardRoadStopTile(rs->xy) && v->HasArticulatedPart()) continue; if (IsBayRoadStopTile(rs->xy) && v->HasArticulatedPart()) continue;
/* The vehicle can actually go to this road stop. So, return it! */ /* The vehicle can actually go to this road stop. So, return it! */
break; break;

View File

@ -3408,7 +3408,7 @@ static TrackStatus GetTileTrackStatus_Station(TileIndex tile, TransportType mode
Axis axis = DiagDirToAxis(dir); Axis axis = DiagDirToAxis(dir);
if (side != INVALID_DIAGDIR) { if (side != INVALID_DIAGDIR) {
if (axis != DiagDirToAxis(side) || (IsStandardRoadStopTile(tile) && dir != side)) break; if (axis != DiagDirToAxis(side) || (IsBayRoadStopTile(tile) && dir != side)) break;
} }
trackbits = AxisToTrackBits(axis); trackbits = AxisToTrackBits(axis);

View File

@ -216,11 +216,11 @@ static inline bool IsRoadStopTile(Tile t)
} }
/** /**
* Is tile \a t a standard (non-drive through) road stop station? * Is tile \a t a bay (non-drive through) road stop station?
* @param t Tile to check * @param t Tile to check
* @return \c true if the tile is a station tile and a standard road stop * @return \c true if the tile is a station tile and a bay road stop
*/ */
static inline bool IsStandardRoadStopTile(Tile t) static inline bool IsBayRoadStopTile(Tile t)
{ {
return IsRoadStopTile(t) && GetStationGfx(t) < GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET; return IsRoadStopTile(t) && GetStationGfx(t) < GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET;
} }

View File

@ -847,7 +847,7 @@ void OnTick_Town()
*/ */
static RoadBits GetTownRoadBits(TileIndex tile) static RoadBits GetTownRoadBits(TileIndex tile)
{ {
if (IsRoadDepotTile(tile) || IsStandardRoadStopTile(tile)) return ROAD_NONE; if (IsRoadDepotTile(tile) || IsBayRoadStopTile(tile)) return ROAD_NONE;
return GetAnyRoadBits(tile, RTT_ROAD, true); return GetAnyRoadBits(tile, RTT_ROAD, true);
} }

View File

@ -2896,7 +2896,7 @@ StringID GetVehicleCannotUseStationReason(const Vehicle *v, const Station *st)
for (; rs != nullptr; rs = rs->next) { for (; rs != nullptr; rs = rs->next) {
/* Articulated vehicles cannot use bay road stops, only drive-through. Make sure the vehicle can actually use this bay stop */ /* Articulated vehicles cannot use bay road stops, only drive-through. Make sure the vehicle can actually use this bay stop */
if (HasTileAnyRoadType(rs->xy, rv->compatible_roadtypes) && IsStandardRoadStopTile(rs->xy) && rv->HasArticulatedPart()) { if (HasTileAnyRoadType(rs->xy, rv->compatible_roadtypes) && IsBayRoadStopTile(rs->xy) && rv->HasArticulatedPart()) {
err = STR_ERROR_NO_STOP_ARTICULATED_VEHICLE; err = STR_ERROR_NO_STOP_ARTICULATED_VEHICLE;
continue; continue;
} }