1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +01:00

Refactor award effect consts into an enum class

This commit is contained in:
Gymnasiast
2025-07-02 19:46:18 +02:00
parent af3f61e49b
commit 600a65b5bf

View File

@@ -24,27 +24,29 @@
using namespace OpenRCT2;
constexpr uint8_t NEGATIVE = 0;
constexpr uint8_t POSITIVE = 1;
static constexpr uint8_t AwardPositiveMap[] = {
NEGATIVE, // AwardType::MostUntidy
POSITIVE, // AwardType::MostTidy
POSITIVE, // AwardType::BestRollerCoasters
POSITIVE, // AwardType::BestValue
POSITIVE, // AwardType::MostBeautiful
NEGATIVE, // AwardType::WorstValue
POSITIVE, // AwardType::Safest
POSITIVE, // AwardType::BestStaff
POSITIVE, // AwardType::BestFood
NEGATIVE, // AwardType::WorstFood
POSITIVE, // AwardType::BestToilets
NEGATIVE, // AwardType::MostDisappointing
POSITIVE, // AwardType::BestWaterRides
POSITIVE, // AwardType::BestCustomDesignedRides
POSITIVE, // AwardType::MostDazzlingRideColours
NEGATIVE, // AwardType::MostConfusingLayout
POSITIVE, // AwardType::BestGentleRides
enum class AwardEffect : uint8_t
{
negative,
positive
};
static constexpr AwardEffect kAwardPositiveMap[] = {
AwardEffect::negative, // AwardType::MostUntidy
AwardEffect::positive, // AwardType::MostTidy
AwardEffect::positive, // AwardType::BestRollerCoasters
AwardEffect::positive, // AwardType::BestValue
AwardEffect::positive, // AwardType::MostBeautiful
AwardEffect::negative, // AwardType::WorstValue
AwardEffect::positive, // AwardType::Safest
AwardEffect::positive, // AwardType::BestStaff
AwardEffect::positive, // AwardType::BestFood
AwardEffect::negative, // AwardType::WorstFood
AwardEffect::positive, // AwardType::BestToilets
AwardEffect::negative, // AwardType::MostDisappointing
AwardEffect::positive, // AwardType::BestWaterRides
AwardEffect::positive, // AwardType::BestCustomDesignedRides
AwardEffect::positive, // AwardType::MostDazzlingRideColours
AwardEffect::negative, // AwardType::MostConfusingLayout
AwardEffect::positive, // AwardType::BestGentleRides
};
static constexpr StringId AwardNewsStrings[] = {
@@ -69,7 +71,7 @@ static constexpr StringId AwardNewsStrings[] = {
bool AwardIsPositive(AwardType type)
{
return AwardPositiveMap[EnumValue(type)];
return kAwardPositiveMap[EnumValue(type)] == AwardEffect::positive;
}
#pragma region Award checks