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

Close #12437, refactor: RIDE_MODE_* to strong enums (#12833)

* partial refactor: RIDE_MODE_* to strong enums

* Close #12437, refactor: RIDE_MODE_* to strong enums

* chore: code formatting

* refactor: RideMode, change enum names to CamelCase

and resolve casting order.

* chore: refactor due to code formatting

* Close #12437, refactor: RIDE_MODE_* to strong enums

Resolved comments

* chore: Formatting correction.

* Use EnumsToFlags constexpr

* refactor: resolved comments

added newline at the end of file

* refactor: Change case stack to default in Switch

Co-authored-by: duncanspumpkin <duncans_pumpkin@hotmail.co.uk>
This commit is contained in:
Łukasz Pękalski
2020-09-28 15:09:59 +02:00
committed by GitHub
parent 8f5ee758ee
commit 065da23b3b
107 changed files with 510 additions and 470 deletions

View File

@@ -156,7 +156,7 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
if (argv.size() > 1 && argv[1] == "mode")
{
console.WriteFormatLine("Ride modes are specified using integer IDs as given below:");
for (int32_t i = 0; i < RIDE_MODE_COUNT; i++)
for (int32_t i = 0; i < static_cast<uint8_t>(RideMode::Count); i++)
{
char mode_name[128] = { 0 };
rct_string_id mode_string_id = RideModeNames[i];
@@ -214,7 +214,7 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
else
{
auto ride = get_ride(ride_index);
if (mode <= 0 || mode > (RIDE_MODE_COUNT - 1))
if (mode >= static_cast<uint8_t>(RideMode::Count))
{
console.WriteFormatLine("Invalid ride mode.");
}
@@ -224,7 +224,7 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
}
else
{
ride->mode = static_cast<uint8_t>(mode & 0xFF);
ride->mode = static_cast<RideMode>(mode & 0xFF);
invalidate_test_results(ride);
}
}