Change static casts to EnumValue

This commit is contained in:
ζeh Matt 2021-09-08 17:07:41 +03:00
parent d21ccc103b
commit 516232e0a7
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
21 changed files with 59 additions and 59 deletions

View File

@ -396,7 +396,7 @@ public:
case INTENT_ACTION_INVALIDATE_VEHICLE_WINDOW: case INTENT_ACTION_INVALIDATE_VEHICLE_WINDOW:
{ {
auto vehicle = static_cast<Vehicle*>(intent.GetPointerExtra(INTENT_EXTRA_VEHICLE)); auto vehicle = static_cast<Vehicle*>(intent.GetPointerExtra(INTENT_EXTRA_VEHICLE));
auto w = window_find_by_number(WC_RIDE, static_cast<int32_t>(vehicle->ride)); auto w = window_find_by_number(WC_RIDE, EnumValue(vehicle->ride));
if (w == nullptr) if (w == nullptr)
return; return;

View File

@ -972,7 +972,7 @@ static void window_editor_objective_options_rides_update(rct_window* w)
{ {
if (ride.IsRide()) if (ride.IsRide())
{ {
w->list_item_positions[numItems] = static_cast<uint32_t>(ride.id); w->list_item_positions[numItems] = EnumValue(ride.id);
numItems++; numItems++;
} }
} }

View File

@ -1456,7 +1456,7 @@ void window_guest_rides_update(rct_window* w)
{ {
if (ride.IsRide() && guest->HasRidden(&ride)) if (ride.IsRide() && guest->HasRidden(&ride))
{ {
w->list_item_positions[curr_list_position] = static_cast<uint32_t>(ride.id); w->list_item_positions[curr_list_position] = EnumValue(ride.id);
curr_list_position++; curr_list_position++;
} }
} }

View File

@ -169,7 +169,7 @@ static void window_maze_construction_close(rct_window* w)
else else
{ {
auto intent = Intent(WC_RIDE); auto intent = Intent(WC_RIDE);
intent.putExtra(INTENT_EXTRA_RIDE_ID, static_cast<int32_t>(ride->id)); intent.putExtra(INTENT_EXTRA_RIDE_ID, EnumValue(ride->id));
context_open_intent(&intent); context_open_intent(&intent);
} }
} }

View File

@ -509,7 +509,7 @@ static void close_ride_window_for_construction(rct_windownumber number)
rct_window* window_ride_construction_open() rct_window* window_ride_construction_open()
{ {
ride_id_t rideIndex = _currentRideIndex; ride_id_t rideIndex = _currentRideIndex;
close_ride_window_for_construction(static_cast<int32_t>(rideIndex)); close_ride_window_for_construction(EnumValue(rideIndex));
auto ride = get_ride(rideIndex); auto ride = get_ride(rideIndex);
if (ride == nullptr) if (ride == nullptr)
@ -543,7 +543,7 @@ rct_window* window_ride_construction_open()
w->colours[1] = COLOUR_DARK_BROWN; w->colours[1] = COLOUR_DARK_BROWN;
w->colours[2] = COLOUR_DARK_BROWN; w->colours[2] = COLOUR_DARK_BROWN;
w->number = static_cast<int32_t>(rideIndex); w->rideId = rideIndex;
window_push_others_right(w); window_push_others_right(w);
show_gridlines(); show_gridlines();
@ -620,7 +620,7 @@ static void window_ride_construction_close(rct_window* w)
ride->SetToDefaultInspectionInterval(); ride->SetToDefaultInspectionInterval();
auto intent = Intent(WC_RIDE); auto intent = Intent(WC_RIDE);
intent.putExtra(INTENT_EXTRA_RIDE_ID, static_cast<int32_t>(ride->id)); intent.putExtra(INTENT_EXTRA_RIDE_ID, EnumValue(ride->id));
context_open_intent(&intent); context_open_intent(&intent);
} }
else else

View File

