diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index 9ba4e42fa4..c71a27ca0e 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -206,23 +206,23 @@ public: } } - WindowBase* OpenDetails(uint8_t type, int32_t id) override + WindowBase* openDetails(WindowDetail type, int32_t id) override { switch (type) { - case WD_BANNER: + case WindowDetail::banner: return BannerOpen(id); - case WD_NEW_CAMPAIGN: + case WindowDetail::newCampaign: return NewCampaignOpen(id); - case WD_DEMOLISH_RIDE: + case WindowDetail::demolishRide: return RideDemolishPromptOpen(*GetRide(RideId::FromUnderlying(id))); - case WD_REFURBISH_RIDE: + case WindowDetail::refurbishRide: return RideRefurbishPromptOpen(*GetRide(RideId::FromUnderlying(id))); - case WD_SIGN: + case WindowDetail::sign: return SignOpen(id); - case WD_SIGN_SMALL: + case WindowDetail::signSmall: return SignSmallOpen(id); - case WD_PLAYER: + case WindowDetail::player: return PlayerOpen(id); default: @@ -378,12 +378,12 @@ public: switch (intent->GetWindowDetail()) { - case WD_VEHICLE: + case WindowDetail::vehicle: return RideOpenVehicle(static_cast(intent->GetPointerExtra(INTENT_EXTRA_VEHICLE))); - case WD_TRACK: + case WindowDetail::track: return RideOpenTrack(static_cast(intent->GetPointerExtra(INTENT_EXTRA_TILE_ELEMENT))); - case WD_NULL: + case WindowDetail::null: // Intent does not hold an window detail break; diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index e1b2fbd1c8..a203a6c113 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -207,7 +207,7 @@ namespace OpenRCT2::Ui { case EntityType::Vehicle: { - auto intent = Intent(WD_VEHICLE); + auto intent = Intent(WindowDetail::vehicle); intent.PutExtra(INTENT_EXTRA_VEHICLE, entity); ContextOpenIntent(&intent); break; @@ -248,7 +248,7 @@ namespace OpenRCT2::Ui } case ViewportInteractionItem::ride: { - auto intent = Intent(WD_TRACK); + auto intent = Intent(WindowDetail::track); intent.PutExtra(INTENT_EXTRA_TILE_ELEMENT, info.Element); ContextOpenIntent(&intent); return true; @@ -611,7 +611,7 @@ namespace OpenRCT2::Ui ViewportInteractionRemoveLargeScenery(*info.Element->AsLargeScenery(), info.Loc); break; case ViewportInteractionItem::banner: - ContextOpenDetailWindow(WD_BANNER, info.Element->AsBanner()->GetIndex().ToUnderlying()); + ContextOpenDetailWindow(WindowDetail::banner, info.Element->AsBanner()->GetIndex().ToUnderlying()); break; } @@ -699,7 +699,7 @@ namespace OpenRCT2::Ui auto* wallEntry = wallElement.GetEntry(); if (wallEntry->scrolling_mode != kScrollingModeNone) { - ContextOpenDetailWindow(WD_SIGN_SMALL, wallElement.GetBannerIndex().ToUnderlying()); + ContextOpenDetailWindow(WindowDetail::signSmall, wallElement.GetBannerIndex().ToUnderlying()); } else { @@ -720,7 +720,7 @@ namespace OpenRCT2::Ui if (sceneryEntry->scrolling_mode != kScrollingModeNone) { auto bannerIndex = largeSceneryElement.GetBannerIndex(); - ContextOpenDetailWindow(WD_SIGN, bannerIndex.ToUnderlying()); + ContextOpenDetailWindow(WindowDetail::sign, bannerIndex.ToUnderlying()); } else { diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index d2666d4b04..a31ef49d80 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -669,7 +669,7 @@ namespace OpenRCT2::Ui::Windows { if (widgetIndex >= WIDX_CAMPAIGN_1 && widgetIndex <= WIDX_CAMPAIGN_6) { - ContextOpenDetailWindow(WD_NEW_CAMPAIGN, widgetIndex - WIDX_CAMPAIGN_1); + ContextOpenDetailWindow(WindowDetail::newCampaign, widgetIndex - WIDX_CAMPAIGN_1); } } diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index dbdd9adfc0..f3dca034b5 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -1645,7 +1645,7 @@ namespace OpenRCT2::Ui::Windows Rename(); break; case WIDX_DEMOLISH: - ContextOpenDetailWindow(WD_DEMOLISH_RIDE, number); + ContextOpenDetailWindow(WindowDetail::demolishRide, number); break; case WIDX_CLOSE_LIGHT: case WIDX_SIMULATE_LIGHT: @@ -3758,7 +3758,7 @@ namespace OpenRCT2::Ui::Windows LocateMechanic(); break; case WIDX_REFURBISH_RIDE: - ContextOpenDetailWindow(WD_REFURBISH_RIDE, number); + ContextOpenDetailWindow(WindowDetail::refurbishRide, number); break; } } diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 2e50ed64f8..38d9859f0a 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -3231,7 +3231,7 @@ namespace OpenRCT2::Ui::Windows { auto data = result->GetData(); Audio::Play3D(Audio::SoundId::PlaceItem, result->Position); - ContextOpenDetailWindow(WD_BANNER, data.bannerId.ToUnderlying()); + ContextOpenDetailWindow(WindowDetail::banner, data.bannerId.ToUnderlying()); } }); GameActions::Execute(&bannerPlaceAction, gameState); diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index af69bb700e..fad923de00 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -1716,10 +1716,10 @@ namespace OpenRCT2 return windowManager->OpenView(wc); } - WindowBase* ContextOpenDetailWindow(uint8_t type, int32_t id) + WindowBase* ContextOpenDetailWindow(WindowDetail type, int32_t id) { auto windowManager = Ui::GetWindowManager(); - return windowManager->OpenDetails(type, id); + return windowManager->openDetails(type, id); } WindowBase* ContextOpenIntent(Intent* intent) diff --git a/src/openrct2/Context.h b/src/openrct2/Context.h index 81283020ce..10d6b62ca9 100644 --- a/src/openrct2/Context.h +++ b/src/openrct2/Context.h @@ -27,6 +27,8 @@ struct TTFFontDescriptor; namespace OpenRCT2 { + enum class WindowDetail : uint8_t; + class AssetPackManager; class Formatter; class Intent; @@ -169,7 +171,7 @@ namespace OpenRCT2 bool ContextHasFocus(); void ContextSetCursorTrap(bool value); OpenRCT2::WindowBase* ContextOpenWindow(WindowClass wc); - OpenRCT2::WindowBase* ContextOpenDetailWindow(uint8_t type, int32_t id); + OpenRCT2::WindowBase* ContextOpenDetailWindow(WindowDetail type, int32_t id); OpenRCT2::WindowBase* ContextOpenWindowView(uint8_t view); OpenRCT2::WindowBase* ContextShowError( StringId title, StringId message, const class OpenRCT2::Formatter& args, bool autoClose = false); diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index c7c1bc5e6a..dc70483402 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -111,21 +111,21 @@ namespace OpenRCT2 WV_CONTRIBUTORS, }; - enum WindowDetail + enum class WindowDetail : uint8_t { - WD_BANNER, - WD_NEW_CAMPAIGN, - WD_DEMOLISH_RIDE, - WD_REFURBISH_RIDE, - WD_SIGN, - WD_SIGN_SMALL, + banner, + newCampaign, + demolishRide, + refurbishRide, + sign, + signSmall, - WD_PLAYER, + player, - WD_VEHICLE, - WD_TRACK, + vehicle, + track, - WD_NULL = 255, + null = 255, }; } // namespace OpenRCT2 diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 266555aa29..4ae848a586 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -5289,7 +5289,7 @@ void Ride::crash(uint8_t vehicleIndex) if (gLegacyScene != LegacyScene::titleSequence && vehicle != nullptr) { // Open ride window for crashed vehicle - auto intent = Intent(WD_VEHICLE); + auto intent = Intent(WindowDetail::vehicle); intent.PutExtra(INTENT_EXTRA_VEHICLE, vehicle); WindowBase* w = ContextOpenIntent(&intent); diff --git a/src/openrct2/ui/DummyWindowManager.cpp b/src/openrct2/ui/DummyWindowManager.cpp index 7bf109967c..7d0cf62726 100644 --- a/src/openrct2/ui/DummyWindowManager.cpp +++ b/src/openrct2/ui/DummyWindowManager.cpp @@ -22,7 +22,7 @@ namespace OpenRCT2::Ui { return nullptr; } - WindowBase* OpenDetails(uint8_t /*type*/, int32_t /*id*/) override + WindowBase* openDetails(WindowDetail /*type*/, int32_t /*id*/) override { return nullptr; } diff --git a/src/openrct2/ui/WindowManager.h b/src/openrct2/ui/WindowManager.h index 91d1cb8cc5..c373d324fc 100644 --- a/src/openrct2/ui/WindowManager.h +++ b/src/openrct2/ui/WindowManager.h @@ -32,7 +32,7 @@ namespace OpenRCT2::Ui virtual void Init() = 0; virtual WindowBase* OpenWindow(WindowClass wc) = 0; virtual WindowBase* OpenView(uint8_t view) = 0; - virtual WindowBase* OpenDetails(uint8_t type, int32_t id) = 0; + virtual WindowBase* openDetails(WindowDetail type, int32_t id) = 0; virtual WindowBase* OpenIntent(Intent* intent) = 0; virtual void BroadcastIntent(const Intent& intent) = 0; virtual WindowBase* ShowError(StringId title, StringId message, const Formatter& formatter, bool autoClose = false) = 0; diff --git a/src/openrct2/windows/Intent.h b/src/openrct2/windows/Intent.h index 8137557038..503faac590 100644 --- a/src/openrct2/windows/Intent.h +++ b/src/openrct2/windows/Intent.h @@ -71,7 +71,7 @@ namespace OpenRCT2 class Intent { WindowClass _Class{ WindowClass::null }; - WindowDetail _WindowDetail{ WD_NULL }; + WindowDetail _WindowDetail{ WindowDetail::null }; IntentAction _Action{ INTENT_ACTION_NULL }; IntentDataStorage _Data;