From cc519c2520f8bb9666323d78219de65a2fc22c07 Mon Sep 17 00:00:00 2001 From: MaxMallon Date: Sat, 30 Apr 2022 09:11:10 +0200 Subject: [PATCH] Fix park size (#16934) * Fix park size overflow with big parks * Add a changelog * Increase the version number --- distribution/changelog.txt | 1 + src/openrct2/park/ParkFile.h | 4 ++-- src/openrct2/world/Park.cpp | 8 ++++---- src/openrct2/world/Park.h | 6 +++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 39a6e62d75..e77fc38233 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,6 @@ 0.4.1 (in development) ------------------------------------------------------------------------ +- Fix: [#16934] Park size displayed incorrectly in Park window. - Fix: [#16974] Small scenery ghosts can be deleted. - Fix: [#17005] Unable to set patrol area for first staff member in park. - Fix: [#17073] Corrupt ride window and random crashes when trains have more than 144 cars. diff --git a/src/openrct2/park/ParkFile.h b/src/openrct2/park/ParkFile.h index 74b47fb2df..e445abefdd 100644 --- a/src/openrct2/park/ParkFile.h +++ b/src/openrct2/park/ParkFile.h @@ -8,10 +8,10 @@ struct ObjectRepositoryItem; namespace OpenRCT2 { // Current version that is saved. - constexpr uint32_t PARK_FILE_CURRENT_VERSION = 0xA; + constexpr uint32_t PARK_FILE_CURRENT_VERSION = 0xB; // The minimum version that is forwards compatible with the current version. - constexpr uint32_t PARK_FILE_MIN_VERSION = 0x9; + constexpr uint32_t PARK_FILE_MIN_VERSION = 0xB; // The minimum version that is backwards compatible with the current version. // If this is increased beyond 0, uncomment the checks in ParkFile.cpp and Context.cpp! diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index 1e0c0f417c..c196a10d82 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -49,7 +49,7 @@ using namespace OpenRCT2; uint64_t gParkFlags; uint16_t gParkRating; money16 gParkEntranceFee; -uint16_t gParkSize; +uint32_t gParkSize; money16 gLandPrice; money16 gConstructionRightsPrice; @@ -342,9 +342,9 @@ void Park::Update(const Date& date) GenerateGuests(); } -int32_t Park::CalculateParkSize() const +uint32_t Park::CalculateParkSize() const { - int32_t tiles = 0; + uint32_t tiles = 0; tile_element_iterator it; tile_element_iterator_begin(&it); do @@ -789,7 +789,7 @@ int32_t park_is_open() return GetContext()->GetGameState()->GetPark().IsOpen(); } -int32_t park_calculate_size() +uint32_t park_calculate_size() { auto tiles = GetContext()->GetGameState()->GetPark().CalculateParkSize(); if (tiles != gParkSize) diff --git a/src/openrct2/world/Park.h b/src/openrct2/world/Park.h index 6a5f81123c..60feafe44c 100644 --- a/src/openrct2/world/Park.h +++ b/src/openrct2/world/Park.h @@ -65,7 +65,7 @@ namespace OpenRCT2 void Initialise(); void Update(const Date& date); - int32_t CalculateParkSize() const; + uint32_t CalculateParkSize() const; int32_t CalculateParkRating() const; money64 CalculateParkValue() const; money64 CalculateCompanyValue() const; @@ -90,7 +90,7 @@ namespace OpenRCT2 extern uint64_t gParkFlags; extern uint16_t gParkRating; extern money16 gParkEntranceFee; -extern uint16_t gParkSize; +extern uint32_t gParkSize; extern money16 gLandPrice; extern money16 gConstructionRightsPrice; @@ -110,7 +110,7 @@ void set_forced_park_rating(int32_t rating); int32_t get_forced_park_rating(); int32_t park_is_open(); -int32_t park_calculate_size(); +uint32_t park_calculate_size(); void update_park_fences(const CoordsXY& coords); void update_park_fences_around_tile(const CoordsXY& coords);