@ -443,7 +443,7 @@ static void window_ride_list_scrollmousedown(rct_window* w, int32_t scrollIndex,
else else
{ {
auto intent = Intent(WC_RIDE); auto intent = Intent(WC_RIDE);
intent.putExtra(INTENT_EXTRA_RIDE_ID, static_cast<int32_t>(rideIndex)); intent.putExtra(INTENT_EXTRA_RIDE_ID, EnumValue(rideIndex));
context_open_intent(&intent); context_open_intent(&intent);
} }
} }

View File

@ -274,7 +274,7 @@ GameActions::Result::Ptr RideDemolishAction::RefurbishRide(Ride* ride) const
res->Position = { location, tile_element_height(location) }; res->Position = { location, tile_element_height(location) };
} }
window_close_by_number(WC_DEMOLISH_RIDE_PROMPT, static_cast<int32_t>(_rideIndex)); window_close_by_number(WC_DEMOLISH_RIDE_PROMPT, EnumValue(_rideIndex));
return res; return res;
} }

View File

@ -54,7 +54,7 @@ GameActions::Result::Ptr RideEntranceExitPlaceAction::Query() const
auto ride = get_ride(_rideIndex); auto ride = get_ride(_rideIndex);
if (ride == nullptr) if (ride == nullptr)
{ {
log_warning("Invalid game command for ride %d", static_cast<int32_t>(_rideIndex)); log_warning("Invalid game command for ride %d", EnumValue(_rideIndex));
return MakeResult(GameActions::Status::InvalidParameters, errorTitle); return MakeResult(GameActions::Status::InvalidParameters, errorTitle);
} }
@ -132,7 +132,7 @@ GameActions::Result::Ptr RideEntranceExitPlaceAction::Execute() const
auto ride = get_ride(_rideIndex); auto ride = get_ride(_rideIndex);
if (ride == nullptr) if (ride == nullptr)
{ {
log_warning("Invalid game command for ride %d", static_cast<int32_t>(_rideIndex)); log_warning("Invalid game command for ride %d", EnumValue(_rideIndex));
return MakeResult(GameActions::Status::InvalidParameters, errorTitle); return MakeResult(GameActions::Status::InvalidParameters, errorTitle);
} }

View File

@ -74,7 +74,7 @@ GameActions::Result::Ptr RideEntranceExitRemoveAction::Query() const
auto ride = get_ride(_rideIndex); auto ride = get_ride(_rideIndex);
if (ride == nullptr) if (ride == nullptr)
{ {
log_warning("Invalid ride id %d for entrance/exit removal", static_cast<int32_t>(_rideIndex)); log_warning("Invalid ride id %d for entrance/exit removal", EnumValue(_rideIndex));
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE); return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
} }
@ -99,8 +99,8 @@ GameActions::Result::Ptr RideEntranceExitRemoveAction::Query() const
if (entranceElement == nullptr) if (entranceElement == nullptr)
{ {
log_warning( log_warning(
"Track Element not found. x = %d, y = %d, ride = %d, station = %d", _loc.x, _loc.y, "Track Element not found. x = %d, y = %d, ride = %d, station = %d", _loc.x, _loc.y, EnumValue(_rideIndex),
static_cast<int32_t>(_rideIndex), _stationNum); _stationNum);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE); return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
} }
@ -112,7 +112,7 @@ GameActions::Result::Ptr RideEntranceExitRemoveAction::Execute() const
auto ride = get_ride(_rideIndex); auto ride = get_ride(_rideIndex);
if (ride == nullptr) if (ride == nullptr)
{ {
log_warning("Invalid ride id %d for entrance/exit removal", static_cast<int32_t>(_rideIndex)); log_warning("Invalid ride id %d for entrance/exit removal", EnumValue(_rideIndex));
return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE); return std::make_unique<GameActions::Result>(GameActions::Status::InvalidParameters, STR_NONE);
} }
@ -130,8 +130,8 @@ GameActions::Result::Ptr RideEntranceExitRemoveAction::Execute() const
if (entranceElement == nullptr) if (entranceElement == nullptr)
{ {
log_warning( log_warning(
"Track Element not found. x = %d, y = %d, ride = %d, station = %d", _loc.x, _loc.y, "Track Element not found. x = %d, y = %d, ride = %d, station = %d", _loc.x, _loc.y, EnumValue(_rideIndex),
static_cast<int32_t>(_rideIndex), _stationNum); _stationNum);
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE); return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
} }

