1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 23:04:36 +01:00

Move kRideRatingUndefined into namespace

This commit is contained in:
Tulio Leao
2025-08-16 07:12:25 -03:00
parent c86183bf3b
commit a6d8c623af
3 changed files with 11 additions and 9 deletions

View File

@@ -1075,23 +1075,24 @@ namespace OpenRCT2::Ui::Windows
break;
case INFORMATION_TYPE_EXCITEMENT:
SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool {
const auto leftValue = thisRide.ratings.isNull() ? kRideRatingUndefined : thisRide.ratings.excitement;
const auto rightValue = otherRide.ratings.isNull() ? kRideRatingUndefined
const auto leftValue = thisRide.ratings.isNull() ? RideRating::kUndefined : thisRide.ratings.excitement;
const auto rightValue = otherRide.ratings.isNull() ? RideRating::kUndefined
: otherRide.ratings.excitement;
return leftValue <= rightValue;
});
break;
case INFORMATION_TYPE_INTENSITY:
SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool {
const auto leftValue = thisRide.ratings.isNull() ? kRideRatingUndefined : thisRide.ratings.intensity;
const auto rightValue = otherRide.ratings.isNull() ? kRideRatingUndefined : otherRide.ratings.intensity;
const auto leftValue = thisRide.ratings.isNull() ? RideRating::kUndefined : thisRide.ratings.intensity;
const auto rightValue = otherRide.ratings.isNull() ? RideRating::kUndefined
: otherRide.ratings.intensity;
return leftValue <= rightValue;
});
break;
case INFORMATION_TYPE_NAUSEA:
SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool {
const auto leftValue = thisRide.ratings.isNull() ? kRideRatingUndefined : thisRide.ratings.nausea;
const auto rightValue = otherRide.ratings.isNull() ? kRideRatingUndefined : otherRide.ratings.nausea;
const auto leftValue = thisRide.ratings.isNull() ? RideRating::kUndefined : thisRide.ratings.nausea;
const auto rightValue = otherRide.ratings.isNull() ? RideRating::kUndefined : otherRide.ratings.nausea;
return leftValue <= rightValue;
});
break;

View File

@@ -2311,10 +2311,10 @@ static void RideRatingsApplyPenaltyLateralGs(OpenRCT2::RideRating::Tuple& rating
bool OpenRCT2::RideRating::Tuple::isNull() const
{
return excitement == kRideRatingUndefined;
return excitement == kUndefined;
}
void OpenRCT2::RideRating::Tuple::setNull()
{
excitement = kRideRatingUndefined;
excitement = kUndefined;
}

View File

@@ -29,10 +29,11 @@ constexpr ride_rating MakeRideRating(int16_t whole, uint8_t fraction)
{
return MakeFixed2dp<ride_rating>(whole, fraction);
}
constexpr ride_rating kRideRatingUndefined = 0xFFFFu;
namespace OpenRCT2::RideRating
{
constexpr ride_rating kUndefined = 0xFFFFu;
#pragma pack(push, 1)
// Used for return values, for functions that modify all three.