From 83c6ce6b39f43cb7e1c35ec9a5a11d6239632bb8 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sat, 3 Sep 2022 16:22:54 +0200 Subject: [PATCH 1/3] Fix #17865: Unopened rides contribute to difficult guest cap --- distribution/changelog.txt | 1 + src/openrct2/world/Park.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index cabbc19b4e..6155928b37 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -51,6 +51,7 @@ - Fix: [#17897] Guest can get stuck on tiles with construction rights outside the park. - Fix: [#17905] The chain button in the map window is enabled for rectangular maps when (re)opened. - Fix: [#17931] The in-game command ‘count_objects’ crashes the game. +- Fix: [#17865] With difficult guest generation, tested but unopened rides still contribute to the guest cap. - Fix: [#17866] [Plugin] Wrong Soft Guest Cap at start of new game 0.4.1 (2022-07-04) diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index c23d7d32d4..4ca6475e86 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -570,6 +570,8 @@ uint32_t Park::CalculateSuggestedMaxGuests() const suggestedMaxGuests = std::min(suggestedMaxGuests, 1000); for (auto& ride : GetRideManager()) { + if (ride.status != RideStatus::Open) + continue; if (ride.lifecycle_flags & RIDE_LIFECYCLE_CRASHED) continue; if (ride.lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) From 7537ca24e39a5563c4a4b0e47f6b8588170b9ce0 Mon Sep 17 00:00:00 2001 From: Stephan Spengler Date: Sat, 3 Sep 2022 16:24:21 +0200 Subject: [PATCH 2/3] Combine the guest generation loops into one --- src/openrct2/world/Park.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index 4ca6475e86..8ceca28922 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -549,8 +549,8 @@ money16 Park::CalculateTotalRideValueForMoney() const uint32_t Park::CalculateSuggestedMaxGuests() const { uint32_t suggestedMaxGuests = 0; + uint32_t difficultGenerationBonus = 0; - // TODO combine the two ride loops for (auto& ride : GetRideManager()) { if (ride.status != RideStatus::Open) @@ -562,20 +562,10 @@ uint32_t Park::CalculateSuggestedMaxGuests() const // Add guest score for ride type suggestedMaxGuests += ride.GetRideTypeDescriptor().BonusValue; - } - // If difficult guest generation, extra guests are available for good rides - if (gParkFlags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) - { - suggestedMaxGuests = std::min(suggestedMaxGuests, 1000); - for (auto& ride : GetRideManager()) + // If difficult guest generation, extra guests are available for good rides + if (gParkFlags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) { - if (ride.status != RideStatus::Open) - continue; - if (ride.lifecycle_flags & RIDE_LIFECYCLE_CRASHED) - continue; - if (ride.lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) - continue; if (!(ride.lifecycle_flags & RIDE_LIFECYCLE_TESTED)) continue; if (!ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK)) @@ -588,10 +578,16 @@ uint32_t Park::CalculateSuggestedMaxGuests() const continue; // Bonus guests for good ride - suggestedMaxGuests += ride.GetRideTypeDescriptor().BonusValue * 2; + difficultGenerationBonus += ride.GetRideTypeDescriptor().BonusValue * 2; } } + if (gParkFlags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) + { + suggestedMaxGuests = std::min(suggestedMaxGuests, 1000); + suggestedMaxGuests += difficultGenerationBonus; + } + suggestedMaxGuests = std::min(suggestedMaxGuests, 65535); return suggestedMaxGuests; } From eea69c026cecae3a1f23160581cbbc66071f17e1 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sat, 3 Sep 2022 16:24:39 +0200 Subject: [PATCH 3/3] Bump network version --- src/openrct2/network/NetworkBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index aa6b315824..9665f1fab2 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -42,7 +42,7 @@ // This string specifies which version of network stream current build uses. // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "11" +#define NETWORK_STREAM_VERSION "12" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION static Peep* _pickup_peep = nullptr;