View File

@ -139,7 +139,7 @@ GameActions::Result::Ptr RideSetAppearanceAction::Execute() const
gfx_invalidate_screen(); gfx_invalidate_screen();
break; break;
} }
window_invalidate_by_number(WC_RIDE, static_cast<int32_t>(_rideIndex)); window_invalidate_by_number(WC_RIDE, EnumValue(_rideIndex));
auto res = std::make_unique<GameActions::Result>(); auto res = std::make_unique<GameActions::Result>();
if (!ride->overall_view.IsNull()) if (!ride->overall_view.IsNull())

View File

@ -180,7 +180,7 @@ void RideSetPriceAction::RideSetCommonPrice(ShopItem shopItem) const
} }
if (invalidate) if (invalidate)
{ {
window_invalidate_by_number(WC_RIDE, static_cast<int32_t>(ride.id)); window_invalidate_by_number(WC_RIDE, EnumValue(ride.id));
} }
} }
} }

View File

@ -45,7 +45,7 @@ GameActions::Result::Ptr RideSetSettingAction::Query() const
auto ride = get_ride(_rideIndex); auto ride = get_ride(_rideIndex);
if (ride == nullptr) if (ride == nullptr)
{ {
log_warning("Invalid ride: #%d.", static_cast<int32_t>(_rideIndex)); log_warning("Invalid ride: #%d.", EnumValue(_rideIndex));
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE); return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
} }
@ -153,7 +153,7 @@ GameActions::Result::Ptr RideSetSettingAction::Execute() const
auto ride = get_ride(_rideIndex); auto ride = get_ride(_rideIndex);
if (ride == nullptr) if (ride == nullptr)
{ {
log_warning("Invalid ride: #%d.", static_cast<int32_t>(_rideIndex)); log_warning("Invalid ride: #%d.", EnumValue(_rideIndex));
return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE); return MakeResult(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE);
} }
@ -233,7 +233,7 @@ GameActions::Result::Ptr RideSetSettingAction::Execute() const
auto location = ride->overall_view.ToTileCentre(); auto location = ride->overall_view.ToTileCentre();
res->Position = { location, tile_element_height(location) }; res->Position = { location, tile_element_height(location) };
} }
window_invalidate_by_number(WC_RIDE, static_cast<int32_t>(_rideIndex)); window_invalidate_by_number(WC_RIDE, EnumValue(_rideIndex));
return res; return res;
} }

View File

