From 5b5d91abb00a61e934d6c97b783e11dd7d25b47e Mon Sep 17 00:00:00 2001 From: Michael Steenbeek <1478678+Gymnasiast@users.noreply.github.com> Date: Sat, 25 Jan 2025 23:11:18 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20#23221:=20Track=20designs=20are=20saved?= =?UTF-8?q?=20with=20an=20incorrect=20=E2=80=98air=E2=80=99=20time=20stati?= =?UTF-8?q?stic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: UnknownShadow200 --- distribution/changelog.txt | 1 + src/openrct2/rct2/T6Exporter.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 93c5199f49..f8a5bc9d8a 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -8,6 +8,7 @@ - Change: [#23328] All RCT2 entertainer costumes are now available in legacy parks. - Fix: [#1479] Incorrect values provided by the in game console “get location” command. - Fix: [#21794] Lay-down coaster cars reverse on first frames of downwards corkscrew. +- Fix: [#23221] Track designs are saved with an incorrect ‘air’ time statistic. - Fix: [#23368] Incorrect refund amount when deleting track pieces at or above 96m. - Fix: [#23508] Simultaneous virtual floors shown for ride and footpath. - Fix: [#23512] Holding brakes are skipped if they’re too close together. diff --git a/src/openrct2/rct2/T6Exporter.cpp b/src/openrct2/rct2/T6Exporter.cpp index e7c56013ed..4e4d2eecf2 100644 --- a/src/openrct2/rct2/T6Exporter.cpp +++ b/src/openrct2/rct2/T6Exporter.cpp @@ -67,7 +67,8 @@ namespace OpenRCT2::RCT2 tempStream.WriteValue(0); auto entranceStyle = GetStationStyleFromIdentifier(_trackDesign.appearance.stationObjectIdentifier); tempStream.WriteValue(entranceStyle); - uint16_t _totalAirTime = std::max(255, (_trackDesign.statistics.totalAirTime * 123) / 1024); + // The 512 added is to enforce correctly rounding up, as integer division will truncate. + uint16_t _totalAirTime = std::min(255, ((_trackDesign.statistics.totalAirTime * 123) + 512) / 1024); tempStream.WriteValue(_totalAirTime); tempStream.WriteValue(_trackDesign.operation.departFlags); tempStream.WriteValue(_trackDesign.trackAndVehicle.numberOfTrains);