diff --git a/src/newgrf_roadstop.cpp b/src/newgrf_roadstop.cpp index 81e10a0b7b..425865adae 100644 --- a/src/newgrf_roadstop.cpp +++ b/src/newgrf_roadstop.cpp @@ -153,8 +153,8 @@ uint32_t RoadStopScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint if (type == this->type) SetBit(res, 20); if (IsCustomRoadStopSpecIndex(nearby_tile)) { - const RoadStopSpecList ssl = BaseStation::GetByTile(nearby_tile)->roadstop_speclist[GetCustomRoadStopSpecIndex(nearby_tile)]; - res |= 1 << (ssl.grfid != grfid ? 9 : 8) | ClampTo(ssl.localidx); + const auto &sm = BaseStation::GetByTile(nearby_tile)->roadstop_speclist[GetCustomRoadStopSpecIndex(nearby_tile)]; + res |= 1 << (sm.grfid != grfid ? 9 : 8) | ClampTo(sm.localidx); } return res; } @@ -167,8 +167,8 @@ uint32_t RoadStopScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint if (!IsRoadStopTile(nearby_tile)) return 0xFFFFFFFF; if (!IsCustomRoadStopSpecIndex(nearby_tile)) return 0; - const RoadStopSpecList ssl = BaseStation::GetByTile(nearby_tile)->roadstop_speclist[GetCustomRoadStopSpecIndex(nearby_tile)]; - return ssl.grfid; + const auto &sm = BaseStation::GetByTile(nearby_tile)->roadstop_speclist[GetCustomRoadStopSpecIndex(nearby_tile)]; + return sm.grfid; } /* 16 bit road stop ID of nearby tiles */ @@ -180,9 +180,9 @@ uint32_t RoadStopScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint uint32_t grfid = this->st->roadstop_speclist[GetCustomRoadStopSpecIndex(this->tile)].grfid; - const RoadStopSpecList ssl = BaseStation::GetByTile(nearby_tile)->roadstop_speclist[GetCustomRoadStopSpecIndex(nearby_tile)]; - if (ssl.grfid == grfid) { - return ssl.localidx; + const auto &sm = BaseStation::GetByTile(nearby_tile)->roadstop_speclist[GetCustomRoadStopSpecIndex(nearby_tile)]; + if (sm.grfid == grfid) { + return sm.localidx; } return 0xFFFE; diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index b556c66ded..50509dd9ca 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -360,8 +360,8 @@ TownScopeResolver *StationResolverObject::GetTown() uint32_t res = GB(GetStationGfx(nearby_tile), 1, 2) << 12 | !!perpendicular << 11 | !!same_station << 10; if (IsCustomStationSpecIndex(nearby_tile)) { - const StationSpecList ssl = BaseStation::GetByTile(nearby_tile)->speclist[GetCustomStationSpecIndex(nearby_tile)]; - res |= 1 << (ssl.grfid != grfid ? 9 : 8) | ClampTo(ssl.localidx); + const auto &sm = BaseStation::GetByTile(nearby_tile)->speclist[GetCustomStationSpecIndex(nearby_tile)]; + res |= 1 << (sm.grfid != grfid ? 9 : 8) | ClampTo(sm.localidx); } return res; } @@ -372,8 +372,8 @@ TownScopeResolver *StationResolverObject::GetTown() if (!HasStationTileRail(nearby_tile)) return 0xFFFFFFFF; if (!IsCustomStationSpecIndex(nearby_tile)) return 0; - const StationSpecList ssl = BaseStation::GetByTile(nearby_tile)->speclist[GetCustomStationSpecIndex(nearby_tile)]; - return ssl.grfid; + const auto &sm = BaseStation::GetByTile(nearby_tile)->speclist[GetCustomStationSpecIndex(nearby_tile)]; + return sm.grfid; } case 0x6B: { // 16 bit Station ID of nearby tiles @@ -384,9 +384,9 @@ TownScopeResolver *StationResolverObject::GetTown() uint32_t grfid = this->st->speclist[GetCustomStationSpecIndex(this->tile)].grfid; - const StationSpecList ssl = BaseStation::GetByTile(nearby_tile)->speclist[GetCustomStationSpecIndex(nearby_tile)]; - if (ssl.grfid == grfid) { - return ssl.localidx; + const auto &sm = BaseStation::GetByTile(nearby_tile)->speclist[GetCustomStationSpecIndex(nearby_tile)]; + if (sm.grfid == grfid) { + return sm.localidx; } return 0xFFFE;