@ -59,7 +59,7 @@ GameActions::Result::Ptr RideSetStatusAction::Query() const
auto ride = get_ride(_rideIndex); auto ride = get_ride(_rideIndex);
if (ride == nullptr) if (ride == nullptr)
{ {
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex)); log_warning("Invalid game command for ride %u", EnumValue(_rideIndex));
res->Error = GameActions::Status::InvalidParameters; res->Error = GameActions::Status::InvalidParameters;
res->ErrorTitle = STR_RIDE_DESCRIPTION_UNKNOWN; res->ErrorTitle = STR_RIDE_DESCRIPTION_UNKNOWN;
res->ErrorMessage = STR_NONE; res->ErrorMessage = STR_NONE;
@ -68,7 +68,7 @@ GameActions::Result::Ptr RideSetStatusAction::Query() const
if (_status >= RideStatus::Count) if (_status >= RideStatus::Count)
{ {
log_warning("Invalid ride status %u for ride %u", uint32_t(_status), uint32_t(_rideIndex)); log_warning("Invalid ride status %u for ride %u", EnumValue(_status), EnumValue(_rideIndex));
res->Error = GameActions::Status::InvalidParameters; res->Error = GameActions::Status::InvalidParameters;
res->ErrorTitle = STR_RIDE_DESCRIPTION_UNKNOWN; res->ErrorTitle = STR_RIDE_DESCRIPTION_UNKNOWN;
res->ErrorMessage = STR_NONE; res->ErrorMessage = STR_NONE;
@ -154,7 +154,7 @@ GameActions::Result::Ptr RideSetStatusAction::Execute() const
ride->lifecycle_flags &= ~RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING; ride->lifecycle_flags &= ~RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING;
ride->race_winner = SPRITE_INDEX_NULL; ride->race_winner = SPRITE_INDEX_NULL;
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST; ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
window_invalidate_by_number(WC_RIDE, static_cast<int32_t>(_rideIndex)); window_invalidate_by_number(WC_RIDE, EnumValue(_rideIndex));
break; break;
case RideStatus::Simulating: case RideStatus::Simulating:
{ {
@ -176,7 +176,7 @@ GameActions::Result::Ptr RideSetStatusAction::Execute() const
ride->last_issue_time = 0; ride->last_issue_time = 0;
ride->GetMeasurement(); ride->GetMeasurement();
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST; ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
window_invalidate_by_number(WC_RIDE, static_cast<int32_t>(_rideIndex)); window_invalidate_by_number(WC_RIDE, EnumValue(_rideIndex));
break; break;
} }
case RideStatus::Testing: case RideStatus::Testing:
@ -195,7 +195,7 @@ GameActions::Result::Ptr RideSetStatusAction::Execute() const
// Fix #3183: Make sure we close the construction window so the ride finishes any editing code before opening // Fix #3183: Make sure we close the construction window so the ride finishes any editing code before opening
// otherwise vehicles get added to the ride incorrectly (such as to a ghost station) // otherwise vehicles get added to the ride incorrectly (such as to a ghost station)
rct_window* constructionWindow = window_find_by_number(WC_RIDE_CONSTRUCTION, static_cast<int32_t>(_rideIndex)); rct_window* constructionWindow = window_find_by_number(WC_RIDE_CONSTRUCTION, EnumValue(_rideIndex));
if (constructionWindow != nullptr) if (constructionWindow != nullptr)
{ {
window_close(constructionWindow); window_close(constructionWindow);
@ -223,7 +223,7 @@ GameActions::Result::Ptr RideSetStatusAction::Execute() const
ride->last_issue_time = 0; ride->last_issue_time = 0;
ride->GetMeasurement(); ride->GetMeasurement();
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST; ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
window_invalidate_by_number(WC_RIDE, static_cast<int32_t>(_rideIndex)); window_invalidate_by_number(WC_RIDE, EnumValue(_rideIndex));
break; break;
} }
default: default:

View File

@ -199,7 +199,7 @@ GameActions::Result::Ptr RideSetVehicleAction::Execute() const
} }
auto intent = Intent(INTENT_ACTION_RIDE_PAINT_RESET_VEHICLE); auto intent = Intent(INTENT_ACTION_RIDE_PAINT_RESET_VEHICLE);
intent.putExtra(INTENT_EXTRA_RIDE_ID, static_cast<int32_t>(_rideIndex)); intent.putExtra(INTENT_EXTRA_RIDE_ID, EnumValue(_rideIndex));
context_broadcast_intent(&intent); context_broadcast_intent(&intent);
gfx_invalidate_screen(); gfx_invalidate_screen();

View File

