From 3375f25b707c7d2b911352e16ba22a0725e87255 Mon Sep 17 00:00:00 2001 From: kiwitreekor Date: Mon, 8 May 2023 03:04:34 +0900 Subject: [PATCH] Fix: Var68 for station and roadstop was broken (#10784) --- src/newgrf_roadstop.cpp | 2 +- src/newgrf_station.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/newgrf_roadstop.cpp b/src/newgrf_roadstop.cpp index b746f2ffe8..bafd66a529 100644 --- a/src/newgrf_roadstop.cpp +++ b/src/newgrf_roadstop.cpp @@ -157,7 +157,7 @@ uint32 RoadStopScopeResolver::GetVariable(byte variable, uint32 parameter, bool if (IsCustomRoadStopSpecIndex(nearby_tile)) { const RoadStopSpecList ssl = BaseStation::GetByTile(nearby_tile)->roadstop_speclist[GetCustomRoadStopSpecIndex(nearby_tile)]; - res |= 1 << (ssl.grfid != grfid ? 9 : 8) | std::max(ssl.localidx, 0xFF); + res |= 1 << (ssl.grfid != grfid ? 9 : 8) | ClampTo(ssl.localidx); } return res; } diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index f13f09974a..9dc117d5b8 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -364,7 +364,7 @@ TownScopeResolver *StationResolverObject::GetTown() if (IsCustomStationSpecIndex(nearby_tile)) { const StationSpecList ssl = BaseStation::GetByTile(nearby_tile)->speclist[GetCustomStationSpecIndex(nearby_tile)]; - res |= 1 << (ssl.grfid != grfid ? 9 : 8) | std::max(ssl.localidx, 0xFF); + res |= 1 << (ssl.grfid != grfid ? 9 : 8) | ClampTo(ssl.localidx); } return res; }