diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 13b7e982fe..a495ead473 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -28,6 +28,7 @@ - Fix: [#19733] Favorite ride of X guests integer overflow. - Fix: [#19756] Crash with title sequences containing no commands. - Fix: [#19767] No message when path is not connected to ride exit and is therefore unreachable for mechanics. +- Fix: [#19800] Crash when displaying station stats with more than 62 stations. - Fix: [#19801] The in-game load/save window cannot be resized anymore. - Fix: [#19854] Looping Coaster trains clipping through steep quarter turns down. - Fix: [#19858] Issue drawing simulate flag icon on alternate colour palettes. diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 4d9bbf2aca..9ab4efa397 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -5772,7 +5772,10 @@ static void WindowRideMeasurementsPaint(WindowBase* w, DrawPixelInfo& dpi) // Ride time ft = Formatter(); int32_t numTimes = 0; - for (int32_t i = 0; i < ride->num_stations; i++) + // TODO: STR_RIDE_TIME only takes up to 4 stations modify to take more + // also if modified may need to be split into multiple format strings + // as formatter cannot take more than 256 bytes + for (int32_t i = 0; i < std::min(ride->num_stations, 4); i++) { StationIndex stationIndex = StationIndex::FromUnderlying(numTimes); auto time = ride->GetStation(stationIndex).SegmentTime; @@ -5810,7 +5813,8 @@ static void WindowRideMeasurementsPaint(WindowBase* w, DrawPixelInfo& dpi) // Ride length ft = Formatter(); int32_t numLengths = 0; - for (int32_t i = 0; i < ride->num_stations; i++) + // TODO: see above STR_RIDE_LENGTH is also only able to display max 4 + for (int32_t i = 0; i < std::min(ride->num_stations, 4); i++) { StationIndex stationIndex = StationIndex::FromUnderlying(i); auto length = ride->GetStation(stationIndex).SegmentLength;