@ -85,13 +85,13 @@ GameActions::Result::Ptr TrackPlaceAction::Query() const
auto ride = get_ride(_rideIndex); auto ride = get_ride(_rideIndex);
if (ride == nullptr) if (ride == nullptr)
{ {
log_warning("Invalid ride for track placement, rideIndex = %d", static_cast<int32_t>(_rideIndex)); log_warning("Invalid ride for track placement, rideIndex = %d", EnumValue(_rideIndex));
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::InvalidParameters, STR_NONE); return std::make_unique<TrackPlaceActionResult>(GameActions::Status::InvalidParameters, STR_NONE);
} }
rct_ride_entry* rideEntry = get_ride_entry(ride->subtype); rct_ride_entry* rideEntry = get_ride_entry(ride->subtype);
if (rideEntry == nullptr) if (rideEntry == nullptr)
{ {
log_warning("Invalid ride subtype for track placement, rideIndex = %d", static_cast<int32_t>(_rideIndex)); log_warning("Invalid ride subtype for track placement, rideIndex = %d", EnumValue(_rideIndex));
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::InvalidParameters, STR_NONE); return std::make_unique<TrackPlaceActionResult>(GameActions::Status::InvalidParameters, STR_NONE);
} }
@ -379,14 +379,14 @@ GameActions::Result::Ptr TrackPlaceAction::Execute() const
auto ride = get_ride(_rideIndex); auto ride = get_ride(_rideIndex);
if (ride == nullptr) if (ride == nullptr)
{ {
log_warning("Invalid ride for track placement, rideIndex = %d", static_cast<int32_t>(_rideIndex)); log_warning("Invalid ride for track placement, rideIndex = %d", EnumValue(_rideIndex));
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::InvalidParameters); return std::make_unique<TrackPlaceActionResult>(GameActions::Status::InvalidParameters);
} }
rct_ride_entry* rideEntry = get_ride_entry(ride->subtype); rct_ride_entry* rideEntry = get_ride_entry(ride->subtype);
if (rideEntry == nullptr) if (rideEntry == nullptr)
{ {
log_warning("Invalid ride subtype for track placement, rideIndex = %d", static_cast<int32_t>(_rideIndex)); log_warning("Invalid ride subtype for track placement, rideIndex = %d", EnumValue(_rideIndex));
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::InvalidParameters); return std::make_unique<TrackPlaceActionResult>(GameActions::Status::InvalidParameters);
} }
@ -550,7 +550,7 @@ GameActions::Result::Ptr TrackPlaceAction::Execute() const
auto* trackElement = TileElementInsert<TrackElement>(mapLoc, quarterTile.GetBaseQuarterOccupied()); auto* trackElement = TileElementInsert<TrackElement>(mapLoc, quarterTile.GetBaseQuarterOccupied());
if (trackElement == nullptr) if (trackElement == nullptr)
{ {
log_warning("Cannot create track element for ride = %d", static_cast<int32_t>(_rideIndex)); log_warning("Cannot create track element for ride = %d", EnumValue(_rideIndex));
return std::make_unique<TrackPlaceActionResult>(GameActions::Status::NoFreeElements); return std::make_unique<TrackPlaceActionResult>(GameActions::Status::NoFreeElements);
} }

View File

@ -959,7 +959,7 @@ void S6Exporter::ExportRideMeasurements()
auto rideId = src->id; auto rideId = src->id;
dst.ride_index = static_cast<uint8_t>(rideId); dst.ride_index = static_cast<uint8_t>(rideId);
_s6.rides[static_cast<uint8_t>(rideId)].measurement_index = i; _s6.rides[dst.ride_index].measurement_index = i;
i++; i++;
} }
} }

View File

