1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 21:13:05 +01:00

Fix #23221: Track designs are saved with an incorrect ‘air’ time statistic

Co-authored-by: UnknownShadow200 <UnknownShadow200@users.noreply.github.com>
This commit is contained in:
Michael Steenbeek
2025-01-25 23:11:18 +01:00
committed by GitHub
parent a8beae2ef3
commit 5b5d91abb0
2 changed files with 3 additions and 1 deletions

View File

@@ -67,7 +67,8 @@ namespace OpenRCT2::RCT2
tempStream.WriteValue<uint8_t>(0);
auto entranceStyle = GetStationStyleFromIdentifier(_trackDesign.appearance.stationObjectIdentifier);
tempStream.WriteValue<uint8_t>(entranceStyle);
uint16_t _totalAirTime = std::max<uint16_t>(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<uint16_t>(255, ((_trackDesign.statistics.totalAirTime * 123) + 512) / 1024);
tempStream.WriteValue<uint8_t>(_totalAirTime);
tempStream.WriteValue<uint8_t>(_trackDesign.operation.departFlags);
tempStream.WriteValue<uint8_t>(_trackDesign.trackAndVehicle.numberOfTrains);