Codechange: Make TownRatingCheckType an enum class. (#14652)

This commit is contained in:
Peter Nelson
2025-09-23 22:00:34 +01:00
committed by dP
parent 7baa01b394
commit f5ec253a8e
4 changed files with 11 additions and 11 deletions

View File

@@ -4388,8 +4388,8 @@ CommandCost CheckforTownRating(DoCommandFlags flags, Town *t, TownRatingCheckTyp
}
/* minimum rating needed to be allowed to remove stuff */
static const int needed_rating[][TOWN_RATING_CHECK_TYPE_COUNT] = {
/* ROAD_REMOVE, TUNNELBRIDGE_REMOVE */
static const int needed_rating[][to_underlying(TownRatingCheckType::End)] = {
/* RoadRemove, TunnelBridgeRemove */
{ RATING_ROAD_NEEDED_LENIENT, RATING_TUNNEL_BRIDGE_NEEDED_LENIENT}, // Lenient
{ RATING_ROAD_NEEDED_NEUTRAL, RATING_TUNNEL_BRIDGE_NEEDED_NEUTRAL}, // Neutral
{ RATING_ROAD_NEEDED_HOSTILE, RATING_TUNNEL_BRIDGE_NEEDED_HOSTILE}, // Hostile
@@ -4400,7 +4400,7 @@ CommandCost CheckforTownRating(DoCommandFlags flags, Town *t, TownRatingCheckTyp
* owned by a town no removal if rating is lower than ... depends now on
* difficulty setting. Minimum town rating selected by difficulty level
*/
int needed = needed_rating[_settings_game.difficulty.town_council_tolerance][type];
int needed = needed_rating[_settings_game.difficulty.town_council_tolerance][to_underlying(type)];
if (GetRating(t) < needed) {
return CommandCostWithParam(STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS, t->index);