@ -1505,7 +1505,7 @@ void ride_breakdown_add_news_item(Ride* ride)
{ {
Formatter ft; Formatter ft;
ride->FormatNameTo(ft); ride->FormatNameTo(ft);
News::AddItemToQueue(News::ItemType::Ride, STR_RIDE_IS_BROKEN_DOWN, static_cast<uint32_t>(ride->id), ft); News::AddItemToQueue(News::ItemType::Ride, STR_RIDE_IS_BROKEN_DOWN, EnumValue(ride->id), ft);
} }
} }
@ -1532,7 +1532,7 @@ static void ride_breakdown_status_update(Ride* ride)
{ {
Formatter ft; Formatter ft;
ride->FormatNameTo(ft); ride->FormatNameTo(ft);
News::AddItemToQueue(News::ItemType::Ride, STR_RIDE_IS_STILL_NOT_FIXED, static_cast<uint32_t>(ride->id), ft); News::AddItemToQueue(News::ItemType::Ride, STR_RIDE_IS_STILL_NOT_FIXED, EnumValue(ride->id), ft);
} }
} }
} }
@ -2183,7 +2183,7 @@ static void ride_entrance_exit_connected(Ride* ride)
ride->FormatNameTo(ft); ride->FormatNameTo(ft);
if (gConfigNotifications.ride_warnings) if (gConfigNotifications.ride_warnings)
{ {
News::AddItemToQueue(News::ItemType::Ride, STR_ENTRANCE_NOT_CONNECTED, static_cast<uint32_t>(ride->id), ft); News::AddItemToQueue(News::ItemType::Ride, STR_ENTRANCE_NOT_CONNECTED, EnumValue(ride->id), ft);
} }
ride->connected_message_throttle = 3; ride->connected_message_throttle = 3;
} }
@ -2195,7 +2195,7 @@ static void ride_entrance_exit_connected(Ride* ride)
ride->FormatNameTo(ft); ride->FormatNameTo(ft);
if (gConfigNotifications.ride_warnings) if (gConfigNotifications.ride_warnings)
{ {
News::AddItemToQueue(News::ItemType::Ride, STR_EXIT_NOT_CONNECTED, static_cast<uint32_t>(ride->id), ft); News::AddItemToQueue(News::ItemType::Ride, STR_EXIT_NOT_CONNECTED, EnumValue(ride->id), ft);
} }
ride->connected_message_throttle = 3; ride->connected_message_throttle = 3;
} }
@ -2264,7 +2264,7 @@ static void ride_shop_connected(Ride* ride)
{ {
Formatter ft; Formatter ft;
ride->FormatNameTo(ft); ride->FormatNameTo(ft);
News::AddItemToQueue(News::ItemType::Ride, STR_ENTRANCE_NOT_CONNECTED, static_cast<uint32_t>(ride->id), ft); News::AddItemToQueue(News::ItemType::Ride, STR_ENTRANCE_NOT_CONNECTED, EnumValue(ride->id), ft);
} }
ride->connected_message_throttle = 3; ride->connected_message_throttle = 3;
@ -3797,13 +3797,13 @@ bool Ride::Test(RideStatus newStatus, bool isApplying)
if (type == RIDE_TYPE_NULL) if (type == RIDE_TYPE_NULL)
{ {
log_warning("Invalid ride type for ride %u", static_cast<uint32_t>(id)); log_warning("Invalid ride type for ride %u", EnumValue(id));
return false; return false;
} }
if (newStatus != RideStatus::Simulating) if (newStatus != RideStatus::Simulating)
{ {
window_close_by_number(WC_RIDE_CONSTRUCTION, static_cast<uint32_t>(id)); window_close_by_number(WC_RIDE_CONSTRUCTION, EnumValue(id));
} }
StationIndex stationIndex = ride_mode_check_station_present(this); StationIndex stationIndex = ride_mode_check_station_present(this);
@ -3930,10 +3930,10 @@ bool Ride::Open(bool isApplying)
// to set the track to its final state and clean up ghosts. // to set the track to its final state and clean up ghosts.
// We can't just call close as it would cause a stack overflow during shop creation // We can't just call close as it would cause a stack overflow during shop creation
// with auto open on. // with auto open on.
if (WC_RIDE_CONSTRUCTION == gCurrentToolWidget.window_classification if (WC_RIDE_CONSTRUCTION == gCurrentToolWidget.window_classification && EnumValue(id) == gCurrentToolWidget.window_number
&& static_cast<uint32_t>(id) == gCurrentToolWidget.window_number && (input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) && (input_test_flag(INPUT_FLAG_TOOL_ACTIVE)))
{ {
window_close_by_number(WC_RIDE_CONSTRUCTION, static_cast<uint32_t>(id)); window_close_by_number(WC_RIDE_CONSTRUCTION, EnumValue(id));
} }
StationIndex stationIndex = ride_mode_check_station_present(this); StationIndex stationIndex = ride_mode_check_station_present(this);
@ -5089,7 +5089,7 @@ void Ride::UpdateMaxVehicles()
{ {
num_cars_per_train = numCarsPerTrain; num_cars_per_train = numCarsPerTrain;
num_vehicles = numVehicles; num_vehicles = numVehicles;
window_invalidate_by_number(WC_RIDE, static_cast<uint32_t>(id)); window_invalidate_by_number(WC_RIDE, EnumValue(id));
} }
} }
@ -5158,7 +5158,7 @@ void Ride::Crash(uint8_t vehicleIndex)
{ {
Formatter ft; Formatter ft;
FormatNameTo(ft); FormatNameTo(ft);
News::AddItemToQueue(News::ItemType::Ride, STR_RIDE_HAS_CRASHED, static_cast<uint32_t>(id), ft); News::AddItemToQueue(News::ItemType::Ride, STR_RIDE_HAS_CRASHED, EnumValue(id), ft);
} }
} }

