From c9be2ecca12a6bb295a51c3951888253bba07e64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chvojka?= <45093589+beesman93@users.noreply.github.com> Date: Wed, 17 Jul 2024 12:52:00 +0200 Subject: [PATCH] Fix #22245: Unrated rides cause high amount of nausea (#22284) Reverts #22199 changes that seem to cause a nausea bug on untested rides Nulls are now considered higher values than anything, making them appear on the tail of ascending lists again Checking for NULL in ratings.intensity and ratings.nausea didn't work, they seem to retain there values pre ratings reset and setting them to null would change the behaviour of the game - so instead we check for ratings.isNull() in the sorting to properly put null ratings to tail of sorted lists. --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/RideList.cpp | 14 +++++++++++--- src/openrct2/ride/RideRatings.cpp | 2 -- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 45627055a8..07ab8e09c6 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -12,6 +12,7 @@ - Fix: [#19210] The load/save window executes the loading code twice, resulting in a slowdown. - Fix: [#22056] Potential crash upon exiting the game. - Fix: [#22208] Cursor may fail to register hits in some cases (original bug). +- Fix: [#22284] Unrated rides cause high amount of nausea. - Fix: [#22304] Graphs don't draw lines on the left edge of the screen. - Fix: [#22318] Water sparkles are missing if transparent water is enabled without RCT1 linked. diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index d977691e2d..595e9eef99 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -914,17 +915,24 @@ static Widget _rideListWidgets[] = { break; case INFORMATION_TYPE_EXCITEMENT: SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.ratings.excitement <= otherRide.ratings.excitement; + const auto leftValue = thisRide.ratings.isNull() ? kRideRatingUndefined : thisRide.ratings.excitement; + const auto rightValue = otherRide.ratings.isNull() ? kRideRatingUndefined + : otherRide.ratings.excitement; + return leftValue <= rightValue; }); break; case INFORMATION_TYPE_INTENSITY: SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.ratings.intensity <= otherRide.ratings.intensity; + const auto leftValue = thisRide.ratings.isNull() ? kRideRatingUndefined : thisRide.ratings.intensity; + const auto rightValue = otherRide.ratings.isNull() ? kRideRatingUndefined : otherRide.ratings.intensity; + return leftValue <= rightValue; }); break; case INFORMATION_TYPE_NAUSEA: SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { - return thisRide.ratings.nausea <= otherRide.ratings.nausea; + const auto leftValue = thisRide.ratings.isNull() ? kRideRatingUndefined : thisRide.ratings.nausea; + const auto rightValue = otherRide.ratings.isNull() ? kRideRatingUndefined : otherRide.ratings.nausea; + return leftValue <= rightValue; }); break; } diff --git a/src/openrct2/ride/RideRatings.cpp b/src/openrct2/ride/RideRatings.cpp index 8c029ad4ad..b677e18800 100644 --- a/src/openrct2/ride/RideRatings.cpp +++ b/src/openrct2/ride/RideRatings.cpp @@ -2268,6 +2268,4 @@ bool RatingTuple::isNull() const void RatingTuple::setNull() { excitement = kRideRatingUndefined; - intensity = kRideRatingUndefined; - nausea = kRideRatingUndefined; }