From a018cb1ca5786e648117e96a46e2f548a3bf163a Mon Sep 17 00:00:00 2001 From: Duncan Date: Fri, 3 Mar 2023 08:45:32 +0000 Subject: [PATCH] Fix import of ride value (#19541) The ride value undefined constant was changed causing all imports of the undefined value to be incorrect. We can fix the broken imports but can't fix the users of the broken value (gParkValue and its history) --- src/openrct2/network/NetworkBase.cpp | 2 +- src/openrct2/park/ParkFile.cpp | 22 +++++++++++++++++++++- src/openrct2/park/ParkFile.h | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 9acf1dcaf9..e9fa0c01f2 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -43,7 +43,7 @@ // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "8" +#define NETWORK_STREAM_VERSION "9" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index f7e0bc3042..a30fe38b1a 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -1411,7 +1411,27 @@ namespace OpenRCT2 { uint16_t tempRideValue{}; cs.ReadWrite(tempRideValue); - ride.value = ToMoney64(tempRideValue); + if (tempRideValue == 0xFFFFU) + { + ride.value = RIDE_VALUE_UNDEFINED; + } + else + { + ride.value = ToMoney64(tempRideValue); + } + } + else if (version == 19) + { + money64 tempRideValue{}; + cs.ReadWrite(tempRideValue); + if (tempRideValue == 0xFFFFU) + { + ride.value = RIDE_VALUE_UNDEFINED; + } + else + { + ride.value = tempRideValue; + } } else { diff --git a/src/openrct2/park/ParkFile.h b/src/openrct2/park/ParkFile.h index 2c96373f75..4c7e1bc042 100644 --- a/src/openrct2/park/ParkFile.h +++ b/src/openrct2/park/ParkFile.h @@ -9,7 +9,7 @@ struct ObjectRepositoryItem; namespace OpenRCT2 { // Current version that is saved. - constexpr uint32_t PARK_FILE_CURRENT_VERSION = 19; + constexpr uint32_t PARK_FILE_CURRENT_VERSION = 20; // The minimum version that is forwards compatible with the current version. constexpr uint32_t PARK_FILE_MIN_VERSION = 19;