View File

@ -122,7 +122,7 @@ static rct_window* ride_create_or_find_construction_window(ride_id_t rideIndex)
{ {
auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
auto intent = Intent(INTENT_ACTION_RIDE_CONSTRUCTION_FOCUS); auto intent = Intent(INTENT_ACTION_RIDE_CONSTRUCTION_FOCUS);
intent.putExtra(INTENT_EXTRA_RIDE_ID, static_cast<int32_t>(rideIndex)); intent.putExtra(INTENT_EXTRA_RIDE_ID, EnumValue(rideIndex));
windowManager->BroadcastIntent(intent); windowManager->BroadcastIntent(intent);
return window_find_by_class(WC_RIDE_CONSTRUCTION); return window_find_by_class(WC_RIDE_CONSTRUCTION);
} }
@ -239,7 +239,7 @@ void ride_clear_for_construction(Ride* ride)
ride->RemoveVehicles(); ride->RemoveVehicles();
ride_clear_blocked_tiles(ride); ride_clear_blocked_tiles(ride);
auto w = window_find_by_number(WC_RIDE, static_cast<int32_t>(ride->id)); auto w = window_find_by_number(WC_RIDE, EnumValue(ride->id));
if (w != nullptr) if (w != nullptr)
window_event_resize_call(w); window_event_resize_call(w);
} }

View File

