mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Refactor PARK_AWARD to use strong enum (#13017)
* Refactor PARK_AWARD to use strong enum
This commit is contained in:
@@ -26,23 +26,23 @@ constexpr uint8_t NEGATIVE = 0;
|
||||
constexpr uint8_t POSITIVE = 1;
|
||||
|
||||
static constexpr const uint8_t AwardPositiveMap[] = {
|
||||
NEGATIVE, // PARK_AWARD_MOST_UNTIDY
|
||||
POSITIVE, // PARK_AWARD_MOST_TIDY
|
||||
POSITIVE, // PARK_AWARD_BEST_ROLLERCOASTERS
|
||||
POSITIVE, // PARK_AWARD_BEST_VALUE
|
||||
POSITIVE, // PARK_AWARD_MOST_BEAUTIFUL
|
||||
NEGATIVE, // PARK_AWARD_WORST_VALUE
|
||||
POSITIVE, // PARK_AWARD_SAFEST
|
||||
POSITIVE, // PARK_AWARD_BEST_STAFF
|
||||
POSITIVE, // PARK_AWARD_BEST_FOOD
|
||||
NEGATIVE, // PARK_AWARD_WORST_FOOD
|
||||
POSITIVE, // PARK_AWARD_BEST_RESTROOMS
|
||||
NEGATIVE, // PARK_AWARD_MOST_DISAPPOINTING
|
||||
POSITIVE, // PARK_AWARD_BEST_WATER_RIDES
|
||||
POSITIVE, // PARK_AWARD_BEST_CUSTOM_DESIGNED_RIDES
|
||||
POSITIVE, // PARK_AWARD_MOST_DAZZLING_RIDE_COLOURS
|
||||
NEGATIVE, // PARK_AWARD_MOST_CONFUSING_LAYOUT
|
||||
POSITIVE, // PARK_AWARD_BEST_GENTLE_RIDES
|
||||
NEGATIVE, // ParkAward::MostUntidy
|
||||
POSITIVE, // ParkAward::MostTidy
|
||||
POSITIVE, // ParkAward::BestRollerCoasters
|
||||
POSITIVE, // ParkAward::BestValue
|
||||
POSITIVE, // ParkAward::MostBeautiful
|
||||
NEGATIVE, // ParkAward::WorstValue
|
||||
POSITIVE, // ParkAward::Safest
|
||||
POSITIVE, // ParkAward::BestStaff
|
||||
POSITIVE, // ParkAward::BestFood
|
||||
NEGATIVE, // ParkAward::WorstFood
|
||||
POSITIVE, // ParkAward::BestRestrooms
|
||||
NEGATIVE, // ParkAward::MostDisappointing
|
||||
POSITIVE, // ParkAward::BestWaterRides
|
||||
POSITIVE, // ParkAward::BestCustomDesignedRides
|
||||
POSITIVE, // ParkAward::MostDazzlingRideColours
|
||||
NEGATIVE, // ParkAward::MostConfusingLayout
|
||||
POSITIVE, // ParkAward::BestGentleRides
|
||||
};
|
||||
|
||||
static constexpr const rct_string_id AwardNewsStrings[] = {
|
||||
@@ -77,11 +77,11 @@ bool award_is_positive(int32_t type)
|
||||
/** More than 1/16 of the total guests must be thinking untidy thoughts. */
|
||||
static bool award_is_deserved_most_untidy(int32_t activeAwardTypes)
|
||||
{
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_MOST_BEAUTIFUL))
|
||||
if (activeAwardTypes & EnumToFlag(ParkAward::MostBeautiful))
|
||||
return false;
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_BEST_STAFF))
|
||||
if (activeAwardTypes & EnumToFlag(ParkAward::BestStaff))
|
||||
return false;
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_MOST_TIDY))
|
||||
if (activeAwardTypes & EnumToFlag(ParkAward::MostTidy))
|
||||
return false;
|
||||
|
||||
uint32_t negativeCount = 0;
|
||||
@@ -107,9 +107,9 @@ static bool award_is_deserved_most_untidy(int32_t activeAwardTypes)
|
||||
/** More than 1/64 of the total guests must be thinking tidy thoughts and less than 6 guests thinking untidy thoughts. */
|
||||
static bool award_is_deserved_most_tidy(int32_t activeAwardTypes)
|
||||
{
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_MOST_UNTIDY))
|
||||
if (activeAwardTypes & EnumToFlag(ParkAward::MostUntidy))
|
||||
return false;
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_MOST_DISAPPOINTING))
|
||||
if (activeAwardTypes & EnumToFlag(ParkAward::MostDisappointing))
|
||||
return false;
|
||||
|
||||
uint32_t positiveCount = 0;
|
||||
@@ -166,10 +166,10 @@ static bool award_is_deserved_best_rollercoasters([[maybe_unused]] int32_t activ
|
||||
/** Entrance fee is 0.10 less than half of the total ride value. */
|
||||
static bool award_is_deserved_best_value(int32_t activeAwardTypes)
|
||||
{
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_WORST_VALUE))
|
||||
if (activeAwardTypes & EnumToFlag(ParkAward::WorstValue))
|
||||
return false;
|
||||
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_MOST_DISAPPOINTING))
|
||||
if (activeAwardTypes & EnumToFlag(ParkAward::MostDisappointing))
|
||||
return false;
|
||||
|
||||
if ((gParkFlags & PARK_FLAGS_NO_MONEY) || !park_entry_price_unlocked())
|
||||
@@ -187,9 +187,9 @@ static bool award_is_deserved_best_value(int32_t activeAwardTypes)
|
||||
/** More than 1/128 of the total guests must be thinking scenic thoughts and fewer than 16 untidy thoughts. */
|
||||
static bool award_is_deserved_most_beautiful(int32_t activeAwardTypes)
|
||||
{
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_MOST_UNTIDY))
|
||||
if (activeAwardTypes & EnumToFlag(ParkAward::MostUntidy))
|
||||
return false;
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_MOST_DISAPPOINTING))
|
||||
if (activeAwardTypes & EnumToFlag(ParkAward::MostDisappointing))
|
||||
return false;
|
||||
|
||||
uint32_t positiveCount = 0;
|
||||
@@ -220,7 +220,7 @@ static bool award_is_deserved_most_beautiful(int32_t activeAwardTypes)
|
||||
/** Entrance fee is more than total ride value. */
|
||||
static bool award_is_deserved_worst_value(int32_t activeAwardTypes)
|
||||
{
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_BEST_VALUE))
|
||||
if (activeAwardTypes & EnumToFlag(ParkAward::BestValue))
|
||||
return false;
|
||||
if (gParkFlags & PARK_FLAGS_NO_MONEY)
|
||||
return false;
|
||||
@@ -263,7 +263,7 @@ static bool award_is_deserved_safest([[maybe_unused]] int32_t activeAwardTypes)
|
||||
/** All staff types, at least 20 staff, one staff per 32 peeps. */
|
||||
static bool award_is_deserved_best_staff(int32_t activeAwardTypes)
|
||||
{
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_MOST_UNTIDY))
|
||||
if (activeAwardTypes & EnumToFlag(ParkAward::MostUntidy))
|
||||
return false;
|
||||
|
||||
auto peepCount = 0;
|
||||
@@ -288,7 +288,7 @@ static bool award_is_deserved_best_staff(int32_t activeAwardTypes)
|
||||
/** At least 7 shops, 4 unique, one shop per 128 guests and no more than 12 hungry guests. */
|
||||
static bool award_is_deserved_best_food(int32_t activeAwardTypes)
|
||||
{
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_WORST_FOOD))
|
||||
if (activeAwardTypes & EnumToFlag(ParkAward::WorstFood))
|
||||
return false;
|
||||
|
||||
uint32_t shops = 0;
|
||||
@@ -332,7 +332,7 @@ static bool award_is_deserved_best_food(int32_t activeAwardTypes)
|
||||
/** No more than 2 unique shops, less than one shop per 256 guests and more than 15 hungry guests. */
|
||||
static bool award_is_deserved_worst_food(int32_t activeAwardTypes)
|
||||
{
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_BEST_FOOD))
|
||||
if (activeAwardTypes & EnumToFlag(ParkAward::BestFood))
|
||||
return false;
|
||||
|
||||
uint32_t shops = 0;
|
||||
@@ -406,7 +406,7 @@ static bool award_is_deserved_best_restrooms([[maybe_unused]] int32_t activeAwar
|
||||
/** More than half of the rides have satisfaction <= 6 and park rating <= 650. */
|
||||
static bool award_is_deserved_most_disappointing(int32_t activeAwardTypes)
|
||||
{
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_BEST_VALUE))
|
||||
if (activeAwardTypes & EnumToFlag(ParkAward::BestValue))
|
||||
return false;
|
||||
if (gParkRating > 650)
|
||||
return false;
|
||||
@@ -461,7 +461,7 @@ static bool award_is_deserved_best_water_rides([[maybe_unused]] int32_t activeAw
|
||||
/** At least 6 custom designed rides. */
|
||||
static bool award_is_deserved_best_custom_designed_rides(int32_t activeAwardTypes)
|
||||
{
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_MOST_DISAPPOINTING))
|
||||
if (activeAwardTypes & EnumToFlag(ParkAward::MostDisappointing))
|
||||
return false;
|
||||
|
||||
auto customDesignedRides = 0;
|
||||
@@ -488,7 +488,7 @@ static bool award_is_deserved_most_dazzling_ride_colours(int32_t activeAwardType
|
||||
static constexpr const colour_t dazzling_ride_colours[] = { COLOUR_BRIGHT_PURPLE, COLOUR_BRIGHT_GREEN, COLOUR_LIGHT_ORANGE,
|
||||
COLOUR_BRIGHT_PINK };
|
||||
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_MOST_DISAPPOINTING))
|
||||
if (activeAwardTypes & EnumToFlag(ParkAward::MostDisappointing))
|
||||
return false;
|
||||
|
||||
auto countedRides = 0;
|
||||
|
||||
@@ -17,26 +17,26 @@ struct Award
|
||||
uint16_t Type;
|
||||
};
|
||||
|
||||
enum PARK_AWARD
|
||||
enum class ParkAward : uint8_t
|
||||
{
|
||||
PARK_AWARD_MOST_UNTIDY,
|
||||
PARK_AWARD_MOST_TIDY,
|
||||
PARK_AWARD_BEST_ROLLERCOASTERS,
|
||||
PARK_AWARD_BEST_VALUE,
|
||||
PARK_AWARD_MOST_BEAUTIFUL,
|
||||
PARK_AWARD_WORST_VALUE,
|
||||
PARK_AWARD_SAFEST,
|
||||
PARK_AWARD_BEST_STAFF,
|
||||
PARK_AWARD_BEST_FOOD,
|
||||
PARK_AWARD_WORST_FOOD,
|
||||
PARK_AWARD_BEST_RESTROOMS,
|
||||
PARK_AWARD_MOST_DISAPPOINTING,
|
||||
PARK_AWARD_BEST_WATER_RIDES,
|
||||
PARK_AWARD_BEST_CUSTOM_DESIGNED_RIDES,
|
||||
PARK_AWARD_MOST_DAZZLING_RIDE_COLOURS,
|
||||
PARK_AWARD_MOST_CONFUSING_LAYOUT,
|
||||
PARK_AWARD_BEST_GENTLE_RIDES,
|
||||
PARK_AWARD_COUNT
|
||||
MostUntidy,
|
||||
MostTidy,
|
||||
BestRollerCoasters,
|
||||
BestValue,
|
||||
MostBeautiful,
|
||||
WorstValue,
|
||||
Safest,
|
||||
BestStaff,
|
||||
BestFood,
|
||||
WorstFood,
|
||||
BestRestrooms,
|
||||
MostDisappointing,
|
||||
BestWaterRides,
|
||||
BestCustomDesignedRides,
|
||||
MostDazzlingRideColours,
|
||||
MostConfusingLayout,
|
||||
BestGentleRides,
|
||||
Count
|
||||
};
|
||||
|
||||
#define MAX_AWARDS 4
|
||||
|
||||
Reference in New Issue
Block a user