@ -159,7 +159,7 @@ static void ride_ratings_update_state_0(RideRatingUpdateState& state)
{ {
ride_id_t currentRide = state.CurrentRide; ride_id_t currentRide = state.CurrentRide;
currentRide = static_cast<ride_id_t>(static_cast<uint32_t>(currentRide) + 1); currentRide = static_cast<ride_id_t>(EnumValue(currentRide) + 1);
if (currentRide >= static_cast<ride_id_t>(MAX_RIDES)) if (currentRide >= static_cast<ride_id_t>(MAX_RIDES))
{ {
currentRide = {}; currentRide = {};
@ -285,7 +285,7 @@ static void ride_ratings_update_state_3(RideRatingUpdateState& state)
ride_ratings_calculate(state, ride); ride_ratings_calculate(state, ride);
ride_ratings_calculate_value(ride); ride_ratings_calculate_value(ride);
window_invalidate_by_number(WC_RIDE, static_cast<int32_t>(state.CurrentRide)); window_invalidate_by_number(WC_RIDE, EnumValue(state.CurrentRide));
state.State = RIDE_RATINGS_STATE_FIND_NEXT_RIDE; state.State = RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
} }
@ -753,7 +753,7 @@ static void ride_ratings_calculate(RideRatingUpdateState& state, Ride* ride)
// Create event args object // Create event args object
auto obj = DukObject(ctx); auto obj = DukObject(ctx);
obj.Set("rideId", static_cast<int32_t>(ride->id)); obj.Set("rideId", EnumValue(ride->id));
obj.Set("excitement", originalExcitement); obj.Set("excitement", originalExcitement);
obj.Set("intensity", originalIntensity); obj.Set("intensity", originalIntensity);
obj.Set("nausea", originalNausea); obj.Set("nausea", originalNausea);

View File

@ -1600,7 +1600,7 @@ void Vehicle::UpdateMeasurements()
curRide->lifecycle_flags |= RIDE_LIFECYCLE_NO_RAW_STATS; curRide->lifecycle_flags |= RIDE_LIFECYCLE_NO_RAW_STATS;
curRide->lifecycle_flags &= ~RIDE_LIFECYCLE_TEST_IN_PROGRESS; curRide->lifecycle_flags &= ~RIDE_LIFECYCLE_TEST_IN_PROGRESS;
ClearUpdateFlag(VEHICLE_UPDATE_FLAG_TESTING); ClearUpdateFlag(VEHICLE_UPDATE_FLAG_TESTING);
window_invalidate_by_number(WC_RIDE, static_cast<int32_t>(ride)); window_invalidate_by_number(WC_RIDE, EnumValue(ride));
return; return;
} }
@ -3114,7 +3114,7 @@ static void test_finish(Ride& ride)
totalTime = std::max(totalTime, 1u); totalTime = std::max(totalTime, 1u);
ride.average_speed = ride.average_speed / totalTime; ride.average_speed = ride.average_speed / totalTime;
window_invalidate_by_number(WC_RIDE, static_cast<int32_t>(ride.id)); window_invalidate_by_number(WC_RIDE, EnumValue(ride.id));
} }
void Vehicle::UpdateTestFinish() void Vehicle::UpdateTestFinish()
@ -3164,7 +3164,7 @@ static void test_reset(Ride& ride, StationIndex curStation)
} }
ride.total_air_time = 0; ride.total_air_time = 0;
ride.current_test_station = curStation; ride.current_test_station = curStation;
window_invalidate_by_number(WC_RIDE, static_cast<int32_t>(ride.id)); window_invalidate_by_number(WC_RIDE, EnumValue(ride.id));
} }
void Vehicle::TestReset() void Vehicle::TestReset()
@ -3570,7 +3570,7 @@ void Vehicle::CheckIfMissing()
curRide->FormatNameTo(ft); curRide->FormatNameTo(ft);
ft.Add<rct_string_id>(GetRideComponentName(GetRideTypeDescriptor(curRide->type).NameConvention.station).singular); ft.Add<rct_string_id>(GetRideComponentName(GetRideTypeDescriptor(curRide->type).NameConvention.station).singular);
News::AddItemToQueue(News::ItemType::Ride, STR_NEWS_VEHICLE_HAS_STALLED, static_cast<uint32_t>(ride), ft); News::AddItemToQueue(News::ItemType::Ride, STR_NEWS_VEHICLE_HAS_STALLED, EnumValue(ride), ft);
} }
} }
@ -5305,8 +5305,8 @@ static void ride_train_crash(Ride* ride, uint16_t numFatalities)
{ {
ride->FormatNameTo(ft); ride->FormatNameTo(ft);
News::AddItemToQueue( News::AddItemToQueue(
News::ItemType::Ride, numFatalities == 1 ? STR_X_PERSON_DIED_ON_X : STR_X_PEOPLE_DIED_ON_X, News::ItemType::Ride, numFatalities == 1 ? STR_X_PERSON_DIED_ON_X : STR_X_PEOPLE_DIED_ON_X, EnumValue(ride->id),
static_cast<int32_t>(ride->id), ft); ft);
} }
if (gParkRatingCasualtyPenalty < 500) if (gParkRatingCasualtyPenalty < 500)

View File

@ -893,7 +893,7 @@ DukValue ScriptEngine::GameActionResultToDuk(const GameAction& action, const std
auto& rideCreateResult = static_cast<RideCreateGameActionResult&>(*result.get()); auto& rideCreateResult = static_cast<RideCreateGameActionResult&>(*result.get());
if (rideCreateResult.rideIndex != RIDE_ID_NULL) if (rideCreateResult.rideIndex != RIDE_ID_NULL)
{ {
obj.Set("ride", static_cast<int32_t>(rideCreateResult.rideIndex)); obj.Set("ride", EnumValue(rideCreateResult.rideIndex));
} }
} }
else if (action.GetType() == GameCommand::HireNewStaffMember) else if (action.GetType() == GameCommand::HireNewStaffMember)