From 7f29e4e39c76dbf7039162368ec8bb604e943d03 Mon Sep 17 00:00:00 2001 From: Hielke Morsink Date: Sun, 21 Aug 2022 18:38:25 +0200 Subject: [PATCH] Make `rct_windowclass` strong type `WindowClass` This already revealed some places where implicit conversions were done, including some where its use was nonsense (MouseInput.cpp). The changes to the Intent class were necessary to keep things working, and this splits things up more neatly. --- src/openrct2-ui/UiContext.cpp | 2 +- src/openrct2-ui/WindowManager.cpp | 209 ++++++++++------- src/openrct2-ui/input/InputManager.cpp | 4 +- src/openrct2-ui/input/MouseInput.cpp | 36 +-- src/openrct2-ui/input/ShortcutManager.cpp | 2 +- src/openrct2-ui/input/Shortcuts.cpp | 116 +++++----- src/openrct2-ui/interface/InGameConsole.cpp | 4 +- src/openrct2-ui/interface/Theme.cpp | 214 +++++++++--------- src/openrct2-ui/interface/Theme.h | 10 +- .../interface/ViewportInteraction.cpp | 9 +- src/openrct2-ui/interface/Widget.cpp | 6 +- src/openrct2-ui/interface/Window.cpp | 10 +- src/openrct2-ui/scripting/CustomMenu.cpp | 2 +- src/openrct2-ui/scripting/CustomWindow.cpp | 11 +- src/openrct2-ui/scripting/ScUi.hpp | 8 +- src/openrct2-ui/scripting/ScViewport.hpp | 6 +- src/openrct2-ui/scripting/ScWidget.hpp | 28 +-- src/openrct2-ui/scripting/ScWindow.hpp | 10 +- src/openrct2-ui/title/TitleSequencePlayer.cpp | 40 ++-- src/openrct2-ui/windows/About.cpp | 4 +- src/openrct2-ui/windows/Banner.cpp | 4 +- src/openrct2-ui/windows/Changelog.cpp | 4 +- src/openrct2-ui/windows/Cheats.cpp | 8 +- src/openrct2-ui/windows/ClearScenery.cpp | 4 +- src/openrct2-ui/windows/CustomCurrency.cpp | 2 +- src/openrct2-ui/windows/DebugPaint.cpp | 2 +- .../windows/DemolishRidePrompt.cpp | 7 +- src/openrct2-ui/windows/Dropdown.cpp | 8 +- .../windows/EditorBottomToolbar.cpp | 33 +-- .../windows/EditorInventionsList.cpp | 14 +- .../windows/EditorObjectSelection.cpp | 8 +- .../windows/EditorObjectiveOptions.cpp | 4 +- .../windows/EditorScenarioOptions.cpp | 8 +- src/openrct2-ui/windows/Error.cpp | 5 +- src/openrct2-ui/windows/Finances.cpp | 4 +- src/openrct2-ui/windows/Footpath.cpp | 26 +-- src/openrct2-ui/windows/GameBottomToolbar.cpp | 16 +- src/openrct2-ui/windows/Guest.cpp | 9 +- src/openrct2-ui/windows/GuestList.cpp | 8 +- src/openrct2-ui/windows/InstallTrack.cpp | 4 +- src/openrct2-ui/windows/Land.cpp | 2 +- src/openrct2-ui/windows/LandRights.cpp | 7 +- src/openrct2-ui/windows/LoadSave.cpp | 30 +-- src/openrct2-ui/windows/Main.cpp | 3 +- src/openrct2-ui/windows/Map.cpp | 10 +- src/openrct2-ui/windows/MapGen.cpp | 8 +- src/openrct2-ui/windows/MapTooltip.cpp | 10 +- src/openrct2-ui/windows/MazeConstruction.cpp | 13 +- src/openrct2-ui/windows/Multiplayer.cpp | 5 +- src/openrct2-ui/windows/NetworkStatus.cpp | 8 +- src/openrct2-ui/windows/NewCampaign.cpp | 8 +- src/openrct2-ui/windows/NewRide.cpp | 12 +- src/openrct2-ui/windows/News.cpp | 4 +- src/openrct2-ui/windows/NewsOptions.cpp | 2 +- src/openrct2-ui/windows/ObjectLoadError.cpp | 8 +- src/openrct2-ui/windows/Options.cpp | 28 +-- src/openrct2-ui/windows/Park.cpp | 4 +- src/openrct2-ui/windows/PatrolArea.cpp | 9 +- src/openrct2-ui/windows/Player.cpp | 4 +- .../windows/RefurbishRidePrompt.cpp | 7 +- src/openrct2-ui/windows/Research.cpp | 4 +- src/openrct2-ui/windows/Ride.cpp | 34 +-- src/openrct2-ui/windows/RideConstruction.cpp | 61 ++--- src/openrct2-ui/windows/RideList.cpp | 6 +- src/openrct2-ui/windows/SavePrompt.cpp | 11 +- src/openrct2-ui/windows/ScenarioSelect.cpp | 6 +- src/openrct2-ui/windows/Scenery.cpp | 24 +- src/openrct2-ui/windows/SceneryScatter.cpp | 4 +- src/openrct2-ui/windows/ServerList.cpp | 7 +- src/openrct2-ui/windows/ServerStart.cpp | 6 +- src/openrct2-ui/windows/ShortcutKeys.cpp | 11 +- src/openrct2-ui/windows/Sign.cpp | 8 +- src/openrct2-ui/windows/Staff.cpp | 14 +- src/openrct2-ui/windows/StaffFirePrompt.cpp | 4 +- src/openrct2-ui/windows/StaffList.cpp | 12 +- src/openrct2-ui/windows/TextInput.cpp | 12 +- src/openrct2-ui/windows/Themes.cpp | 158 ++++++------- src/openrct2-ui/windows/TileInspector.cpp | 6 +- src/openrct2-ui/windows/TitleExit.cpp | 4 +- src/openrct2-ui/windows/TitleLogo.cpp | 2 +- src/openrct2-ui/windows/TitleMenu.cpp | 22 +- src/openrct2-ui/windows/TitleOptions.cpp | 4 +- src/openrct2-ui/windows/Tooltip.cpp | 11 +- src/openrct2-ui/windows/TopToolbar.cpp | 126 +++++------ src/openrct2-ui/windows/TrackDesignManage.cpp | 21 +- src/openrct2-ui/windows/TrackDesignPlace.cpp | 18 +- src/openrct2-ui/windows/TrackList.cpp | 12 +- src/openrct2-ui/windows/Transparency.cpp | 4 +- src/openrct2-ui/windows/ViewClipping.cpp | 6 +- src/openrct2-ui/windows/Viewport.cpp | 4 +- src/openrct2-ui/windows/Water.cpp | 2 +- src/openrct2/Context.cpp | 10 +- src/openrct2/Context.h | 6 +- src/openrct2/Editor.cpp | 24 +- src/openrct2/Game.cpp | 22 +- src/openrct2/Input.h | 2 +- src/openrct2/actions/LoadOrQuitAction.cpp | 4 +- .../actions/ParkSetParameterAction.cpp | 6 +- src/openrct2/actions/RideCreateAction.cpp | 2 +- src/openrct2/actions/RideDemolishAction.cpp | 10 +- .../actions/RideSetAppearanceAction.cpp | 2 +- src/openrct2/actions/RideSetPriceAction.cpp | 10 +- src/openrct2/actions/RideSetSettingAction.cpp | 2 +- src/openrct2/actions/RideSetStatusAction.cpp | 8 +- .../actions/ScenarioSetSettingAction.cpp | 30 +-- src/openrct2/actions/SetCheatAction.cpp | 46 ++-- .../actions/SetParkEntranceFeeAction.cpp | 2 +- src/openrct2/actions/StaffFireAction.cpp | 2 +- .../actions/StaffSetCostumeAction.cpp | 2 +- src/openrct2/actions/StaffSetOrdersAction.cpp | 2 +- src/openrct2/audio/Audio.cpp | 2 +- src/openrct2/cmdline/ConvertCommand.cpp | 2 +- src/openrct2/entity/Guest.cpp | 16 +- src/openrct2/entity/Peep.cpp | 16 +- src/openrct2/interface/InteractiveConsole.cpp | 14 +- src/openrct2/interface/Viewport.cpp | 8 +- src/openrct2/interface/Window.cpp | 76 +++---- src/openrct2/interface/Window.h | 143 +++--------- src/openrct2/interface/WindowClasses.h | 99 ++++++++ src/openrct2/interface/Window_internal.h | 2 +- src/openrct2/libopenrct2.vcxproj | 3 +- src/openrct2/management/Award.cpp | 4 +- src/openrct2/management/Finance.cpp | 4 +- src/openrct2/management/Marketing.cpp | 2 +- src/openrct2/management/NewsItem.cpp | 12 +- src/openrct2/management/Research.cpp | 4 +- src/openrct2/network/NetworkBase.cpp | 30 +-- src/openrct2/network/NetworkPlayer.cpp | 2 +- src/openrct2/object/ObjectManager.cpp | 2 +- src/openrct2/ride/Ride.cpp | 28 +-- src/openrct2/ride/RideConstruction.cpp | 14 +- src/openrct2/ride/RideRatings.cpp | 2 +- src/openrct2/ride/Vehicle.cpp | 10 +- src/openrct2/scenario/Scenario.cpp | 2 +- .../scripting/bindings/world/ScPark.cpp | 6 +- src/openrct2/title/TitleScreen.cpp | 12 +- src/openrct2/ui/DummyWindowManager.cpp | 4 +- src/openrct2/ui/WindowManager.h | 4 +- src/openrct2/windows/Intent.cpp | 26 ++- src/openrct2/windows/Intent.h | 80 ++++--- src/openrct2/windows/_legacy.cpp | 4 +- src/openrct2/world/Map.cpp | 8 +- src/openrct2/world/Park.cpp | 12 +- src/openrct2/world/TileElement.cpp | 2 +- src/openrct2/world/TileInspector.cpp | 4 +- 145 files changed, 1331 insertions(+), 1235 deletions(-) create mode 100644 src/openrct2/interface/WindowClasses.h diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index b061cbb17b..191d947e6f 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -144,7 +144,7 @@ public: void Draw(rct_drawpixelinfo* dpi) override { - auto bgColour = ThemeGetColour(WC_CHAT, 0); + auto bgColour = ThemeGetColour(WindowClass::Chat, 0); chat_draw(dpi, bgColour); _inGameConsole.Draw(dpi); } diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index 86eecfdb22..219f2623c9 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -37,103 +38,103 @@ public: WindowNewRideInitVars(); } - rct_window* OpenWindow(rct_windowclass wc) override + rct_window* OpenWindow(WindowClass wc) override { switch (wc) { - case WC_ABOUT: + case WindowClass::About: return WindowAboutOpen(); - case WC_BOTTOM_TOOLBAR: + case WindowClass::BottomToolbar: return WindowGameBottomToolbarOpen(); - case WC_CHANGELOG: + case WindowClass::Changelog: return OpenView(WV_CHANGELOG); - case WC_CHEATS: + case WindowClass::Cheats: return WindowCheatsOpen(); - case WC_CLEAR_SCENERY: + case WindowClass::ClearScenery: return WindowClearSceneryOpen(); - case WC_CUSTOM_CURRENCY_CONFIG: + case WindowClass::CustomCurrencyConfig: return CustomCurrencyWindowOpen(); - case WC_DEBUG_PAINT: + case WindowClass::DebugPaint: return WindowDebugPaintOpen(); - case WC_EDITOR_INVENTION_LIST: + case WindowClass::EditorInventionList: return WindowEditorInventionsListOpen(); - case WC_EDITOR_OBJECT_SELECTION: + case WindowClass::EditorObjectSelection: return WindowEditorObjectSelectionOpen(); - case WC_EDITOR_OBJECTIVE_OPTIONS: + case WindowClass::EditorObjectiveOptions: return WindowEditorObjectiveOptionsOpen(); - case WC_EDITOR_SCENARIO_OPTIONS: + case WindowClass::EditorScenarioOptions: return WindowEditorScenarioOptionsOpen(); - case WC_FINANCES: + case WindowClass::Finances: return WindowFinancesOpen(); - case WC_FOOTPATH: + case WindowClass::Footpath: return WindowFootpathOpen(); - case WC_GUEST_LIST: + case WindowClass::GuestList: return WindowGuestListOpen(); - case WC_LAND: + case WindowClass::Land: return WindowLandOpen(); - case WC_LAND_RIGHTS: + case WindowClass::LandRights: return WindowLandRightsOpen(); - case WC_MAIN_WINDOW: + case WindowClass::MainWindow: return WindowMainOpen(); - case WC_MAP: + case WindowClass::Map: return WindowMapOpen(); - case WC_MAPGEN: + case WindowClass::Mapgen: return WindowMapgenOpen(); - case WC_MULTIPLAYER: + case WindowClass::Multiplayer: return WindowMultiplayerOpen(); - case WC_CONSTRUCT_RIDE: + case WindowClass::ConstructRide: return WindowNewRideOpen(); - case WC_PARK_INFORMATION: + case WindowClass::ParkInformation: return WindowParkEntranceOpen(); - case WC_RECENT_NEWS: + case WindowClass::RecentNews: return WindowNewsOpen(); - case WC_RIDE_CONSTRUCTION: + case WindowClass::RideConstruction: return WindowRideConstructionOpen(); - case WC_RESEARCH: + case WindowClass::Research: return WindowResearchOpen(); - case WC_RIDE_LIST: + case WindowClass::RideList: return WindowRideListOpen(); - case WC_NOTIFICATION_OPTIONS: + case WindowClass::NotificationOptions: return WindowNewsOptionsOpen(); - case WC_OPTIONS: + case WindowClass::Options: return WindowOptionsOpen(); - case WC_SAVE_PROMPT: + case WindowClass::SavePrompt: return WindowSavePromptOpen(); - case WC_SCENERY: + case WindowClass::Scenery: return WindowSceneryOpen(); - case WC_SCENERY_SCATTER: + case WindowClass::SceneryScatter: return WindowSceneryScatterOpen(); #ifndef DISABLE_NETWORK - case WC_SERVER_LIST: + case WindowClass::ServerList: return WindowServerListOpen(); - case WC_SERVER_START: + case WindowClass::ServerStart: return WindowServerStartOpen(); #endif - case WC_KEYBOARD_SHORTCUT_LIST: + case WindowClass::KeyboardShortcutList: return WindowShortcutKeysOpen(); - case WC_STAFF_LIST: + case WindowClass::StaffList: return WindowStaffListOpen(); - case WC_THEMES: + case WindowClass::Themes: return WindowThemesOpen(); - case WC_TILE_INSPECTOR: + case WindowClass::TileInspector: return WindowTileInspectorOpen(); - case WC_TITLE_EXIT: + case WindowClass::TitleExit: return WindowTitleExitOpen(); - case WC_TITLE_LOGO: + case WindowClass::TitleLogo: return WindowTitleLogoOpen(); - case WC_TITLE_MENU: + case WindowClass::TitleMenu: return WindowTitleMenuOpen(); - case WC_TITLE_OPTIONS: + case WindowClass::TitleOptions: return WindowTitleOptionsOpen(); - case WC_TOP_TOOLBAR: + case WindowClass::TopToolbar: return WindowTopToolbarOpen(); - case WC_VIEW_CLIPPING: + case WindowClass::ViewClipping: return WindowViewClippingOpen(); - case WC_VIEWPORT: + case WindowClass::Viewport: return WindowViewportOpen(); - case WC_WATER: + case WindowClass::Water: return WindowWaterOpen(); - case WC_TRANSPARENCY: + case WindowClass::Transparency: return WindowTransparencyOpen(); default: Console::Error::WriteLine("Unhandled window class (%d)", wc); @@ -158,7 +159,7 @@ public: case WV_RIDE_RESEARCH: if (gConfigInterface.toolbar_show_research) { - return this->OpenWindow(WC_RESEARCH); + return this->OpenWindow(WindowClass::Research); } return WindowNewRideOpenResearch(); case WV_MAZE_CONSTRUCTION: @@ -182,17 +183,16 @@ public: { case WD_BANNER: return WindowBannerOpen(id); + case WD_NEW_CAMPAIGN: + return WindowNewCampaignOpen(id); case WD_DEMOLISH_RIDE: return WindowRideDemolishPromptOpen(get_ride(RideId::FromUnderlying(id))); case WD_REFURBISH_RIDE: return WindowRideRefurbishPromptOpen(get_ride(RideId::FromUnderlying(id))); - case WD_NEW_CAMPAIGN: - return WindowNewCampaignOpen(id); case WD_SIGN: return WindowSignOpen(id); case WD_SIGN_SMALL: return WindowSignSmallOpen(id); - case WD_PLAYER: return WindowPlayerOpen(id); @@ -215,17 +215,17 @@ public: { switch (intent->GetWindowClass()) { - case WC_PEEP: + case WindowClass::Peep: return WindowGuestOpen(static_cast(intent->GetPointerExtra(INTENT_EXTRA_PEEP))); - case WC_FIRE_PROMPT: + case WindowClass::FirePrompt: return WindowStaffFirePromptOpen(static_cast(intent->GetPointerExtra(INTENT_EXTRA_PEEP))); - case WC_INSTALL_TRACK: + case WindowClass::InstallTrack: return WindowInstallTrackOpen(intent->GetStringExtra(INTENT_EXTRA_PATH).c_str()); - case WC_GUEST_LIST: + case WindowClass::GuestList: return WindowGuestListOpenWithFilter( static_cast(intent->GetSIntExtra(INTENT_EXTRA_GUEST_LIST_FILTER)), intent->GetSIntExtra(INTENT_EXTRA_RIDE_ID)); - case WC_LOADSAVE: + case WindowClass::Loadsave: { uint32_t type = intent->GetUIntExtra(INTENT_EXTRA_LOADSAVE_TYPE); std::string defaultName = intent->GetStringExtra(INTENT_EXTRA_PATH); @@ -243,16 +243,16 @@ public: trackDesign); return w; } - case WC_MANAGE_TRACK_DESIGN: + case WindowClass::ManageTrackDesign: return WindowTrackManageOpen( static_cast(intent->GetPointerExtra(INTENT_EXTRA_TRACK_DESIGN))); - case WC_NETWORK_STATUS: + case WindowClass::NetworkStatus: { std::string message = intent->GetStringExtra(INTENT_EXTRA_MESSAGE); close_callback callback = intent->GetCloseCallbackExtra(INTENT_EXTRA_CALLBACK); return WindowNetworkStatusOpen(message.c_str(), callback); } - case WC_OBJECT_LOAD_ERROR: + case WindowClass::ObjectLoadError: { std::string path = intent->GetStringExtra(INTENT_EXTRA_PATH); auto objects = static_cast(intent->GetPointerExtra(INTENT_EXTRA_LIST)); @@ -261,29 +261,37 @@ public: return nullptr; } - case WC_RIDE: + case WindowClass::Ride: { const auto rideId = RideId::FromUnderlying(intent->GetSIntExtra(INTENT_EXTRA_RIDE_ID)); auto ride = get_ride(rideId); return ride == nullptr ? nullptr : WindowRideMainOpen(ride); } - case WC_TRACK_DESIGN_PLACE: + case WindowClass::TrackDesignPlace: return WindowTrackPlaceOpen( static_cast(intent->GetPointerExtra(INTENT_EXTRA_TRACK_DESIGN))); - case WC_TRACK_DESIGN_LIST: + case WindowClass::TrackDesignList: { RideSelection rideItem; rideItem.Type = intent->GetUIntExtra(INTENT_EXTRA_RIDE_TYPE); rideItem.EntryIndex = intent->GetUIntExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX); return WindowTrackListOpen(rideItem); } - case WC_SCENARIO_SELECT: + case WindowClass::ScenarioSelect: return WindowScenarioselectOpen( reinterpret_cast(intent->GetPointerExtra(INTENT_EXTRA_CALLBACK)), false); - case WD_VEHICLE: - return WindowRideOpenVehicle(static_cast(intent->GetPointerExtra(INTENT_EXTRA_VEHICLE))); - case WD_TRACK: - return WindowRideOpenTrack(static_cast(intent->GetPointerExtra(INTENT_EXTRA_TILE_ELEMENT))); + + case WindowClass::Null: + // Intent does not hold a window class + break; + + default: + Guard::Assert(false, "OpenIntent was called for an unhandled window class."); + break; + } + + switch (intent->GetAction()) + { case INTENT_ACTION_NEW_RIDE_OF_TYPE: { // Open ride list window @@ -300,10 +308,10 @@ public: case INTENT_ACTION_NEW_SCENERY: { // Check if window is already open - auto* window = window_bring_to_front_by_class(WC_SCENERY); + auto* window = window_bring_to_front_by_class(WindowClass::Scenery); if (window == nullptr) { - auto* tlbrWindow = window_find_by_class(WC_TOP_TOOLBAR); + auto* tlbrWindow = window_find_by_class(WindowClass::TopToolbar); if (tlbrWindow != nullptr) { tlbrWindow->Invalidate(); @@ -319,15 +327,39 @@ public: WindowScenerySetSelectedTab(intent->GetUIntExtra(INTENT_EXTRA_SCENERY_GROUP_ENTRY_INDEX)); return window; } + + case INTENT_ACTION_NULL: + // Intent does not hold an intent action + break; + default: - Console::Error::WriteLine("Unhandled window class for intent (%d)", intent->GetWindowClass()); - return nullptr; + Guard::Assert(false, "OpenIntent was called for an unhandled intent action."); + break; } + + switch (intent->GetWindowDetail()) + { + case WD_VEHICLE: + return WindowRideOpenVehicle(static_cast(intent->GetPointerExtra(INTENT_EXTRA_VEHICLE))); + case WD_TRACK: + return WindowRideOpenTrack(static_cast(intent->GetPointerExtra(INTENT_EXTRA_TILE_ELEMENT))); + + case WD_NULL: + // Intent does not hold an window detail + break; + + default: + Guard::Assert(false, "OpenIntent was called for an unhandled window detail."); + break; + } + + Console::Error::WriteLine("Unhandled window class for intent (%d)", intent->GetWindowClass()); + return nullptr; } void BroadcastIntent(const Intent& intent) override { - switch (intent.GetWindowClass()) + switch (intent.GetAction()) { case INTENT_ACTION_MAP: WindowMapReset(); @@ -345,7 +377,7 @@ public: case INTENT_ACTION_REFRESH_RIDE_LIST: { - auto window = window_find_by_class(WC_RIDE_LIST); + auto window = window_find_by_class(WindowClass::RideList); if (window != nullptr) { WindowRideListRefreshList(window); @@ -361,12 +393,12 @@ public: case INTENT_ACTION_RIDE_CONSTRUCTION_FOCUS: { auto rideIndex = intent.GetUIntExtra(INTENT_EXTRA_RIDE_ID); - auto w = window_find_by_class(WC_RIDE_CONSTRUCTION); + auto w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr || w->number != rideIndex) { window_close_construction_windows(); _currentRideIndex = RideId::FromUnderlying(rideIndex); - OpenWindow(WC_RIDE_CONSTRUCTION); + OpenWindow(WindowClass::RideConstruction); } else { @@ -417,7 +449,7 @@ public: case INTENT_ACTION_INVALIDATE_VEHICLE_WINDOW: { auto vehicle = static_cast(intent.GetPointerExtra(INTENT_EXTRA_VEHICLE)); - auto* w = window_find_by_number(WC_RIDE, vehicle->ride.ToUnderlying()); + auto* w = window_find_by_number(WindowClass::Ride, vehicle->ride.ToUnderlying()); if (w == nullptr) return; @@ -436,7 +468,7 @@ public: case INTENT_ACTION_RIDE_PAINT_RESET_VEHICLE: { auto rideIndex = intent.GetUIntExtra(INTENT_EXTRA_RIDE_ID); - auto w = window_find_by_number(WC_RIDE, rideIndex); + auto w = window_find_by_number(WindowClass::Ride, rideIndex); if (w != nullptr) { if (w->page == 4) // WINDOW_RIDE_PAGE_COLOUR @@ -450,19 +482,19 @@ public: case INTENT_ACTION_UPDATE_CLIMATE: gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE; - window_invalidate_by_class(WC_GUEST_LIST); + window_invalidate_by_class(WindowClass::GuestList); break; case INTENT_ACTION_UPDATE_GUEST_COUNT: gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PEEP_COUNT; - window_invalidate_by_class(WC_GUEST_LIST); - window_invalidate_by_class(WC_PARK_INFORMATION); + window_invalidate_by_class(WindowClass::GuestList); + window_invalidate_by_class(WindowClass::ParkInformation); WindowGuestListRefreshList(); break; case INTENT_ACTION_UPDATE_PARK_RATING: gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PARK_RATING; - window_invalidate_by_class(WC_PARK_INFORMATION); + window_invalidate_by_class(WindowClass::ParkInformation); break; case INTENT_ACTION_UPDATE_DATE: @@ -470,7 +502,7 @@ public: break; case INTENT_ACTION_UPDATE_CASH: - window_invalidate_by_class(WC_FINANCES); + window_invalidate_by_class(WindowClass::Finances); gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_MONEY; break; @@ -478,7 +510,7 @@ public: { uint8_t bannerIndex = static_cast(intent.GetUIntExtra(INTENT_EXTRA_BANNER_INDEX)); - rct_window* w = window_find_by_number(WC_BANNER, bannerIndex); + rct_window* w = window_find_by_number(WindowClass::Banner, bannerIndex); if (w != nullptr) { w->Invalidate(); @@ -486,8 +518,8 @@ public: break; } case INTENT_ACTION_UPDATE_RESEARCH: - window_invalidate_by_class(WC_FINANCES); - window_invalidate_by_class(WC_RESEARCH); + window_invalidate_by_class(WindowClass::Finances); + window_invalidate_by_class(WindowClass::Research); break; case INTENT_ACTION_TRACK_DESIGN_REMOVE_PROVISIONAL: @@ -507,14 +539,17 @@ public: } break; } + + default: + break; } } - void ForceClose(rct_windowclass windowClass) override + void ForceClose(WindowClass windowClass) override { switch (windowClass) { - case WC_NETWORK_STATUS: + case WindowClass::NetworkStatus: WindowNetworkStatusClose(); break; diff --git a/src/openrct2-ui/input/InputManager.cpp b/src/openrct2-ui/input/InputManager.cpp index ccc6d25f10..e2fcfe4eb4 100644 --- a/src/openrct2-ui/input/InputManager.cpp +++ b/src/openrct2-ui/input/InputManager.cpp @@ -197,7 +197,7 @@ void InputManager::Process(const InputEvent& e) if (e.DeviceKind == InputDeviceKind::Keyboard) { - auto w = window_find_by_class(WC_TEXTINPUT); + auto w = window_find_by_class(WindowClass::Textinput); if (w != nullptr) { if (e.State == InputEventState::Release) @@ -386,7 +386,7 @@ bool InputManager::HasTextInputFocus() const if (gUsingWidgetTextBox || gChatOpen) return true; - auto w = window_find_by_class(WC_TEXTINPUT); + auto w = window_find_by_class(WindowClass::Textinput); if (w != nullptr) return true; diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp index 582781a5a7..2019744598 100644 --- a/src/openrct2-ui/input/MouseInput.cpp +++ b/src/openrct2-ui/input/MouseInput.cpp @@ -63,7 +63,7 @@ static int16_t _clickRepeatTicks; static MouseState GameGetNextInput(ScreenCoordsXY& screenCoords); static void InputWidgetOver(const ScreenCoordsXY& screenCoords, rct_window* w, rct_widgetindex widgetIndex); -static void InputWidgetOverChangeCheck(rct_windowclass windowClass, rct_windownumber windowNumber, rct_widgetindex widgetIndex); +static void InputWidgetOverChangeCheck(WindowClass windowClass, rct_windownumber windowNumber, rct_widgetindex widgetIndex); static void InputWidgetOverFlatbuttonInvalidate(); void ProcessMouseOver(const ScreenCoordsXY& screenCoords); void ProcessMouseTool(const ScreenCoordsXY& screenCoords); @@ -293,7 +293,7 @@ static void GameHandleInputMouse(const ScreenCoordsXY& screenCoords, MouseState InputWidgetLeft(screenCoords, w, widgetIndex); break; case MouseState::RightPress: - window_close_by_class(WC_TOOLTIP); + window_close_by_class(WindowClass::Tooltip); if (w != nullptr) { @@ -670,7 +670,7 @@ static void InputScrollBegin(rct_window& w, rct_widgetindex widgetIndex, const S break; } WidgetScrollUpdateThumbs(w, widgetIndex); - window_invalidate_by_number(widgetIndex, w.classification); + window_invalidate_by_number(w.classification, w.number); } static void InputScrollContinue(rct_window& w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords) @@ -910,7 +910,7 @@ static void InputScrollPartUpdateVBottom(rct_window& w, rct_widgetindex widgetIn */ static void InputWidgetOver(const ScreenCoordsXY& screenCoords, rct_window* w, rct_widgetindex widgetIndex) { - rct_windowclass windowClass = WC_NULL; + WindowClass windowClass = WindowClass::Null; rct_windownumber windowNumber = 0; rct_widget* widget = nullptr; @@ -947,7 +947,7 @@ static void InputWidgetOver(const ScreenCoordsXY& screenCoords, rct_window* w, r * * rct2: 0x006E9269 */ -static void InputWidgetOverChangeCheck(rct_windowclass windowClass, rct_windownumber windowNumber, rct_widgetindex widgetIndex) +static void InputWidgetOverChangeCheck(WindowClass windowClass, rct_windownumber windowNumber, rct_widgetindex widgetIndex) { // Prevents invalid widgets being clicked source of bug is elsewhere if (widgetIndex == -1) @@ -966,7 +966,7 @@ static void InputWidgetOverChangeCheck(rct_windowclass windowClass, rct_windownu gHoverWidget.widget_index = widgetIndex; // Invalidate new widget cursor is on if widget is a flat button - if (windowClass != 255) + if (windowClass != WindowClass::Null) InputWidgetOverFlatbuttonInvalidate(); } } @@ -995,7 +995,7 @@ static void InputWidgetOverFlatbuttonInvalidate() */ static void InputWidgetLeft(const ScreenCoordsXY& screenCoords, rct_window* w, rct_widgetindex widgetIndex) { - rct_windowclass windowClass = WC_NULL; + WindowClass windowClass = WindowClass::Null; rct_windownumber windowNumber = 0; if (w != nullptr) @@ -1004,8 +1004,8 @@ static void InputWidgetLeft(const ScreenCoordsXY& screenCoords, rct_window* w, r windowNumber = w->number; } - window_close_by_class(WC_ERROR); - window_close_by_class(WC_TOOLTIP); + window_close_by_class(WindowClass::Error); + window_close_by_class(WindowClass::Tooltip); // Window might have changed position in the list, therefore find it again w = window_find_by_number(windowClass, windowNumber); @@ -1180,7 +1180,7 @@ void ProcessMouseTool(const ScreenCoordsXY& screenCoords) void InputStateWidgetPressed( const ScreenCoordsXY& screenCoords, MouseState state, rct_widgetindex widgetIndex, rct_window* w, rct_widget* widget) { - rct_windowclass cursor_w_class; + WindowClass cursor_w_class; rct_windownumber cursor_w_number; cursor_w_class = gPressedWidget.window_classification; cursor_w_number = gPressedWidget.window_number; @@ -1222,7 +1222,7 @@ void InputStateWidgetPressed( if (_inputState == InputState::DropdownActive) { gDropdownHighlightedIndex = gDropdownDefaultIndex; - window_invalidate_by_class(WC_DROPDOWN); + window_invalidate_by_class(WindowClass::Dropdown); } return; } @@ -1241,7 +1241,7 @@ void InputStateWidgetPressed( int32_t dropdown_index = 0; bool dropdownCleanup = false; - if (w->classification == WC_DROPDOWN) + if (w->classification == WindowClass::Dropdown) { dropdown_index = DropdownIndexFromPoint(screenCoords, w); dropdownCleanup = dropdown_index == -1 @@ -1270,7 +1270,7 @@ void InputStateWidgetPressed( } } - window_close_by_class(WC_DROPDOWN); + window_close_by_class(WindowClass::Dropdown); if (dropdownCleanup) { @@ -1351,13 +1351,13 @@ void InputStateWidgetPressed( } gDropdownHighlightedIndex = -1; - window_invalidate_by_class(WC_DROPDOWN); + window_invalidate_by_class(WindowClass::Dropdown); if (w == nullptr) { return; } - if (w->classification == WC_DROPDOWN) + if (w->classification == WindowClass::Dropdown) { int32_t dropdown_index = DropdownIndexFromPoint(screenCoords, w); if (dropdown_index == -1) @@ -1418,7 +1418,7 @@ void InputStateWidgetPressed( } gDropdownHighlightedIndex = dropdown_index; - window_invalidate_by_class(WC_DROPDOWN); + window_invalidate_by_class(WindowClass::Dropdown); } else { @@ -1429,7 +1429,7 @@ void InputStateWidgetPressed( static void InputUpdateTooltip(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords) { - if (gTooltipWidget.window_classification == 255) + if (gTooltipWidget.window_classification == WindowClass::Null) { if (gTooltipCursor == screenCoords) { @@ -1458,7 +1458,7 @@ static void InputUpdateTooltip(rct_window* w, rct_widgetindex widgetIndex, const gTooltipTimeout += gCurrentDeltaTime; if (gTooltipTimeout >= 8000) { - window_close_by_class(WC_TOOLTIP); + window_close_by_class(WindowClass::Tooltip); } } } diff --git a/src/openrct2-ui/input/ShortcutManager.cpp b/src/openrct2-ui/input/ShortcutManager.cpp index c07ae9f509..92a7745f92 100644 --- a/src/openrct2-ui/input/ShortcutManager.cpp +++ b/src/openrct2-ui/input/ShortcutManager.cpp @@ -173,7 +173,7 @@ void ShortcutManager::ProcessEvent(const InputEvent& e) shortcut->Current.push_back(std::move(shortcutInput.value())); } _pendingShortcutChange.clear(); - window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT); + window_close_by_class(WindowClass::ChangeKeyboardShortcut); SaveUserBindings(); } } diff --git a/src/openrct2-ui/input/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp index 2314763fa3..41aa1cc725 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -45,7 +45,7 @@ using namespace OpenRCT2::Ui; #pragma region Shortcut Commands -static void OpenWindow(rct_windowclass wc) +static void OpenWindow(WindowClass wc) { if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) { @@ -84,7 +84,7 @@ static void ShortcutRotateConstructionObject() return; // Rotate scenery - rct_window* w = window_find_by_class(WC_SCENERY); + rct_window* w = window_find_by_class(WindowClass::Scenery); if (w != nullptr && !WidgetIsDisabled(*w, WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON) && w->widgets[WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type != WindowWidgetType::Empty) { @@ -93,7 +93,7 @@ static void ShortcutRotateConstructionObject() } // Rotate construction track piece - w = window_find_by_class(WC_RIDE_CONSTRUCTION); + w = window_find_by_class(WindowClass::RideConstruction); if (w != nullptr && !WidgetIsDisabled(*w, WC_RIDE_CONSTRUCTION__WIDX_ROTATE) && w->widgets[WC_RIDE_CONSTRUCTION__WIDX_ROTATE].type != WindowWidgetType::Empty) { @@ -106,7 +106,7 @@ static void ShortcutRotateConstructionObject() } // Rotate track design preview - w = window_find_by_class(WC_TRACK_DESIGN_LIST); + w = window_find_by_class(WindowClass::TrackDesignList); if (w != nullptr && !WidgetIsDisabled(*w, WC_TRACK_DESIGN_LIST__WIDX_ROTATE) && w->widgets[WC_TRACK_DESIGN_LIST__WIDX_ROTATE].type != WindowWidgetType::Empty) { @@ -115,7 +115,7 @@ static void ShortcutRotateConstructionObject() } // Rotate track design placement - w = window_find_by_class(WC_TRACK_DESIGN_PLACE); + w = window_find_by_class(WindowClass::TrackDesignPlace); if (w != nullptr && !WidgetIsDisabled(*w, WC_TRACK_DESIGN_PLACE__WIDX_ROTATE) && w->widgets[WC_TRACK_DESIGN_PLACE__WIDX_ROTATE].type != WindowWidgetType::Empty) { @@ -124,7 +124,7 @@ static void ShortcutRotateConstructionObject() } // Rotate park entrance - w = window_find_by_class(WC_MAP); + w = window_find_by_class(WindowClass::Map); if (w != nullptr && !WidgetIsDisabled(*w, WC_MAP__WIDX_ROTATE_90) && w->widgets[WC_MAP__WIDX_ROTATE_90].type != WindowWidgetType::Empty) { @@ -133,7 +133,7 @@ static void ShortcutRotateConstructionObject() } // Rotate selected element in tile inspector - w = window_find_by_class(WC_TILE_INSPECTOR); + w = window_find_by_class(WindowClass::TileInspector); if (w != nullptr && !WidgetIsDisabled(*w, WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE) && w->widgets[WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE].type != WindowWidgetType::Empty) { @@ -146,12 +146,12 @@ static void ShortcutRemoveTopBottomToolbarToggle() { if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) { - if (window_find_by_class(WC_TITLE_LOGO) != nullptr) + if (window_find_by_class(WindowClass::TitleLogo) != nullptr) { - window_close(*window_find_by_class(WC_TITLE_LOGO)); - window_close(*window_find_by_class(WC_TITLE_OPTIONS)); - window_close(*window_find_by_class(WC_TITLE_MENU)); - window_close(*window_find_by_class(WC_TITLE_EXIT)); + window_close(*window_find_by_class(WindowClass::TitleLogo)); + window_close(*window_find_by_class(WindowClass::TitleOptions)); + window_close(*window_find_by_class(WindowClass::TitleMenu)); + window_close(*window_find_by_class(WindowClass::TitleExit)); title_set_hide_version_info(true); } else @@ -161,22 +161,22 @@ static void ShortcutRemoveTopBottomToolbarToggle() } else { - if (window_find_by_class(WC_TOP_TOOLBAR) != nullptr) + if (window_find_by_class(WindowClass::TopToolbar) != nullptr) { - window_close(*window_find_by_class(WC_DROPDOWN)); - window_close(*window_find_by_class(WC_TOP_TOOLBAR)); - window_close(*window_find_by_class(WC_BOTTOM_TOOLBAR)); + window_close(*window_find_by_class(WindowClass::Dropdown)); + window_close(*window_find_by_class(WindowClass::TopToolbar)); + window_close(*window_find_by_class(WindowClass::BottomToolbar)); } else { if (gScreenFlags == 0) { - context_open_window(WC_TOP_TOOLBAR); - context_open_window(WC_BOTTOM_TOOLBAR); + context_open_window(WindowClass::TopToolbar); + context_open_window(WindowClass::BottomToolbar); } else { - context_open_window(WC_TOP_TOOLBAR); + context_open_window(WindowClass::TopToolbar); context_open_window_view(WV_EDITOR_BOTTOM_TOOLBAR); } } @@ -193,7 +193,7 @@ static void ShortcutAdjustLand() { if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) { - rct_window* window = window_find_by_class(WC_TOP_TOOLBAR); + rct_window* window = window_find_by_class(WindowClass::TopToolbar); if (window != nullptr) { window->Invalidate(); @@ -212,7 +212,7 @@ static void ShortcutAdjustWater() { if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) { - rct_window* window = window_find_by_class(WC_TOP_TOOLBAR); + rct_window* window = window_find_by_class(WindowClass::TopToolbar); if (window != nullptr) { window->Invalidate(); @@ -231,7 +231,7 @@ static void ShortcutBuildScenery() { if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) { - rct_window* window = window_find_by_class(WC_TOP_TOOLBAR); + rct_window* window = window_find_by_class(WindowClass::TopToolbar); if (window != nullptr) { window->Invalidate(); @@ -250,7 +250,7 @@ static void ShortcutBuildPaths() { if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) { - rct_window* window = window_find_by_class(WC_TOP_TOOLBAR); + rct_window* window = window_find_by_class(WindowClass::TopToolbar); if (window != nullptr) { window->Invalidate(); @@ -269,7 +269,7 @@ static void ShortcutBuildNewRide() { if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) { - context_open_window(WC_CONSTRUCT_RIDE); + context_open_window(WindowClass::ConstructRide); } } } @@ -281,7 +281,7 @@ static void ShortcutShowFinancialInformation() if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) - context_open_window(WC_FINANCES); + context_open_window(WindowClass::Finances); } static void ShortcutShowResearchInformation() @@ -302,7 +302,7 @@ static void ShortcutShowRidesList() if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) { - context_open_window(WC_RIDE_LIST); + context_open_window(WindowClass::RideList); } } @@ -313,7 +313,7 @@ static void ShortcutShowParkInformation() if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) { - context_open_window(WC_PARK_INFORMATION); + context_open_window(WindowClass::ParkInformation); } } @@ -324,7 +324,7 @@ static void ShortcutShowGuestList() if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) { - context_open_window(WC_GUEST_LIST); + context_open_window(WindowClass::GuestList); } } @@ -335,7 +335,7 @@ static void ShortcutShowStaffList() if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) { - context_open_window(WC_STAFF_LIST); + context_open_window(WindowClass::StaffList); } } @@ -345,7 +345,7 @@ static void ShortcutShowRecentMessages() return; if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) - context_open_window(WC_RECENT_NEWS); + context_open_window(WindowClass::RecentNews); } static void ShortcutShowMap() @@ -355,7 +355,7 @@ static void ShortcutShowMap() if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gEditorStep == EditorStep::LandscapeEditor) if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) - context_open_window(WC_MAP); + context_open_window(WindowClass::Map); } static void ShortcutReduceGameSpeed() @@ -382,13 +382,13 @@ static void ShortcutOpenCheatWindow() return; // Check if window is already open - rct_window* window = window_find_by_class(WC_CHEATS); + rct_window* window = window_find_by_class(WindowClass::Cheats); if (window != nullptr) { window_close(*window); return; } - context_open_window(WC_CHEATS); + context_open_window(WindowClass::Cheats); } static void ShortcutOpenTransparencyWindow() @@ -396,7 +396,7 @@ static void ShortcutOpenTransparencyWindow() if (gScreenFlags != SCREEN_FLAGS_PLAYING) return; - context_open_window(WC_TRANSPARENCY); + context_open_window(WindowClass::Transparency); } static void ShortcutClearScenery() @@ -408,7 +408,7 @@ static void ShortcutClearScenery() { if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) { - rct_window* window = window_find_by_class(WC_TOP_TOOLBAR); + rct_window* window = window_find_by_class(WindowClass::TopToolbar); if (window != nullptr) { window->Invalidate(); @@ -428,7 +428,7 @@ static void ShortcutQuickSaveGame() } else if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) { - auto intent = Intent(WC_LOADSAVE); + auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); intent.putExtra(INTENT_EXTRA_PATH, gScenarioName); context_open_intent(&intent); @@ -450,10 +450,10 @@ static void ShortcutOpenSceneryPicker() || (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && gEditorStep != EditorStep::LandscapeEditor)) return; - rct_window* window_scenery = window_find_by_class(WC_SCENERY); + rct_window* window_scenery = window_find_by_class(WindowClass::Scenery); if (window_scenery == nullptr) { - rct_window* window_toolbar = window_find_by_class(WC_TOP_TOOLBAR); + rct_window* window_toolbar = window_find_by_class(WindowClass::TopToolbar); if (window_toolbar != nullptr) { window_toolbar->Invalidate(); @@ -461,7 +461,7 @@ static void ShortcutOpenSceneryPicker() } } - window_scenery = window_find_by_class(WC_SCENERY); + window_scenery = window_find_by_class(WindowClass::Scenery); if (window_scenery != nullptr && !WidgetIsDisabled(*window_scenery, WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON) && window_scenery->widgets[WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON].type != WindowWidgetType::Empty && !gWindowSceneryEyedropperEnabled) @@ -493,7 +493,7 @@ static void ShortcutScaleDown() // Tile inspector shortcuts static void TileInspectorMouseUp(rct_widgetindex widgetIndex) { - auto w = window_find_by_class(WC_TILE_INSPECTOR); + auto w = window_find_by_class(WindowClass::TileInspector); if (w != nullptr && !WidgetIsDisabled(*w, widgetIndex) && w->widgets[widgetIndex].type != WindowWidgetType::Empty) { window_event_mouse_up_call(w, widgetIndex); @@ -502,7 +502,7 @@ static void TileInspectorMouseUp(rct_widgetindex widgetIndex) static void TileInspectorMouseDown(rct_widgetindex widgetIndex) { - auto w = window_find_by_class(WC_TILE_INSPECTOR); + auto w = window_find_by_class(WindowClass::TileInspector); if (w != nullptr && !WidgetIsDisabled(*w, widgetIndex) && w->widgets[widgetIndex].type != WindowWidgetType::Empty) { window_event_mouse_down_call(w, widgetIndex); @@ -515,7 +515,7 @@ static void ShortcutToggleVisibility() if (windowTileInspectorSelectedIndex < 0) return; - rct_window* w = window_find_by_class(WC_TILE_INSPECTOR); + rct_window* w = window_find_by_class(WindowClass::TileInspector); if (w == nullptr) return; @@ -530,7 +530,7 @@ static void ShortcutToggleVisibility() static void ShortcutIncreaseElementHeight() { - rct_window* w = window_find_by_class(WC_TILE_INSPECTOR); + rct_window* w = window_find_by_class(WindowClass::TileInspector); if (w != nullptr) { int action = -1; @@ -571,7 +571,7 @@ static void ShortcutIncreaseElementHeight() static void ShortcutDecreaseElementHeight() { - rct_window* w = window_find_by_class(WC_TILE_INSPECTOR); + rct_window* w = window_find_by_class(WindowClass::TileInspector); if (w != nullptr) { int action = -1; @@ -635,7 +635,7 @@ static void ShortcutConstructionTurnLeft() if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) return; - rct_window* window = window_find_by_class(WC_FOOTPATH); + rct_window* window = window_find_by_class(WindowClass::Footpath); if (window != nullptr) { window_footpath_keyboard_shortcut_turn_left(); @@ -650,7 +650,7 @@ static void ShortcutConstructionTurnRight() { if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) return; - rct_window* window = window_find_by_class(WC_FOOTPATH); + rct_window* window = window_find_by_class(WindowClass::Footpath); if (window != nullptr) { window_footpath_keyboard_shortcut_turn_right(); @@ -666,7 +666,7 @@ static void ShortcutConstructionSlopeUp() if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) return; - rct_window* window = window_find_by_class(WC_FOOTPATH); + rct_window* window = window_find_by_class(WindowClass::Footpath); if (window != nullptr) { window_footpath_keyboard_shortcut_slope_up(); @@ -682,7 +682,7 @@ static void ShortcutConstructionBuildCurrent() if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) return; - rct_window* window = window_find_by_class(WC_FOOTPATH); + rct_window* window = window_find_by_class(WindowClass::Footpath); if (window != nullptr) { window_footpath_keyboard_shortcut_build_current(); @@ -698,7 +698,7 @@ static void ShortcutConstructionSlopeDown() if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) return; - rct_window* window = window_find_by_class(WC_FOOTPATH); + rct_window* window = window_find_by_class(WindowClass::Footpath); if (window != nullptr) { window_footpath_keyboard_shortcut_slope_down(); @@ -714,7 +714,7 @@ static void ShortcutConstructionDemolishCurrent() if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) return; - rct_window* window = window_find_by_class(WC_FOOTPATH); + rct_window* window = window_find_by_class(WindowClass::Footpath); if (window != nullptr) { window_footpath_keyboard_shortcut_demolish_current(); @@ -759,7 +759,7 @@ void ShortcutManager::RegisterDefaultShortcuts() RegisterShortcut(ShortcutId::InterfaceCancelConstruction, STR_SHORTCUT_CANCEL_CONSTRUCTION_MODE, "ESCAPE", []() { if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) { - auto window = window_find_by_class(WC_ERROR); + auto window = window_find_by_class(WindowClass::Error); if (window != nullptr) { window_close(*window); @@ -773,7 +773,7 @@ void ShortcutManager::RegisterDefaultShortcuts() RegisterShortcut(ShortcutId::InterfacePause, STR_SHORTCUT_PAUSE_GAME, "PAUSE", []() { if (!(gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_MANAGER))) { - auto window = window_find_by_class(WC_TOP_TOOLBAR); + auto window = window_find_by_class(WindowClass::TopToolbar); if (window != nullptr) { window->Invalidate(); @@ -808,7 +808,7 @@ void ShortcutManager::RegisterDefaultShortcuts() }); RegisterShortcut(ShortcutId::InterfaceSceneryPicker, STR_SHORTCUT_OPEN_SCENERY_PICKER, []() { ShortcutOpenSceneryPicker(); }); - RegisterShortcut(ShortcutId::InterfaceShowOptions, STR_SHORTCUT_SHOW_OPTIONS, []() { context_open_window(WC_OPTIONS); }); + RegisterShortcut(ShortcutId::InterfaceShowOptions, STR_SHORTCUT_SHOW_OPTIONS, []() { context_open_window(WindowClass::Options); }); RegisterShortcut(ShortcutId::InterfaceOpenTransparencyOptions, STR_SHORTCUT_OPEN_TRANSPARENCY_OPTIONS, "CTRL+T", []() { ShortcutOpenTransparencyWindow(); }); RegisterShortcut(ShortcutId::InterfaceOpenCheats, STR_SHORTCUT_OPEN_CHEATS_WINDOW, "CTRL+ALT+C", []() { ShortcutOpenCheatWindow(); }); RegisterShortcut(ShortcutId::InterfaceOpenMap, STR_SHORTCUT_SHOW_MAP, "TAB", []() { ShortcutShowMap(); }); @@ -828,13 +828,13 @@ void ShortcutManager::RegisterDefaultShortcuts() RegisterShortcut(ShortcutId::MultiplayerShow, STR_SHORTCUT_SHOW_MULTIPLAYER, []() { if (network_get_mode() != NETWORK_MODE_NONE) { - OpenWindow(WC_MULTIPLAYER); + OpenWindow(WindowClass::Multiplayer); } }); RegisterShortcut(ShortcutId::InterfaceOpenTileInspector, STR_SHORTCUT_OPEN_TILE_INSPECTOR, []() { if (gConfigInterface.toolbar_show_cheats) { - OpenWindow(WC_TILE_INSPECTOR); + OpenWindow(WindowClass::TileInspector); } }); @@ -864,7 +864,7 @@ void ShortcutManager::RegisterDefaultShortcuts() RegisterShortcut(ShortcutId::ViewToggleLandHeightMarkers, STR_SHORTCUT_HEIGHT_MARKS_ON_LAND_TOGGLE, "8", []() { ToggleViewFlag(VIEWPORT_FLAG_LAND_HEIGHTS); }); RegisterShortcut(ShortcutId::ViewToggleTrackHeightMarkers, STR_SHORTCUT_HEIGHT_MARKS_ON_RIDE_TRACKS_TOGGLE, "9", []() { ToggleViewFlag(VIEWPORT_FLAG_TRACK_HEIGHTS); }); RegisterShortcut(ShortcutId::ViewToggleFootpathHeightMarkers, STR_SHORTCUT_HEIGHT_MARKS_ON_PATHS_TOGGLE, "0", []() { ToggleViewFlag(VIEWPORT_FLAG_PATH_HEIGHTS); }); - RegisterShortcut(ShortcutId::ViewToggleCutAway, STR_SHORTCUT_VIEW_CLIPPING, []() { OpenWindow(WC_VIEW_CLIPPING); }); + RegisterShortcut(ShortcutId::ViewToggleCutAway, STR_SHORTCUT_VIEW_CLIPPING, []() { OpenWindow(WindowClass::ViewClipping); }); RegisterShortcut(ShortcutId::ViewToogleFootpathIssues, STR_SHORTCUT_HIGHLIGHT_PATH_ISSUES_TOGGLE, "I", []() { ToggleViewFlag(VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES); }); RegisterShortcut(ShortcutId::ViewToggleGridlines, STR_SHORTCUT_GRIDLINES_DISPLAY_TOGGLE, "7", []() { ToggleViewFlag(VIEWPORT_FLAG_GRIDLINES); }); @@ -906,14 +906,14 @@ void ShortcutManager::RegisterDefaultShortcuts() RegisterShortcut(ShortcutId::DebugTogglePaintDebugWindow, STR_SHORTCUT_DEBUG_PAINT_TOGGLE, []() { if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) { - auto window = window_find_by_class(WC_DEBUG_PAINT); + auto window = window_find_by_class(WindowClass::DebugPaint); if (window != nullptr) { window_close(*window); } else { - context_open_window(WC_DEBUG_PAINT); + context_open_window(WindowClass::DebugPaint); } } }); diff --git a/src/openrct2-ui/interface/InGameConsole.cpp b/src/openrct2-ui/interface/InGameConsole.cpp index ebf6852c20..01e8482037 100644 --- a/src/openrct2-ui/interface/InGameConsole.cpp +++ b/src/openrct2-ui/interface/InGameConsole.cpp @@ -274,7 +274,7 @@ void InGameConsole::Draw(rct_drawpixelinfo* dpi) const return; // Set font - uint8_t textColour = NOT_TRANSLUCENT(ThemeGetColour(WC_CONSOLE, 1)); + uint8_t textColour = NOT_TRANSLUCENT(ThemeGetColour(WindowClass::Console, 1)); const int32_t lineHeight = InGameConsoleGetLineHeight(); const int32_t maxLines = GetNumVisibleLines(); @@ -304,7 +304,7 @@ void InGameConsole::Draw(rct_drawpixelinfo* dpi) const FilterPaletteID::Palette51); // Paint background colour. - uint8_t backgroundColour = ThemeGetColour(WC_CONSOLE, 0); + uint8_t backgroundColour = ThemeGetColour(WindowClass::Console, 0); gfx_fill_rect_inset(dpi, { _consoleTopLeft, _consoleBottomRight }, backgroundColour, INSET_RECT_FLAG_FILL_NONE); gfx_fill_rect_inset( dpi, { _consoleTopLeft + ScreenCoordsXY{ 1, 1 }, _consoleBottomRight - ScreenCoordsXY{ 1, 1 } }, backgroundColour, diff --git a/src/openrct2-ui/interface/Theme.cpp b/src/openrct2-ui/interface/Theme.cpp index b5cc6e9b9c..aa8a3ab567 100644 --- a/src/openrct2-ui/interface/Theme.cpp +++ b/src/openrct2-ui/interface/Theme.cpp @@ -49,7 +49,7 @@ struct WindowTheme */ struct UIThemeWindowEntry { - rct_windowclass WindowClass; + WindowClass Class; WindowTheme Theme; json_t ToJson() const; @@ -74,9 +74,9 @@ public: { } - const UIThemeWindowEntry* GetEntry(rct_windowclass windowClass) const; + const UIThemeWindowEntry* GetEntry(WindowClass windowClass) const; void SetEntry(const UIThemeWindowEntry* entry); - void RemoveEntry(rct_windowclass windowClass); + void RemoveEntry(WindowClass windowClass); json_t ToJson() const; bool WriteToFile(const std::string& path) const; @@ -94,7 +94,7 @@ public: */ struct WindowThemeDesc { - rct_windowclass WindowClass; + ::WindowClass WindowClass; const utf8* WindowClassSZ; StringId WindowName; uint8_t NumColours; @@ -111,78 +111,76 @@ struct WindowThemeDesc #define COLOURS_5(c0, c1, c2, c3, c4) 5, { { (c0), (c1), (c2), (c3), (c4), 0 } } #define COLOURS_6(c0, c1, c2, c3, c4, c5) 6, { { (c0), (c1), (c2), (c3), (c4), (c5) } } -#define THEME_DEF_END { 0xFF, { 0, 0, 0, 0, 0, 0 } } +#define THEME_DEF_END { WindowClass::Null, { 0, 0, 0, 0, 0, 0 } } #define TWINDOW(window_class, window_name, window_string_id, theme) { window_class, window_name, window_string_id, theme } -#define THEME_WC(wc) wc, #wc - static constexpr const WindowThemeDesc WindowThemeDescriptors[] = { - // WindowClass, WindowClassSZ WindowName NumColours, DefaultTheme - { THEME_WC(WC_TOP_TOOLBAR), STR_THEMES_WINDOW_TOP_TOOLBAR, COLOURS_4(COLOUR_LIGHT_BLUE, COLOUR_DARK_GREEN, COLOUR_DARK_BROWN, COLOUR_GREY ) }, - { THEME_WC(WC_BOTTOM_TOOLBAR), STR_THEMES_WINDOW_BOTTOM_TOOLBAR, COLOURS_4(TRANSLUCENT(COLOUR_DARK_GREEN), TRANSLUCENT(COLOUR_DARK_GREEN), COLOUR_BLACK, COLOUR_BRIGHT_GREEN ) }, - { THEME_WC(WC_RIDE), STR_THEMES_WINDOW_RIDE, COLOURS_3(COLOUR_GREY, COLOUR_BORDEAUX_RED, COLOUR_SATURATED_GREEN ) }, - { THEME_WC(WC_RIDE_CONSTRUCTION), STR_THEMES_WINDOW_RIDE_CONSTRUCTION, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, - { THEME_WC(WC_RIDE_LIST), STR_THEMES_WINDOW_RIDE_LIST, COLOURS_3(COLOUR_GREY, COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED ) }, - { THEME_WC(WC_SAVE_PROMPT), STR_THEMES_WINDOW_SAVE_PROMPT, COLOURS_1(TRANSLUCENT(COLOUR_BORDEAUX_RED) ) }, - { THEME_WC(WC_CONSTRUCT_RIDE), STR_THEMES_WINDOW_CONSTRUCT_RIDE, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED ) }, - { THEME_WC(WC_DEMOLISH_RIDE_PROMPT), STR_THEMES_WINDOW_DEMOLISH_RIDE_PROMPT, COLOURS_1(TRANSLUCENT(COLOUR_BORDEAUX_RED) ) }, - { THEME_WC(WC_SCENERY), STR_THEMES_WINDOW_SCENERY, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_GREEN, COLOUR_DARK_GREEN ) }, - { THEME_WC(WC_SCENERY_SCATTER), STR_THEMES_WINDOW_SCENERY_SCATTER, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_GREEN, COLOUR_DARK_GREEN ) }, - { THEME_WC(WC_OPTIONS), STR_THEMES_WINDOW_OPTIONS, COLOURS_3(COLOUR_GREY, COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, - { THEME_WC(WC_FOOTPATH), STR_THEMES_WINDOW_FOOTPATH, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, - { THEME_WC(WC_LAND), STR_THEMES_WINDOW_LAND, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, - { THEME_WC(WC_WATER), STR_THEMES_WINDOW_WATER, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, - { THEME_WC(WC_PEEP), STR_THEMES_WINDOW_PEEP, COLOURS_3(COLOUR_GREY, COLOUR_OLIVE_GREEN, COLOUR_OLIVE_GREEN ) }, - { THEME_WC(WC_GUEST_LIST), STR_THEMES_WINDOW_GUEST_LIST, COLOURS_3(COLOUR_GREY, COLOUR_OLIVE_GREEN, COLOUR_OLIVE_GREEN ) }, - { THEME_WC(WC_STAFF_LIST), STR_THEMES_WINDOW_STAFF_LIST, COLOURS_3(COLOUR_GREY, COLOUR_LIGHT_PURPLE, COLOUR_LIGHT_PURPLE ) }, - { THEME_WC(WC_FIRE_PROMPT), STR_THEMES_WINDOW_FIRE_PROMPT, COLOURS_1(TRANSLUCENT(COLOUR_BORDEAUX_RED) ) }, - { THEME_WC(WC_PARK_INFORMATION), STR_THEMES_WINDOW_PARK_INFORMATION, COLOURS_3(COLOUR_GREY, COLOUR_DARK_YELLOW, COLOUR_DARK_YELLOW ) }, - { THEME_WC(WC_FINANCES), STR_THEMES_WINDOW_FINANCES, COLOURS_3(COLOUR_GREY, COLOUR_DARK_YELLOW, COLOUR_DARK_YELLOW ) }, - { THEME_WC(WC_TITLE_MENU), STR_THEMES_WINDOW_TITLE_MENU_BUTTONS, COLOURS_3(TRANSLUCENT(COLOUR_DARK_GREEN), TRANSLUCENT(COLOUR_DARK_GREEN), TRANSLUCENT(COLOUR_DARK_GREEN) ) }, - { THEME_WC(WC_TITLE_EXIT), STR_THEMES_WINDOW_TITLE_MENU_EXIT, COLOURS_3(TRANSLUCENT(COLOUR_DARK_GREEN), TRANSLUCENT(COLOUR_DARK_GREEN), TRANSLUCENT(COLOUR_DARK_GREEN) ) }, - { THEME_WC(WC_RECENT_NEWS), STR_THEMES_WINDOW_RECENT_NEWS, COLOURS_3(COLOUR_GREY, COLOUR_GREY, COLOUR_BLACK ) }, - { THEME_WC(WC_SCENARIO_SELECT), STR_THEMES_WINDOW_TITLE_MENU_SCENARIO_SELECTION, COLOURS_3(COLOUR_GREY, COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED ) }, - { THEME_WC(WC_TRACK_DESIGN_LIST), STR_THEMES_WINDOW_TRACK_DESIGN_LIST, COLOURS_3(COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED ) }, - { THEME_WC(WC_TRACK_DESIGN_PLACE), STR_THEMES_WINDOW_TRACK_DESIGN_PLACE, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, - { THEME_WC(WC_NEW_CAMPAIGN), STR_THEMES_WINDOW_NEW_CAMPAIGN, COLOURS_3(COLOUR_DARK_YELLOW, COLOUR_DARK_YELLOW, COLOUR_DARK_YELLOW ) }, - { THEME_WC(WC_KEYBOARD_SHORTCUT_LIST), STR_THEMES_WINDOW_KEYBOARD_SHORTCUT_LIST, COLOURS_3(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, - { THEME_WC(WC_CHANGE_KEYBOARD_SHORTCUT), STR_THEMES_WINDOW_CHANGE_KEYBOARD_SHORTCUT, COLOURS_3(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, - { THEME_WC(WC_MAP), STR_THEMES_WINDOW_MAP, COLOURS_2(COLOUR_DARK_GREEN, COLOUR_DARK_BROWN ) }, - { THEME_WC(WC_BANNER), STR_THEMES_WINDOW_BANNER, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, - { THEME_WC(WC_EDITOR_OBJECT_SELECTION), STR_THEMES_WINDOW_EDITOR_OBJECT_SELECTION, COLOURS_3(COLOUR_LIGHT_PURPLE, COLOUR_GREY, COLOUR_GREY ) }, - { THEME_WC(WC_EDITOR_INVENTION_LIST), STR_THEMES_WINDOW_EDITOR_INVENTION_LIST, COLOURS_3(COLOUR_LIGHT_PURPLE, COLOUR_GREY, COLOUR_GREY ) }, - { THEME_WC(WC_EDITOR_SCENARIO_OPTIONS), STR_THEMES_WINDOW_EDITOR_SCENARIO_OPTIONS, COLOURS_3(COLOUR_LIGHT_PURPLE, COLOUR_GREY, COLOUR_GREY ) }, - { THEME_WC(WC_EDITOR_OBJECTIVE_OPTIONS), STR_THEMES_WINDOW_EDTIOR_OBJECTIVE_OPTIONS, COLOURS_3(COLOUR_LIGHT_PURPLE, COLOUR_GREY, COLOUR_GREY ) }, - { THEME_WC(WC_MANAGE_TRACK_DESIGN), STR_THEMES_WINDOW_MANAGE_TRACK_DESIGN, COLOURS_3(COLOUR_GREY, COLOUR_GREY, COLOUR_GREY ) }, - { THEME_WC(WC_TRACK_DELETE_PROMPT), STR_THEMES_WINDOW_TRACK_DELETE_PROMPT, COLOURS_3(COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED ) }, - { THEME_WC(WC_INSTALL_TRACK), STR_THEMES_WINDOW_INSTALL_TRACK, COLOURS_3(COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED ) }, - { THEME_WC(WC_CLEAR_SCENERY), STR_THEMES_WINDOW_CLEAR_SCENERY, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, - { THEME_WC(WC_CHEATS), STR_CHEAT_TITLE, COLOURS_2(COLOUR_GREY, COLOUR_DARK_YELLOW ) }, - { THEME_WC(WC_RESEARCH), STR_THEMES_WINDOW_RESEARCH, COLOURS_3(COLOUR_GREY, COLOUR_DARK_YELLOW, COLOUR_DARK_YELLOW ) }, - { THEME_WC(WC_VIEWPORT), STR_THEMES_WINDOW_VIEWPORT, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, - { THEME_WC(WC_MAPGEN), STR_THEMES_WINDOW_MAPGEN, COLOURS_3(COLOUR_DARK_GREEN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, - { THEME_WC(WC_LOADSAVE), STR_THEMES_WINDOW_LOADSAVE, COLOURS_3(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, - { THEME_WC(WC_LOADSAVE_OVERWRITE_PROMPT), STR_THEMES_WINDOW_LOADSAVE_OVERWRITE_PROMPT, COLOURS_1(TRANSLUCENT(COLOUR_BORDEAUX_RED) ) }, - { THEME_WC(WC_TITLE_OPTIONS), STR_THEMES_WINDOW_TITLE_MENU_OPTIONS, COLOURS_3(TRANSLUCENT(COLOUR_DARK_GREEN), TRANSLUCENT(COLOUR_DARK_GREEN), TRANSLUCENT(COLOUR_DARK_GREEN) ) }, - { THEME_WC(WC_LAND_RIGHTS), STR_THEMES_WINDOW_LAND_RIGHTS, COLOURS_3(COLOUR_DARK_YELLOW, COLOUR_DARK_YELLOW, COLOUR_DARK_YELLOW ) }, - { THEME_WC(WC_THEMES), STR_THEMES_WINDOW_THEMES, COLOURS_3(COLOUR_GREY, COLOUR_DARK_GREEN, COLOUR_DARK_GREEN ) }, - { THEME_WC(WC_STAFF), STR_THEMES_WINDOW_STAFF, COLOURS_3(COLOUR_GREY, COLOUR_LIGHT_PURPLE, COLOUR_LIGHT_PURPLE ) }, - { THEME_WC(WC_EDITOR_TRACK_BOTTOM_TOOLBAR), STR_THEMES_WINDOW_BOTTOM_TOOLBAR_TRACK_EDITOR, COLOURS_3(TRANSLUCENT(COLOUR_LIGHT_BLUE), TRANSLUCENT(COLOUR_LIGHT_BLUE), TRANSLUCENT(COLOUR_LIGHT_BLUE) ) }, - { THEME_WC(WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR), STR_THEMES_WINDOW_BOTTOM_TOOLBAR_SCENARIO_EDITOR, COLOURS_3(TRANSLUCENT(COLOUR_LIGHT_BROWN), TRANSLUCENT(COLOUR_LIGHT_BROWN), TRANSLUCENT(COLOUR_MOSS_GREEN) ) }, - { THEME_WC(WC_TILE_INSPECTOR), STR_TILE_INSPECTOR_TITLE, COLOURS_2(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, - { THEME_WC(WC_VIEW_CLIPPING), STR_VIEW_CLIPPING_TITLE, COLOURS_1(COLOUR_DARK_GREEN ) }, - { THEME_WC(WC_PATROL_AREA), STR_SET_PATROL_AREA, COLOURS_3(COLOUR_LIGHT_PURPLE, COLOUR_LIGHT_PURPLE, COLOUR_LIGHT_PURPLE ) }, - { THEME_WC(WC_TRANSPARENCY), STR_TRANSPARENCY_OPTIONS_TITLE, COLOURS_3(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, - { THEME_WC(WC_ABOUT), STR_ABOUT, COLOURS_2(COLOUR_GREY, COLOUR_LIGHT_BLUE ) }, - { THEME_WC(WC_CHANGELOG), STR_CHANGELOG_TITLE, COLOURS_2(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, - { THEME_WC(WC_MULTIPLAYER), STR_MULTIPLAYER, COLOURS_3(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, - { THEME_WC(WC_PLAYER), STR_THEMES_WINDOW_PLAYER, COLOURS_3(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, - { THEME_WC(WC_NETWORK_STATUS), STR_THEMES_WINDOW_NETWORK_STATUS, COLOURS_1(COLOUR_LIGHT_BLUE ) }, - { THEME_WC(WC_SERVER_LIST), STR_SERVER_LIST, COLOURS_2(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, - { THEME_WC(WC_CHAT), STR_CHAT, COLOURS_1(TRANSLUCENT(COLOUR_GREY) ) }, - { THEME_WC(WC_CONSOLE), STR_CONSOLE, COLOURS_2(TRANSLUCENT(COLOUR_LIGHT_BLUE), COLOUR_WHITE ) }, + // WindowClass WindowClassSZ WindowName NumColours, DefaultTheme + { WindowClass::TopToolbar, "WC_TOP_TOOLBAR", STR_THEMES_WINDOW_TOP_TOOLBAR, COLOURS_4(COLOUR_LIGHT_BLUE, COLOUR_DARK_GREEN, COLOUR_DARK_BROWN, COLOUR_GREY ) }, + { WindowClass::BottomToolbar, "WC_BOTTOM_TOOLBAR", STR_THEMES_WINDOW_BOTTOM_TOOLBAR, COLOURS_4(TRANSLUCENT(COLOUR_DARK_GREEN), TRANSLUCENT(COLOUR_DARK_GREEN), COLOUR_BLACK, COLOUR_BRIGHT_GREEN ) }, + { WindowClass::Ride, "WC_RIDE", STR_THEMES_WINDOW_RIDE, COLOURS_3(COLOUR_GREY, COLOUR_BORDEAUX_RED, COLOUR_SATURATED_GREEN ) }, + { WindowClass::RideConstruction, "WC_RIDE_CONSTRUCTION", STR_THEMES_WINDOW_RIDE_CONSTRUCTION, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, + { WindowClass::RideList, "WC_RIDE_LIST", STR_THEMES_WINDOW_RIDE_LIST, COLOURS_3(COLOUR_GREY, COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED ) }, + { WindowClass::SavePrompt, "WC_SAVE_PROMPT", STR_THEMES_WINDOW_SAVE_PROMPT, COLOURS_1(TRANSLUCENT(COLOUR_BORDEAUX_RED) ) }, + { WindowClass::ConstructRide, "WC_CONSTRUCT_RIDE", STR_THEMES_WINDOW_CONSTRUCT_RIDE, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED ) }, + { WindowClass::DemolishRidePrompt, "WC_DEMOLISH_RIDE_PROMPT", STR_THEMES_WINDOW_DEMOLISH_RIDE_PROMPT, COLOURS_1(TRANSLUCENT(COLOUR_BORDEAUX_RED) ) }, + { WindowClass::Scenery, "WC_SCENERY", STR_THEMES_WINDOW_SCENERY, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_GREEN, COLOUR_DARK_GREEN ) }, + { WindowClass::SceneryScatter, "WC_SCENERY_SCATTER", STR_THEMES_WINDOW_SCENERY_SCATTER, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_GREEN, COLOUR_DARK_GREEN ) }, + { WindowClass::Options, "WC_OPTIONS", STR_THEMES_WINDOW_OPTIONS, COLOURS_3(COLOUR_GREY, COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, + { WindowClass::Footpath, "WC_FOOTPATH", STR_THEMES_WINDOW_FOOTPATH, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, + { WindowClass::Land, "WC_LAND", STR_THEMES_WINDOW_LAND, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, + { WindowClass::Water, "WC_WATER", STR_THEMES_WINDOW_WATER, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, + { WindowClass::Peep, "WC_PEEP", STR_THEMES_WINDOW_PEEP, COLOURS_3(COLOUR_GREY, COLOUR_OLIVE_GREEN, COLOUR_OLIVE_GREEN ) }, + { WindowClass::GuestList, "WC_GUEST_LIST", STR_THEMES_WINDOW_GUEST_LIST, COLOURS_3(COLOUR_GREY, COLOUR_OLIVE_GREEN, COLOUR_OLIVE_GREEN ) }, + { WindowClass::StaffList, "WC_STAFF_LIST", STR_THEMES_WINDOW_STAFF_LIST, COLOURS_3(COLOUR_GREY, COLOUR_LIGHT_PURPLE, COLOUR_LIGHT_PURPLE ) }, + { WindowClass::FirePrompt, "WC_FIRE_PROMPT", STR_THEMES_WINDOW_FIRE_PROMPT, COLOURS_1(TRANSLUCENT(COLOUR_BORDEAUX_RED) ) }, + { WindowClass::ParkInformation, "WC_PARK_INFORMATION", STR_THEMES_WINDOW_PARK_INFORMATION, COLOURS_3(COLOUR_GREY, COLOUR_DARK_YELLOW, COLOUR_DARK_YELLOW ) }, + { WindowClass::Finances, "WC_FINANCES", STR_THEMES_WINDOW_FINANCES, COLOURS_3(COLOUR_GREY, COLOUR_DARK_YELLOW, COLOUR_DARK_YELLOW ) }, + { WindowClass::TitleMenu, "WC_TITLE_MENU", STR_THEMES_WINDOW_TITLE_MENU_BUTTONS, COLOURS_3(TRANSLUCENT(COLOUR_DARK_GREEN), TRANSLUCENT(COLOUR_DARK_GREEN), TRANSLUCENT(COLOUR_DARK_GREEN) ) }, + { WindowClass::TitleExit, "WC_TITLE_EXIT", STR_THEMES_WINDOW_TITLE_MENU_EXIT, COLOURS_3(TRANSLUCENT(COLOUR_DARK_GREEN), TRANSLUCENT(COLOUR_DARK_GREEN), TRANSLUCENT(COLOUR_DARK_GREEN) ) }, + { WindowClass::RecentNews, "WC_RECENT_NEWS", STR_THEMES_WINDOW_RECENT_NEWS, COLOURS_3(COLOUR_GREY, COLOUR_GREY, COLOUR_BLACK ) }, + { WindowClass::ScenarioSelect, "WC_SCENARIO_SELECT", STR_THEMES_WINDOW_TITLE_MENU_SCENARIO_SELECTION, COLOURS_3(COLOUR_GREY, COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED ) }, + { WindowClass::TrackDesignList, "WC_TRACK_DESIGN_LIST", STR_THEMES_WINDOW_TRACK_DESIGN_LIST, COLOURS_3(COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED ) }, + { WindowClass::TrackDesignPlace, "WC_TRACK_DESIGN_PLACE", STR_THEMES_WINDOW_TRACK_DESIGN_PLACE, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, + { WindowClass::NewCampaign, "WC_NEW_CAMPAIGN", STR_THEMES_WINDOW_NEW_CAMPAIGN, COLOURS_3(COLOUR_DARK_YELLOW, COLOUR_DARK_YELLOW, COLOUR_DARK_YELLOW ) }, + { WindowClass::KeyboardShortcutList, "WC_KEYBOARD_SHORTCUT_LIST", STR_THEMES_WINDOW_KEYBOARD_SHORTCUT_LIST, COLOURS_3(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, + { WindowClass::ChangeKeyboardShortcut, "WC_CHANGE_KEYBOARD_SHORTCUT", STR_THEMES_WINDOW_CHANGE_KEYBOARD_SHORTCUT, COLOURS_3(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, + { WindowClass::Map, "WC_MAP", STR_THEMES_WINDOW_MAP, COLOURS_2(COLOUR_DARK_GREEN, COLOUR_DARK_BROWN ) }, + { WindowClass::Banner, "WC_BANNER", STR_THEMES_WINDOW_BANNER, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, + { WindowClass::EditorObjectSelection, "WC_EDITOR_OBJECT_SELECTION", STR_THEMES_WINDOW_EDITOR_OBJECT_SELECTION, COLOURS_3(COLOUR_LIGHT_PURPLE, COLOUR_GREY, COLOUR_GREY ) }, + { WindowClass::EditorInventionList, "WC_EDITOR_INVENTION_LIST", STR_THEMES_WINDOW_EDITOR_INVENTION_LIST, COLOURS_3(COLOUR_LIGHT_PURPLE, COLOUR_GREY, COLOUR_GREY ) }, + { WindowClass::EditorScenarioOptions, "WC_EDITOR_SCENARIO_OPTIONS", STR_THEMES_WINDOW_EDITOR_SCENARIO_OPTIONS, COLOURS_3(COLOUR_LIGHT_PURPLE, COLOUR_GREY, COLOUR_GREY ) }, + { WindowClass::EditorObjectiveOptions, "WC_EDITOR_OBJECTIVE_OPTIONS", STR_THEMES_WINDOW_EDTIOR_OBJECTIVE_OPTIONS, COLOURS_3(COLOUR_LIGHT_PURPLE, COLOUR_GREY, COLOUR_GREY ) }, + { WindowClass::ManageTrackDesign, "WC_MANAGE_TRACK_DESIGN", STR_THEMES_WINDOW_MANAGE_TRACK_DESIGN, COLOURS_3(COLOUR_GREY, COLOUR_GREY, COLOUR_GREY ) }, + { WindowClass::TrackDeletePrompt, "WC_TRACK_DELETE_PROMPT", STR_THEMES_WINDOW_TRACK_DELETE_PROMPT, COLOURS_3(COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED ) }, + { WindowClass::InstallTrack, "WC_INSTALL_TRACK", STR_THEMES_WINDOW_INSTALL_TRACK, COLOURS_3(COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED ) }, + { WindowClass::ClearScenery, "WC_CLEAR_SCENERY", STR_THEMES_WINDOW_CLEAR_SCENERY, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, + { WindowClass::Cheats, "WC_CHEATS", STR_CHEAT_TITLE, COLOURS_2(COLOUR_GREY, COLOUR_DARK_YELLOW ) }, + { WindowClass::Research, "WC_RESEARCH", STR_THEMES_WINDOW_RESEARCH, COLOURS_3(COLOUR_GREY, COLOUR_DARK_YELLOW, COLOUR_DARK_YELLOW ) }, + { WindowClass::Viewport, "WC_VIEWPORT", STR_THEMES_WINDOW_VIEWPORT, COLOURS_3(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, + { WindowClass::Mapgen, "WC_MAPGEN", STR_THEMES_WINDOW_MAPGEN, COLOURS_3(COLOUR_DARK_GREEN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN ) }, + { WindowClass::Loadsave, "WC_LOADSAVE", STR_THEMES_WINDOW_LOADSAVE, COLOURS_3(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, + { WindowClass::LoadsaveOverwritePrompt, "WC_LOADSAVE_OVERWRITE_PROMPT", STR_THEMES_WINDOW_LOADSAVE_OVERWRITE_PROMPT, COLOURS_1(TRANSLUCENT(COLOUR_BORDEAUX_RED) ) }, + { WindowClass::TitleOptions, "WC_TITLE_OPTIONS", STR_THEMES_WINDOW_TITLE_MENU_OPTIONS, COLOURS_3(TRANSLUCENT(COLOUR_DARK_GREEN), TRANSLUCENT(COLOUR_DARK_GREEN), TRANSLUCENT(COLOUR_DARK_GREEN) ) }, + { WindowClass::LandRights, "WC_LAND_RIGHTS", STR_THEMES_WINDOW_LAND_RIGHTS, COLOURS_3(COLOUR_DARK_YELLOW, COLOUR_DARK_YELLOW, COLOUR_DARK_YELLOW ) }, + { WindowClass::Themes, "WC_THEMES", STR_THEMES_WINDOW_THEMES, COLOURS_3(COLOUR_GREY, COLOUR_DARK_GREEN, COLOUR_DARK_GREEN ) }, + { WindowClass::Staff, "WC_STAFF", STR_THEMES_WINDOW_STAFF, COLOURS_3(COLOUR_GREY, COLOUR_LIGHT_PURPLE, COLOUR_LIGHT_PURPLE ) }, + { WindowClass::EditorTrackBottomToolbar, "WC_EDITOR_TRACK_BOTTOM_TOOLBAR", STR_THEMES_WINDOW_BOTTOM_TOOLBAR_TRACK_EDITOR, COLOURS_3(TRANSLUCENT(COLOUR_LIGHT_BLUE), TRANSLUCENT(COLOUR_LIGHT_BLUE), TRANSLUCENT(COLOUR_LIGHT_BLUE) ) }, + { WindowClass::EditorScenarioBottomToolbar, "WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR", STR_THEMES_WINDOW_BOTTOM_TOOLBAR_SCENARIO_EDITOR, COLOURS_3(TRANSLUCENT(COLOUR_LIGHT_BROWN), TRANSLUCENT(COLOUR_LIGHT_BROWN), TRANSLUCENT(COLOUR_MOSS_GREEN) ) }, + { WindowClass::TileInspector, "WC_TILE_INSPECTOR", STR_TILE_INSPECTOR_TITLE, COLOURS_2(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, + { WindowClass::ViewClipping, "WC_VIEW_CLIPPING", STR_VIEW_CLIPPING_TITLE, COLOURS_1(COLOUR_DARK_GREEN ) }, + { WindowClass::PatrolArea, "WC_PATROL_AREA", STR_SET_PATROL_AREA, COLOURS_3(COLOUR_LIGHT_PURPLE, COLOUR_LIGHT_PURPLE, COLOUR_LIGHT_PURPLE ) }, + { WindowClass::Transparency, "WC_TRANSPARENCY", STR_TRANSPARENCY_OPTIONS_TITLE, COLOURS_3(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, + { WindowClass::About, "WC_ABOUT", STR_ABOUT, COLOURS_2(COLOUR_GREY, COLOUR_LIGHT_BLUE ) }, + { WindowClass::Changelog, "WC_CHANGELOG", STR_CHANGELOG_TITLE, COLOURS_2(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, + { WindowClass::Multiplayer, "WC_MULTIPLAYER", STR_MULTIPLAYER, COLOURS_3(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, + { WindowClass::Player, "WC_PLAYER", STR_THEMES_WINDOW_PLAYER, COLOURS_3(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, + { WindowClass::NetworkStatus, "WC_NETWORK_STATUS", STR_THEMES_WINDOW_NETWORK_STATUS, COLOURS_1(COLOUR_LIGHT_BLUE ) }, + { WindowClass::ServerList, "WC_SERVER_LIST", STR_SERVER_LIST, COLOURS_2(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, + { WindowClass::Chat, "WC_CHAT", STR_CHAT, COLOURS_1(TRANSLUCENT(COLOUR_GREY) ) }, + { WindowClass::Console, "WC_CONSOLE", STR_CONSOLE, COLOURS_2(TRANSLUCENT(COLOUR_LIGHT_BLUE), COLOUR_WHITE ) }, }; #pragma endregion @@ -193,27 +191,27 @@ static constexpr const WindowThemeDesc WindowThemeDescriptors[] = static constexpr const UIThemeWindowEntry PredefinedThemeRCT1_Entries[] = { - { WC_TOP_TOOLBAR, COLOURS_RCT1(COLOUR_GREY, COLOUR_GREY, COLOUR_GREY, COLOUR_GREY, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_BOTTOM_TOOLBAR, COLOURS_RCT1(TRANSLUCENT(COLOUR_GREY), TRANSLUCENT(COLOUR_GREY), COLOUR_BLACK, COLOUR_YELLOW, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_RIDE, COLOURS_RCT1(COLOUR_BORDEAUX_RED, COLOUR_GREY, COLOUR_SATURATED_GREEN, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_RIDE_LIST, COLOURS_RCT1(COLOUR_BORDEAUX_RED, COLOUR_GREY, COLOUR_GREY, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_CONSTRUCT_RIDE, COLOURS_RCT1(COLOUR_BORDEAUX_RED, COLOUR_GREY, COLOUR_GREY, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_PEEP, COLOURS_RCT1(COLOUR_LIGHT_BROWN, COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_GUEST_LIST, COLOURS_RCT1(COLOUR_LIGHT_BROWN, COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_STAFF_LIST, COLOURS_RCT1(COLOUR_DARK_GREEN, COLOUR_LIGHT_PURPLE, COLOUR_LIGHT_PURPLE, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_FINANCES, COLOURS_RCT1(COLOUR_LIGHT_PURPLE, COLOUR_GREY, COLOUR_GREY, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_TITLE_MENU, COLOURS_RCT1(TRANSLUCENT(COLOUR_GREY), TRANSLUCENT(COLOUR_GREY), TRANSLUCENT(COLOUR_GREY), COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_TITLE_EXIT, COLOURS_RCT1(TRANSLUCENT(COLOUR_GREY), TRANSLUCENT(COLOUR_GREY), TRANSLUCENT(COLOUR_GREY), COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_NEW_CAMPAIGN, COLOURS_RCT1(COLOUR_LIGHT_PURPLE, COLOUR_LIGHT_PURPLE, COLOUR_GREY, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_TITLE_OPTIONS, COLOURS_RCT1(TRANSLUCENT(COLOUR_GREY), TRANSLUCENT(COLOUR_GREY), TRANSLUCENT(COLOUR_GREY), COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_STAFF, COLOURS_RCT1(COLOUR_DARK_GREEN, COLOUR_LIGHT_PURPLE, COLOUR_LIGHT_PURPLE, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_OPTIONS, COLOURS_RCT1(COLOUR_GREY, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_KEYBOARD_SHORTCUT_LIST, COLOURS_RCT1(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_CHANGE_KEYBOARD_SHORTCUT, COLOURS_RCT1(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_TRACK_DESIGN_LIST, COLOURS_RCT1(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_MAP, COLOURS_RCT1(COLOUR_DARK_BROWN, COLOUR_GREY, COLOUR_GREY, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_ABOUT, COLOURS_RCT1(COLOUR_GREY, COLOUR_DARK_BROWN, COLOUR_WHITE, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, - { WC_CHANGELOG, COLOURS_RCT1(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_WHITE, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::TopToolbar, COLOURS_RCT1(COLOUR_GREY, COLOUR_GREY, COLOUR_GREY, COLOUR_GREY, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::BottomToolbar, COLOURS_RCT1(TRANSLUCENT(COLOUR_GREY), TRANSLUCENT(COLOUR_GREY), COLOUR_BLACK, COLOUR_YELLOW, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::Ride, COLOURS_RCT1(COLOUR_BORDEAUX_RED, COLOUR_GREY, COLOUR_SATURATED_GREEN, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::RideList, COLOURS_RCT1(COLOUR_BORDEAUX_RED, COLOUR_GREY, COLOUR_GREY, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::ConstructRide, COLOURS_RCT1(COLOUR_BORDEAUX_RED, COLOUR_GREY, COLOUR_GREY, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::Peep, COLOURS_RCT1(COLOUR_LIGHT_BROWN, COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::GuestList, COLOURS_RCT1(COLOUR_LIGHT_BROWN, COLOUR_BORDEAUX_RED, COLOUR_BORDEAUX_RED, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::StaffList, COLOURS_RCT1(COLOUR_DARK_GREEN, COLOUR_LIGHT_PURPLE, COLOUR_LIGHT_PURPLE, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::Finances, COLOURS_RCT1(COLOUR_LIGHT_PURPLE, COLOUR_GREY, COLOUR_GREY, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::TitleMenu, COLOURS_RCT1(TRANSLUCENT(COLOUR_GREY), TRANSLUCENT(COLOUR_GREY), TRANSLUCENT(COLOUR_GREY), COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::TitleExit, COLOURS_RCT1(TRANSLUCENT(COLOUR_GREY), TRANSLUCENT(COLOUR_GREY), TRANSLUCENT(COLOUR_GREY), COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::NewCampaign, COLOURS_RCT1(COLOUR_LIGHT_PURPLE, COLOUR_LIGHT_PURPLE, COLOUR_GREY, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::TitleOptions, COLOURS_RCT1(TRANSLUCENT(COLOUR_GREY), TRANSLUCENT(COLOUR_GREY), TRANSLUCENT(COLOUR_GREY), COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::Staff, COLOURS_RCT1(COLOUR_DARK_GREEN, COLOUR_LIGHT_PURPLE, COLOUR_LIGHT_PURPLE, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::Options, COLOURS_RCT1(COLOUR_GREY, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::KeyboardShortcutList, COLOURS_RCT1(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::ChangeKeyboardShortcut, COLOURS_RCT1(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::TrackDesignList, COLOURS_RCT1(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::Map, COLOURS_RCT1(COLOUR_DARK_BROWN, COLOUR_GREY, COLOUR_GREY, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::About, COLOURS_RCT1(COLOUR_GREY, COLOUR_DARK_BROWN, COLOUR_WHITE, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, + { WindowClass::Changelog, COLOURS_RCT1(COLOUR_DARK_BROWN, COLOUR_DARK_BROWN, COLOUR_WHITE, COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK) }, THEME_DEF_END, }; // clang-format on @@ -242,7 +240,7 @@ static constexpr const PredefinedTheme PredefinedThemes[] = { #pragma endregion -static const WindowThemeDesc* GetWindowThemeDescriptor(rct_windowclass windowClass) +static const WindowThemeDesc* GetWindowThemeDescriptor(WindowClass windowClass) { for (const auto& desc : WindowThemeDescriptors) { @@ -275,7 +273,7 @@ static void ThrowThemeLoadException() json_t UIThemeWindowEntry::ToJson() const { - const WindowThemeDesc* wtDesc = GetWindowThemeDescriptor(WindowClass); + const WindowThemeDesc* wtDesc = GetWindowThemeDescriptor(Class); if (wtDesc == nullptr) { return nullptr; @@ -307,7 +305,7 @@ UIThemeWindowEntry UIThemeWindowEntry::FromJson(const WindowThemeDesc* wtDesc, j } UIThemeWindowEntry result{}; - result.WindowClass = wtDesc->WindowClass; + result.Class = wtDesc->WindowClass; result.Theme = wtDesc->DefaultTheme; // result.Theme.Colours only has 6 values @@ -325,11 +323,11 @@ UIThemeWindowEntry UIThemeWindowEntry::FromJson(const WindowThemeDesc* wtDesc, j #pragma region UITheme -const UIThemeWindowEntry* UITheme::GetEntry(rct_windowclass windowClass) const +const UIThemeWindowEntry* UITheme::GetEntry(WindowClass windowClass) const { for (const auto& entry : Entries) { - if (entry.WindowClass == windowClass) + if (entry.Class == windowClass) { return &entry; } @@ -342,7 +340,7 @@ void UITheme::SetEntry(const UIThemeWindowEntry* newEntry) // Try to replace existing entry for (auto& entry : Entries) { - if (entry.WindowClass == newEntry->WindowClass) + if (entry.Class == newEntry->Class) { entry = *newEntry; return; @@ -352,13 +350,13 @@ void UITheme::SetEntry(const UIThemeWindowEntry* newEntry) Entries.push_back(*newEntry); } -void UITheme::RemoveEntry(rct_windowclass windowClass) +void UITheme::RemoveEntry(WindowClass windowClass) { // Remove existing entry for (size_t i = 0; i < Entries.size(); i++) { UIThemeWindowEntry* entry = &Entries[i]; - if (entry->WindowClass == windowClass) + if (entry->Class == windowClass) { Entries.erase(Entries.begin() + i); break; @@ -372,7 +370,7 @@ json_t UITheme::ToJson() const json_t jsonEntries; for (const UIThemeWindowEntry& entry : Entries) { - const WindowThemeDesc* wtDesc = GetWindowThemeDescriptor(entry.WindowClass); + const WindowThemeDesc* wtDesc = GetWindowThemeDescriptor(entry.Class); if (wtDesc == nullptr) { return nullptr; @@ -487,7 +485,7 @@ UITheme UITheme::CreatePredefined(const std::string& name, const UIThemeWindowEn theme.Flags = flags | UITHEME_FLAG_PREDEFINED; size_t numEntries = 0; - for (const UIThemeWindowEntry* entry = entries; entry->WindowClass != 255; entry++) + for (const UIThemeWindowEntry* entry = entries; entry->Class != WindowClass::Null; entry++) { numEntries++; } @@ -728,7 +726,7 @@ size_t ThemeGetIndexForName(const utf8* name) return SIZE_MAX; } -uint8_t ThemeGetColour(rct_windowclass wc, uint8_t index) +uint8_t ThemeGetColour(WindowClass wc, uint8_t index) { const UIThemeWindowEntry* entry = ThemeManager::CurrentTheme->GetEntry(wc); if (entry == nullptr) @@ -744,10 +742,10 @@ uint8_t ThemeGetColour(rct_windowclass wc, uint8_t index) return entry->Theme.Colours[index]; } -void ThemeSetColour(rct_windowclass wc, uint8_t index, colour_t colour) +void ThemeSetColour(WindowClass wc, uint8_t index, colour_t colour) { UIThemeWindowEntry entry{}; - entry.WindowClass = wc; + entry.Class = wc; auto currentEntry = const_cast(ThemeManager::CurrentTheme->GetEntry(wc)); if (currentEntry != nullptr) @@ -849,7 +847,7 @@ void ThemeManagerInitialise() ThemeManager::Initialise(); } -uint8_t ThemeDescGetNumColours(rct_windowclass wc) +uint8_t ThemeDescGetNumColours(WindowClass wc) { const WindowThemeDesc* desc = GetWindowThemeDescriptor(wc); if (desc == nullptr) @@ -859,7 +857,7 @@ uint8_t ThemeDescGetNumColours(rct_windowclass wc) return desc->NumColours; } -StringId ThemeDescGetName(rct_windowclass wc) +StringId ThemeDescGetName(WindowClass wc) { const WindowThemeDesc* desc = GetWindowThemeDescriptor(wc); if (desc == nullptr) @@ -879,7 +877,7 @@ void ColourSchemeUpdate(rct_window* window) ColourSchemeUpdateByClass(window, window->classification); } -void ColourSchemeUpdateByClass(rct_window* window, rct_windowclass classification) +void ColourSchemeUpdateByClass(rct_window* window, WindowClass classification) { const WindowTheme* windowTheme; const UIThemeWindowEntry* entry = ThemeManager::CurrentTheme->GetEntry(classification); diff --git a/src/openrct2-ui/interface/Theme.h b/src/openrct2-ui/interface/Theme.h index e17025c4bb..6c022fc816 100644 --- a/src/openrct2-ui/interface/Theme.h +++ b/src/openrct2-ui/interface/Theme.h @@ -23,7 +23,7 @@ enum void ColourSchemeUpdate(rct_window* window); void ColourSchemeUpdateAll(); -void ColourSchemeUpdateByClass(rct_window* window, rct_windowclass classification); +void ColourSchemeUpdateByClass(rct_window* window, WindowClass classification); void ThemeManagerInitialise(); void ThemeManagerLoadAvailableThemes(); @@ -35,8 +35,8 @@ size_t ThemeManagerGetAvailableThemeIndex(); void ThemeManagerSetActiveAvailableTheme(size_t index); size_t ThemeGetIndexForName(const utf8* name); -colour_t ThemeGetColour(rct_windowclass wc, uint8_t index); -void ThemeSetColour(rct_windowclass wc, uint8_t index, colour_t colour); +colour_t ThemeGetColour(WindowClass wc, uint8_t index); +void ThemeSetColour(WindowClass wc, uint8_t index, colour_t colour); uint8_t ThemeGetFlags(); void ThemeSetFlags(uint8_t flags); void ThemeSave(); @@ -44,5 +44,5 @@ void ThemeRename(const utf8* name); void ThemeDuplicate(const utf8* name); void ThemeDelete(); -uint8_t ThemeDescGetNumColours(rct_windowclass wc); -StringId ThemeDescGetName(rct_windowclass wc); +uint8_t ThemeDescGetNumColours(WindowClass wc); +StringId ThemeDescGetName(WindowClass wc); diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index 34f4367804..9f169ce56e 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -192,7 +192,7 @@ bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords) case EntityType::Guest: case EntityType::Staff: { - auto intent = Intent(WC_PEEP); + auto intent = Intent(WindowClass::Peep); intent.putExtra(INTENT_EXTRA_PEEP, entity); context_open_intent(&intent); break; @@ -231,7 +231,7 @@ bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords) return true; } case ViewportInteractionItem::ParkEntrance: - context_open_window(WC_PARK_INFORMATION); + context_open_window(WindowClass::ParkInformation); return true; default: return false; @@ -446,7 +446,8 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor if (!(input_test_flag(INPUT_FLAG_6)) || !(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) { - if (window_find_by_class(WC_RIDE_CONSTRUCTION) == nullptr && window_find_by_class(WC_FOOTPATH) == nullptr) + if (window_find_by_class(WindowClass::RideConstruction) == nullptr + && window_find_by_class(WindowClass::Footpath) == nullptr) { info.SpriteType = ViewportInteractionItem::None; return info; @@ -617,7 +618,7 @@ static void ViewportInteractionRemoveFootpath(TileElement* tileElement, const Co auto z = tileElement->GetBaseZ(); - w = window_find_by_class(WC_FOOTPATH); + w = window_find_by_class(WindowClass::Footpath); if (w != nullptr) footpath_provisional_update(); diff --git a/src/openrct2-ui/interface/Widget.cpp b/src/openrct2-ui/interface/Widget.cpp index d72903517e..41057a40f4 100644 --- a/src/openrct2-ui/interface/Widget.cpp +++ b/src/openrct2-ui/interface/Widget.cpp @@ -847,14 +847,14 @@ static void WidgetDrawImage(rct_drawpixelinfo* dpi, rct_window& w, rct_widgetind bool WidgetIsDisabled(const rct_window& w, rct_widgetindex widgetIndex) { - if (w.classification == WC_CUSTOM) + if (w.classification == WindowClass::Custom) return w.widgets[widgetIndex].flags & WIDGET_FLAGS::IS_DISABLED; return (w.disabled_widgets & (1LL << widgetIndex)) != 0; } bool WidgetIsHoldable(const rct_window& w, rct_widgetindex widgetIndex) { - if (w.classification == WC_CUSTOM) + if (w.classification == WindowClass::Custom) return w.widgets[widgetIndex].flags & WIDGET_FLAGS::IS_HOLDABLE; return (w.hold_down_widgets & (1LL << widgetIndex)) != 0; } @@ -866,7 +866,7 @@ bool WidgetIsVisible(const rct_window& w, rct_widgetindex widgetIndex) bool WidgetIsPressed(const rct_window& w, rct_widgetindex widgetIndex) { - if (w.classification == WC_CUSTOM) + if (w.classification == WindowClass::Custom) { if (w.widgets[widgetIndex].flags & WIDGET_FLAGS::IS_PRESSED) { diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index 66822abd06..e48c2c1568 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -201,7 +201,7 @@ static ScreenCoordsXY GetCentrePositionForNewWindow(int32_t width, int32_t heigh } rct_window* WindowCreate( - std::unique_ptr&& wp, rct_windowclass cls, ScreenCoordsXY pos, int32_t width, int32_t height, uint32_t flags) + std::unique_ptr&& wp, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height, uint32_t flags) { if (flags & WF_AUTO_POSITION) { @@ -288,7 +288,7 @@ rct_window* WindowCreate( } rct_window* WindowCreate( - const ScreenCoordsXY& pos, int32_t width, int32_t height, rct_window_event_list* event_handlers, rct_windowclass cls, + const ScreenCoordsXY& pos, int32_t width, int32_t height, rct_window_event_list* event_handlers, WindowClass cls, uint32_t flags) { auto w = std::make_unique(); @@ -297,14 +297,14 @@ rct_window* WindowCreate( } rct_window* WindowCreateAutoPos( - int32_t width, int32_t height, rct_window_event_list* event_handlers, rct_windowclass cls, uint32_t flags) + int32_t width, int32_t height, rct_window_event_list* event_handlers, WindowClass cls, uint32_t flags) { auto pos = GetAutoPositionForNewWindow(width, height); return WindowCreate(pos, width, height, event_handlers, cls, flags); } rct_window* WindowCreateCentred( - int32_t width, int32_t height, rct_window_event_list* event_handlers, rct_windowclass cls, uint32_t flags) + int32_t width, int32_t height, rct_window_event_list* event_handlers, WindowClass cls, uint32_t flags) { auto pos = GetCentrePositionForNewWindow(width, height); return WindowCreate(pos, width, height, event_handlers, cls, flags); @@ -530,7 +530,7 @@ void WindowAllWheelInput() if (w != nullptr) { // Check if main window - if (w->classification == WC_MAIN_WINDOW || w->classification == WC_VIEWPORT) + if (w->classification == WindowClass::MainWindow || w->classification == WindowClass::Viewport) { WindowViewportWheelInput(*w, relative_wheel); return; diff --git a/src/openrct2-ui/scripting/CustomMenu.cpp b/src/openrct2-ui/scripting/CustomMenu.cpp index c3e0eaf0ee..73e20c0a02 100644 --- a/src/openrct2-ui/scripting/CustomMenu.cpp +++ b/src/openrct2-ui/scripting/CustomMenu.cpp @@ -261,7 +261,7 @@ namespace OpenRCT2::Scripting customTool.onUp = dukValue["onUp"]; customTool.onFinish = dukValue["onFinish"]; - auto toolbarWindow = window_find_by_class(WC_TOP_TOOLBAR); + auto toolbarWindow = window_find_by_class(WindowClass::TopToolbar); if (toolbarWindow != nullptr) { // Use a widget that does not exist on top toolbar but also make sure it isn't -1 as that diff --git a/src/openrct2-ui/scripting/CustomWindow.cpp b/src/openrct2-ui/scripting/CustomWindow.cpp index 685235f37f..688076e085 100644 --- a/src/openrct2-ui/scripting/CustomWindow.cpp +++ b/src/openrct2-ui/scripting/CustomWindow.cpp @@ -1119,7 +1119,7 @@ namespace OpenRCT2::Ui::Windows static rct_windownumber GetNewWindowNumber() { auto result = _nextWindowNumber++; - while (window_find_by_number(WC_CUSTOM, result) != nullptr) + while (window_find_by_number(WindowClass::Custom, result) != nullptr) { result++; } @@ -1136,11 +1136,12 @@ namespace OpenRCT2::Ui::Windows CustomWindow* window{}; if (desc.X && desc.Y) { - window = WindowCreate(WC_CUSTOM, { *desc.X, *desc.Y }, desc.Width, desc.Height, windowFlags); + window = WindowCreate( + WindowClass::Custom, { *desc.X, *desc.Y }, desc.Width, desc.Height, windowFlags); } else { - window = WindowCreate(WC_CUSTOM, desc.Width, desc.Height, windowFlags); + window = WindowCreate(WindowClass::Custom, desc.Width, desc.Height, windowFlags); } if (window != nullptr) { @@ -1335,7 +1336,7 @@ namespace OpenRCT2::Ui::Windows { for (const auto& w : g_window_list) { - if (w->classification == WC_CUSTOM) + if (w->classification == WindowClass::Custom) { const auto& customInfo = GetInfo(w.get()); if (customInfo.Desc.Classification == classification) @@ -1441,7 +1442,7 @@ namespace OpenRCT2::Ui::Windows std::vector> customWindows; for (const auto& window : g_window_list) { - if (window->classification == WC_CUSTOM) + if (window->classification == WindowClass::Custom) { auto customWindow = reinterpret_cast(window.get()); auto customInfo = reinterpret_cast(customWindow->custom_info); diff --git a/src/openrct2-ui/scripting/ScUi.hpp b/src/openrct2-ui/scripting/ScUi.hpp index 17050d24cc..54a2d57032 100644 --- a/src/openrct2-ui/scripting/ScUi.hpp +++ b/src/openrct2-ui/scripting/ScUi.hpp @@ -133,7 +133,7 @@ namespace OpenRCT2::Scripting std::shared_ptr mainViewport_get() const { - return std::make_shared(WC_MAIN_WINDOW); + return std::make_shared(WindowClass::MainWindow); } std::shared_ptr tileSelection_get() const @@ -176,7 +176,7 @@ namespace OpenRCT2::Scripting void closeWindows(std::string classification, DukValue id) { auto cls = GetClassification(classification); - if (cls != WC_NULL) + if (cls != WindowClass::Null) { if (id.type() == DukValue::Type::NUMBER) { @@ -383,9 +383,9 @@ namespace OpenRCT2::Scripting } private: - rct_windowclass GetClassification(const std::string& key) const + WindowClass GetClassification(const std::string& key) const { - return WC_NULL; + return WindowClass::Null; } DukValue GetScenarioFile(std::string_view path) diff --git a/src/openrct2-ui/scripting/ScViewport.hpp b/src/openrct2-ui/scripting/ScViewport.hpp index c89b300b24..2dfcdc31be 100644 --- a/src/openrct2-ui/scripting/ScViewport.hpp +++ b/src/openrct2-ui/scripting/ScViewport.hpp @@ -26,11 +26,11 @@ namespace OpenRCT2::Scripting class ScViewport { private: - rct_windowclass _class{}; + WindowClass _class{}; rct_windownumber _number{}; public: - ScViewport(rct_windowclass c, rct_windownumber n = 0) + ScViewport(WindowClass c, rct_windownumber n = 0) : _class(c) , _number(n) { @@ -244,7 +244,7 @@ namespace OpenRCT2::Scripting private: rct_window* GetWindow() const { - if (_class == WC_MAIN_WINDOW) + if (_class == WindowClass::MainWindow) return window_get_main(); return window_find_by_number(_class, _number); diff --git a/src/openrct2-ui/scripting/ScWidget.hpp b/src/openrct2-ui/scripting/ScWidget.hpp index 8f2b025d06..30e8a76916 100644 --- a/src/openrct2-ui/scripting/ScWidget.hpp +++ b/src/openrct2-ui/scripting/ScWidget.hpp @@ -29,12 +29,12 @@ namespace OpenRCT2::Scripting class ScWidget { protected: - rct_windowclass _class{}; + WindowClass _class{}; rct_windownumber _number{}; rct_widgetindex _widgetIndex{}; public: - ScWidget(rct_windowclass c, rct_windownumber n, rct_widgetindex widgetIndex) + ScWidget(WindowClass c, rct_windownumber n, rct_widgetindex widgetIndex) : _class(c) , _number(n) , _widgetIndex(widgetIndex) @@ -384,7 +384,7 @@ namespace OpenRCT2::Scripting protected: rct_window* GetWindow() const { - if (_class == WC_MAIN_WINDOW) + if (_class == WindowClass::MainWindow) return window_get_main(); return window_find_by_number(_class, _number); @@ -405,7 +405,7 @@ namespace OpenRCT2::Scripting auto w = GetWindow(); if (w != nullptr) { - return w->classification == WC_CUSTOM; + return w->classification == WindowClass::Custom; } return false; } @@ -419,7 +419,7 @@ namespace OpenRCT2::Scripting class ScButtonWidget : public ScWidget { public: - ScButtonWidget(rct_windowclass c, rct_windownumber n, rct_widgetindex widgetIndex) + ScButtonWidget(WindowClass c, rct_windownumber n, rct_widgetindex widgetIndex) : ScWidget(c, n, widgetIndex) { } @@ -497,7 +497,7 @@ namespace OpenRCT2::Scripting class ScCheckBoxWidget : public ScWidget { public: - ScCheckBoxWidget(rct_windowclass c, rct_windownumber n, rct_widgetindex widgetIndex) + ScCheckBoxWidget(WindowClass c, rct_windownumber n, rct_widgetindex widgetIndex) : ScWidget(c, n, widgetIndex) { } @@ -532,7 +532,7 @@ namespace OpenRCT2::Scripting class ScColourPickerWidget : public ScWidget { public: - ScColourPickerWidget(rct_windowclass c, rct_windownumber n, rct_widgetindex widgetIndex) + ScColourPickerWidget(WindowClass c, rct_windownumber n, rct_widgetindex widgetIndex) : ScWidget(c, n, widgetIndex) { } @@ -567,7 +567,7 @@ namespace OpenRCT2::Scripting class ScDropdownWidget : public ScWidget { public: - ScDropdownWidget(rct_windowclass c, rct_windownumber n, rct_widgetindex widgetIndex) + ScDropdownWidget(WindowClass c, rct_windownumber n, rct_widgetindex widgetIndex) : ScWidget(c, n, widgetIndex) { } @@ -622,7 +622,7 @@ namespace OpenRCT2::Scripting class ScGroupBoxWidget : public ScWidget { public: - ScGroupBoxWidget(rct_windowclass c, rct_windownumber n, rct_widgetindex widgetIndex) + ScGroupBoxWidget(WindowClass c, rct_windownumber n, rct_widgetindex widgetIndex) : ScWidget(c, n, widgetIndex) { } @@ -637,7 +637,7 @@ namespace OpenRCT2::Scripting class ScLabelWidget : public ScWidget { public: - ScLabelWidget(rct_windowclass c, rct_windownumber n, rct_widgetindex widgetIndex) + ScLabelWidget(WindowClass c, rct_windownumber n, rct_widgetindex widgetIndex) : ScWidget(c, n, widgetIndex) { } @@ -679,7 +679,7 @@ namespace OpenRCT2::Scripting class ScListViewWidget : public ScWidget { public: - ScListViewWidget(rct_windowclass c, rct_windownumber n, rct_widgetindex widgetIndex) + ScListViewWidget(WindowClass c, rct_windownumber n, rct_widgetindex widgetIndex) : ScWidget(c, n, widgetIndex) { } @@ -870,7 +870,7 @@ namespace OpenRCT2::Scripting class ScSpinnerWidget : public ScWidget { public: - ScSpinnerWidget(rct_windowclass c, rct_windownumber n, rct_widgetindex widgetIndex) + ScSpinnerWidget(WindowClass c, rct_windownumber n, rct_widgetindex widgetIndex) : ScWidget(c, n, widgetIndex) { } @@ -885,7 +885,7 @@ namespace OpenRCT2::Scripting class ScTextBoxWidget : public ScWidget { public: - ScTextBoxWidget(rct_windowclass c, rct_windownumber n, rct_widgetindex widgetIndex) + ScTextBoxWidget(WindowClass c, rct_windownumber n, rct_widgetindex widgetIndex) : ScWidget(c, n, widgetIndex) { } @@ -920,7 +920,7 @@ namespace OpenRCT2::Scripting class ScViewportWidget : public ScWidget { public: - ScViewportWidget(rct_windowclass c, rct_windownumber n, rct_widgetindex widgetIndex) + ScViewportWidget(WindowClass c, rct_windownumber n, rct_widgetindex widgetIndex) : ScWidget(c, n, widgetIndex) { } diff --git a/src/openrct2-ui/scripting/ScWindow.hpp b/src/openrct2-ui/scripting/ScWindow.hpp index b79a861d26..8cf473be0b 100644 --- a/src/openrct2-ui/scripting/ScWindow.hpp +++ b/src/openrct2-ui/scripting/ScWindow.hpp @@ -26,7 +26,7 @@ namespace OpenRCT2::Scripting class ScWindow { private: - rct_windowclass _class; + WindowClass _class; rct_windownumber _number; public: @@ -35,7 +35,7 @@ namespace OpenRCT2::Scripting { } - ScWindow(rct_windowclass c, rct_windownumber n) + ScWindow(WindowClass c, rct_windownumber n) : _class(c) , _number(n) { @@ -253,7 +253,7 @@ namespace OpenRCT2::Scripting std::string title_get() const { auto w = GetWindow(); - if (w != nullptr && w->classification == WC_CUSTOM) + if (w != nullptr && w->classification == WindowClass::Custom) { return GetWindowTitle(w); } @@ -262,7 +262,7 @@ namespace OpenRCT2::Scripting void title_set(std::string value) { auto w = GetWindow(); - if (w != nullptr && w->classification == WC_CUSTOM) + if (w != nullptr && w->classification == WindowClass::Custom) { UpdateWindowTitle(w, value); } @@ -271,7 +271,7 @@ namespace OpenRCT2::Scripting int32_t tabIndex_get() const { auto w = GetWindow(); - if (w != nullptr && w->classification == WC_CUSTOM) + if (w != nullptr && w->classification == WindowClass::Custom) { return w->page; } diff --git a/src/openrct2-ui/title/TitleSequencePlayer.cpp b/src/openrct2-ui/title/TitleSequencePlayer.cpp index c787687515..e22bddd310 100644 --- a/src/openrct2-ui/title/TitleSequencePlayer.cpp +++ b/src/openrct2-ui/title/TitleSequencePlayer.cpp @@ -352,26 +352,26 @@ namespace OpenRCT2::Title void CloseParkSpecificWindows() { - window_close_by_class(WC_CONSTRUCT_RIDE); - window_close_by_class(WC_DEMOLISH_RIDE_PROMPT); - window_close_by_class(WC_EDITOR_INVENTION_LIST_DRAG); - window_close_by_class(WC_EDITOR_INVENTION_LIST); - window_close_by_class(WC_EDITOR_OBJECT_SELECTION); - window_close_by_class(WC_EDITOR_OBJECTIVE_OPTIONS); - window_close_by_class(WC_EDITOR_SCENARIO_OPTIONS); - window_close_by_class(WC_FINANCES); - window_close_by_class(WC_FIRE_PROMPT); - window_close_by_class(WC_GUEST_LIST); - window_close_by_class(WC_INSTALL_TRACK); - window_close_by_class(WC_PEEP); - window_close_by_class(WC_RIDE); - window_close_by_class(WC_RIDE_CONSTRUCTION); - window_close_by_class(WC_RIDE_LIST); - window_close_by_class(WC_SCENERY); - window_close_by_class(WC_STAFF); - window_close_by_class(WC_TRACK_DELETE_PROMPT); - window_close_by_class(WC_TRACK_DESIGN_LIST); - window_close_by_class(WC_TRACK_DESIGN_PLACE); + window_close_by_class(WindowClass::ConstructRide); + window_close_by_class(WindowClass::DemolishRidePrompt); + window_close_by_class(WindowClass::EditorInventionListDrag); + window_close_by_class(WindowClass::EditorInventionList); + window_close_by_class(WindowClass::EditorObjectSelection); + window_close_by_class(WindowClass::EditorObjectiveOptions); + window_close_by_class(WindowClass::EditorScenarioOptions); + window_close_by_class(WindowClass::Finances); + window_close_by_class(WindowClass::FirePrompt); + window_close_by_class(WindowClass::GuestList); + window_close_by_class(WindowClass::InstallTrack); + window_close_by_class(WindowClass::Peep); + window_close_by_class(WindowClass::Ride); + window_close_by_class(WindowClass::RideConstruction); + window_close_by_class(WindowClass::RideList); + window_close_by_class(WindowClass::Scenery); + window_close_by_class(WindowClass::Staff); + window_close_by_class(WindowClass::TrackDeletePrompt); + window_close_by_class(WindowClass::TrackDesignList); + window_close_by_class(WindowClass::TrackDesignPlace); } void PrepareParkForPlayback() diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp index 7469dd486f..ab594a9b98 100644 --- a/src/openrct2-ui/windows/About.cpp +++ b/src/openrct2-ui/windows/About.cpp @@ -113,7 +113,7 @@ public: OpenRCT2::GetContext()->GetUiContext()->OpenURL("https://discord.gg/ZXZd8D8"); break; case WIDX_CHANGELOG: - context_open_window(WC_CHANGELOG); + context_open_window(WindowClass::Changelog); break; case WIDX_NEW_VERSION: context_open_window_view(WV_NEW_VERSION_INFO); @@ -249,5 +249,5 @@ private: */ rct_window* WindowAboutOpen() { - return WindowFocusOrCreate(WC_ABOUT, WW, WH, WF_CENTRE_SCREEN); + return WindowFocusOrCreate(WindowClass::About, WW, WH, WF_CENTRE_SCREEN); } diff --git a/src/openrct2-ui/windows/Banner.cpp b/src/openrct2-ui/windows/Banner.cpp index ccd9e7b231..d9d97863b2 100644 --- a/src/openrct2-ui/windows/Banner.cpp +++ b/src/openrct2-ui/windows/Banner.cpp @@ -300,12 +300,12 @@ public: */ rct_window* WindowBannerOpen(rct_windownumber number) { - auto w = static_cast(window_bring_to_front_by_number(WC_BANNER, number)); + auto w = static_cast(window_bring_to_front_by_number(WindowClass::Banner, number)); if (w != nullptr) return w; - w = WindowCreate(WC_BANNER, WW, WH, 0); + w = WindowCreate(WindowClass::Banner, WW, WH, 0); if (w != nullptr) w->Initialise(number); diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index 0778749563..511e3ad392 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -309,7 +309,7 @@ private: rct_window* WindowChangelogOpen(int personality) { - auto* window = window_bring_to_front_by_class(WC_CHANGELOG); + auto* window = window_bring_to_front_by_class(WindowClass::Changelog); if (window == nullptr) { // Create a new centred window @@ -319,7 +319,7 @@ rct_window* WindowChangelogOpen(int personality) int32_t height = (screenHeight * 4) / 5; auto pos = ChangelogWindow::GetCentrePositionForNewWindow(width, height); - auto* newWindow = WindowCreate(WC_CHANGELOG, pos, width, height, WF_RESIZABLE); + auto* newWindow = WindowCreate(WindowClass::Changelog, pos, width, height, WF_RESIZABLE); newWindow->SetPersonality(personality); return newWindow; } diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index ea53d8ec33..4d65486201 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -743,14 +743,14 @@ private: { auto setDateAction = ParkSetDateAction(_yearSpinnerValue, _monthSpinnerValue, _daySpinnerValue); GameActions::Execute(&setDateAction); - window_invalidate_by_class(WC_BOTTOM_TOOLBAR); + window_invalidate_by_class(WindowClass::BottomToolbar); break; } case WIDX_DATE_RESET: { auto setDateAction = ParkSetDateAction(1, 1, 1); GameActions::Execute(&setDateAction); - window_invalidate_by_class(WC_BOTTOM_TOOLBAR); + window_invalidate_by_class(WindowClass::BottomToolbar); InvalidateWidget(WIDX_YEAR_BOX); InvalidateWidget(WIDX_MONTH_BOX); InvalidateWidget(WIDX_DAY_BOX); @@ -1103,10 +1103,10 @@ private: rct_window* WindowCheatsOpen() { - auto* window = window_bring_to_front_by_class(WC_CHEATS); + auto* window = window_bring_to_front_by_class(WindowClass::Cheats); if (window == nullptr) { - window = WindowCreate(WC_CHEATS, ScreenCoordsXY(32, 32), WW, WH); + window = WindowCreate(WindowClass::Cheats, ScreenCoordsXY(32, 32), WW, WH); } return window; } diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp index 27698420fd..942bba3538 100644 --- a/src/openrct2-ui/windows/ClearScenery.cpp +++ b/src/openrct2-ui/windows/ClearScenery.cpp @@ -199,12 +199,12 @@ public: rct_window* WindowClearSceneryOpen() { - auto* w = static_cast(window_bring_to_front_by_class(WC_CLEAR_SCENERY)); + auto* w = static_cast(window_bring_to_front_by_class(WindowClass::ClearScenery)); if (w != nullptr) return w; - w = WindowCreate(WC_CLEAR_SCENERY, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0); + w = WindowCreate(WindowClass::ClearScenery, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0); if (w != nullptr) return w; diff --git a/src/openrct2-ui/windows/CustomCurrency.cpp b/src/openrct2-ui/windows/CustomCurrency.cpp index 1371b290d1..ab99d5a136 100644 --- a/src/openrct2-ui/windows/CustomCurrency.cpp +++ b/src/openrct2-ui/windows/CustomCurrency.cpp @@ -225,5 +225,5 @@ public: rct_window* CustomCurrencyWindowOpen() { - return WindowFocusOrCreate(WC_CUSTOM_CURRENCY_CONFIG, WW, WH, WF_CENTRE_SCREEN); + return WindowFocusOrCreate(WindowClass::CustomCurrencyConfig, WW, WH, WF_CENTRE_SCREEN); } diff --git a/src/openrct2-ui/windows/DebugPaint.cpp b/src/openrct2-ui/windows/DebugPaint.cpp index f8e3ec332b..a1b31ccc12 100644 --- a/src/openrct2-ui/windows/DebugPaint.cpp +++ b/src/openrct2-ui/windows/DebugPaint.cpp @@ -146,7 +146,7 @@ public: rct_window* WindowDebugPaintOpen() { auto* window = WindowFocusOrCreate( - WC_DEBUG_PAINT, { 16, context_get_height() - 16 - 33 - WINDOW_HEIGHT }, WINDOW_WIDTH, WINDOW_HEIGHT, + WindowClass::DebugPaint, { 16, context_get_height() - 16 - 33 - WINDOW_HEIGHT }, WINDOW_WIDTH, WINDOW_HEIGHT, WF_STICK_TO_FRONT | WF_TRANSPARENT); return window; diff --git a/src/openrct2-ui/windows/DemolishRidePrompt.cpp b/src/openrct2-ui/windows/DemolishRidePrompt.cpp index 4d94051a52..93170f4ea5 100644 --- a/src/openrct2-ui/windows/DemolishRidePrompt.cpp +++ b/src/openrct2-ui/windows/DemolishRidePrompt.cpp @@ -97,16 +97,17 @@ rct_window* WindowRideDemolishPromptOpen(Ride* ride) rct_window* w; DemolishRidePromptWindow* newWindow; - w = window_find_by_class(WC_DEMOLISH_RIDE_PROMPT); + w = window_find_by_class(WindowClass::DemolishRidePrompt); if (w != nullptr) { auto windowPos = w->windowPos; window_close(*w); - newWindow = WindowCreate(WC_DEMOLISH_RIDE_PROMPT, windowPos, WW, WH, WF_TRANSPARENT); + newWindow = WindowCreate(WindowClass::DemolishRidePrompt, windowPos, WW, WH, WF_TRANSPARENT); } else { - newWindow = WindowCreate(WC_DEMOLISH_RIDE_PROMPT, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT); + newWindow = WindowCreate( + WindowClass::DemolishRidePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT); } newWindow->SetRide(ride); diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index 37ee17c0ec..a9962c3c84 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -384,7 +384,7 @@ void WindowDropdownShowTextCustomWidth( WindowDropdownClose(); // Create the window (width/height position are set later) - auto* w = WindowCreate(WC_DROPDOWN, width, custom_height, WF_STICK_TO_FRONT); + auto* w = WindowCreate(WindowClass::Dropdown, width, custom_height, WF_STICK_TO_FRONT); if (w != nullptr) { w->SetTextItems(screenPos, extray, colour, custom_height, flags, num_items, width); @@ -417,7 +417,7 @@ void WindowDropdownShowImage( WindowDropdownClose(); // Create the window (width/height position are set later) - auto* w = WindowCreate(WC_DROPDOWN, itemWidth, itemHeight, WF_STICK_TO_FRONT); + auto* w = WindowCreate(WindowClass::Dropdown, itemWidth, itemHeight, WF_STICK_TO_FRONT); if (w != nullptr) { w->SetImageItems({ x, y }, extray, colour, numItems, itemWidth, itemHeight, numColumns); @@ -426,7 +426,7 @@ void WindowDropdownShowImage( void WindowDropdownClose() { - window_close_by_class(WC_DROPDOWN); + window_close_by_class(WindowClass::Dropdown); } /** @@ -435,7 +435,7 @@ void WindowDropdownClose() */ int32_t DropdownIndexFromPoint(const ScreenCoordsXY& loc, rct_window* w) { - if (w->classification == WC_DROPDOWN) + if (w->classification == WindowClass::Dropdown) { auto* ddWnd = static_cast(w); return ddWnd->GetIndexFromPoint(loc); diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index de3cb5f1b3..01107358aa 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -68,7 +68,8 @@ public: { ColourSchemeUpdateByClass( this, - (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR : WC_EDITOR_TRACK_BOTTOM_TOOLBAR); + (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowClass::EditorScenarioBottomToolbar + : WindowClass::EditorTrackBottomToolbar); uint16_t screenWidth = context_get_width(); widgets[WIDX_NEXT_IMAGE].left = screenWidth - 200; @@ -158,14 +159,14 @@ private: set_all_scenery_items_invented(); scenery_set_default_placement_configuration(); gEditorStep = EditorStep::LandscapeEditor; - context_open_window(WC_MAP); + context_open_window(WindowClass::Map); gfx_invalidate_screen(); } void JumpBackToInventionListSetUp() const { window_close_all(); - context_open_window(WC_EDITOR_INVENTION_LIST); + context_open_window(WindowClass::EditorInventionList); gEditorStep = EditorStep::InventionsListSetUp; gfx_invalidate_screen(); } @@ -173,7 +174,7 @@ private: void JumpBackToOptionsSelection() const { window_close_all(); - context_open_window(WC_EDITOR_SCENARIO_OPTIONS); + context_open_window(WindowClass::EditorScenarioOptions); gEditorStep = EditorStep::OptionsSelection; gfx_invalidate_screen(); } @@ -185,12 +186,12 @@ private: auto [missingObjectType, errorString] = Editor::CheckObjectSelection(); if (missingObjectType == ObjectType::None) { - window_close_by_class(WC_EDITOR_OBJECT_SELECTION); + window_close_by_class(WindowClass::EditorObjectSelection); return true; } context_show_error(STR_INVALID_SELECTION_OF_OBJECTS, errorString, {}); - w = window_find_by_class(WC_EDITOR_OBJECT_SELECTION); + w = window_find_by_class(WindowClass::EditorObjectSelection); if (w != nullptr) { // Click tab with missing object @@ -207,11 +208,11 @@ private: finish_object_selection(); if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) { - context_open_window(WC_CONSTRUCT_RIDE); + context_open_window(WindowClass::ConstructRide); } else { - context_open_window(WC_MAP); + context_open_window(WindowClass::Map); } } @@ -221,7 +222,7 @@ private: if (checksPassed) { window_close_all(); - context_open_window(WC_EDITOR_INVENTION_LIST); + context_open_window(WindowClass::EditorInventionList); gEditorStep = EditorStep::InventionsListSetUp; } else @@ -235,7 +236,7 @@ private: void JumpForwardToOptionsSelection() const { window_close_all(); - context_open_window(WC_EDITOR_SCENARIO_OPTIONS); + context_open_window(WindowClass::EditorScenarioOptions); gEditorStep = EditorStep::OptionsSelection; gfx_invalidate_screen(); } @@ -243,7 +244,7 @@ private: void JumpForwardToObjectiveSelection() const { window_close_all(); - context_open_window(WC_EDITOR_OBJECTIVE_OPTIONS); + context_open_window(WindowClass::EditorObjectiveOptions); gEditorStep = EditorStep::ObjectiveSelection; gfx_invalidate_screen(); } @@ -259,7 +260,7 @@ private: } window_close_all(); - auto intent = Intent(WC_LOADSAVE); + auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO); intent.putExtra(INTENT_EXTRA_PATH, gScenarioName); context_open_intent(&intent); @@ -298,7 +299,8 @@ private: windowPos + ScreenCoordsXY{ widgets[WIDX_PREVIOUS_IMAGE].left + 6, widgets[WIDX_PREVIOUS_IMAGE].top + 6 }); colour_t textColour = NOT_TRANSLUCENT(colours[1]); - if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_PREVIOUS_STEP_BUTTON) + if (gHoverWidget.window_classification == WindowClass::BottomToolbar + && gHoverWidget.widget_index == WIDX_PREVIOUS_STEP_BUTTON) { textColour = COLOUR_WHITE; } @@ -335,7 +337,8 @@ private: colour_t textColour = NOT_TRANSLUCENT(colours[1]); - if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_NEXT_STEP_BUTTON) + if (gHoverWidget.window_classification == WindowClass::BottomToolbar + && gHoverWidget.widget_index == WIDX_NEXT_STEP_BUTTON) { textColour = COLOUR_WHITE; } @@ -390,7 +393,7 @@ private: rct_window* WindowEditorBottomToolbarOpen() { auto* window = WindowCreate( - WC_BOTTOM_TOOLBAR, ScreenCoordsXY(0, context_get_height() - 32), context_get_width(), 32, + WindowClass::BottomToolbar, ScreenCoordsXY(0, context_get_height() - 32), context_get_width(), 32, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND); return window; diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index 1be94fea55..90b2b69c62 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -577,7 +577,7 @@ private: rct_window* WindowEditorInventionsListOpen() { return WindowFocusOrCreate( - WC_EDITOR_INVENTION_LIST, WW, WH, WF_NO_SCROLLING | WF_RESIZABLE | WF_CENTRE_SCREEN); + WindowClass::EditorInventionList, WW, WH, WF_NO_SCROLLING | WF_RESIZABLE | WF_CENTRE_SCREEN); } #pragma endregion @@ -596,7 +596,7 @@ public: CursorID OnCursor(const rct_widgetindex widx, const ScreenCoordsXY& screenCoords, const CursorID defaultCursor) override { - auto* inventionListWindow = static_cast(window_find_by_class(WC_EDITOR_INVENTION_LIST)); + auto* inventionListWindow = static_cast(window_find_by_class(WindowClass::EditorInventionList)); if (inventionListWindow != nullptr) { auto res = inventionListWindow->GetResearchItemAt(screenCoords); @@ -613,7 +613,7 @@ public: void OnMoved(const ScreenCoordsXY& screenCoords) override { - auto* inventionListWindow = static_cast(window_find_by_class(WC_EDITOR_INVENTION_LIST)); + auto* inventionListWindow = static_cast(window_find_by_class(WindowClass::EditorInventionList)); if (inventionListWindow == nullptr) { Close(); @@ -632,7 +632,7 @@ public: inventionListWindow->MoveResearchItem(_draggedItem, res->research, res->isInvented); } - window_invalidate_by_class(WC_EDITOR_INVENTION_LIST); + window_invalidate_by_class(WindowClass::EditorInventionList); Close(); } @@ -683,9 +683,9 @@ public: static void WindowEditorInventionsListDragOpen(ResearchItem* researchItem) { - window_close_by_class(WC_EDITOR_INVENTION_LIST_DRAG); + window_close_by_class(WindowClass::EditorInventionListDrag); auto* wnd = WindowCreate( - WC_EDITOR_INVENTION_LIST_DRAG, 10, 14, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_SNAPPING); + WindowClass::EditorInventionListDrag, 10, 14, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_SNAPPING); if (wnd != nullptr) { wnd->Init(*researchItem); @@ -694,7 +694,7 @@ static void WindowEditorInventionsListDragOpen(ResearchItem* researchItem) static const ResearchItem* WindowEditorInventionsListDragGetItem() { - auto* wnd = static_cast(window_find_by_class(WC_EDITOR_INVENTION_LIST_DRAG)); + auto* wnd = static_cast(window_find_by_class(WindowClass::EditorInventionListDrag)); if (wnd == nullptr) { return nullptr; diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 9f53600bde..f4f7e3be78 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -410,7 +410,7 @@ public: } Invalidate(); - auto intent = Intent(WC_LOADSAVE); + auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_TRACK); context_open_intent(&intent); break; @@ -576,7 +576,7 @@ public: { // Used for in-game object selection cheat to prevent crashing the game // when windows attempt to draw objects that don't exist any more - window_close_all_except_class(WC_EDITOR_OBJECT_SELECTION); + window_close_all_except_class(WindowClass::EditorObjectSelection); int32_t selected_object = GetObjectFromObjectSelection(GetSelectedObjectType(), screenCoords.y); if (selected_object == -1) @@ -1502,7 +1502,7 @@ private: rct_ride_entry* ride_entry = get_ride_entry(entry_index); auto rideType = ride_entry_get_first_non_null_ride_type(ride_entry); - auto intent = Intent(WC_TRACK_DESIGN_LIST); + auto intent = Intent(WindowClass::TrackDesignList); intent.putExtra(INTENT_EXTRA_RIDE_TYPE, rideType); intent.putExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, entry_index); context_open_intent(&intent); @@ -1516,7 +1516,7 @@ private: rct_window* WindowEditorObjectSelectionOpen() { return WindowFocusOrCreate( - WC_EDITOR_OBJECT_SELECTION, 755, 400, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN); + WindowClass::EditorObjectSelection, 755, 400, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN); } static bool VisibleListSortRideName(const ObjectListItem& a, const ObjectListItem& b) diff --git a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp index 88c1058942..40eee93f7d 100644 --- a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp +++ b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp @@ -198,11 +198,11 @@ rct_window* WindowEditorObjectiveOptionsOpen() { rct_window* w; - w = window_bring_to_front_by_class(WC_EDITOR_OBJECTIVE_OPTIONS); + w = window_bring_to_front_by_class(WindowClass::EditorObjectiveOptions); if (w != nullptr) return w; - w = WindowCreateCentred(450, 228, &window_objective_options_main_events, WC_EDITOR_OBJECTIVE_OPTIONS, WF_10); + w = WindowCreateCentred(450, 228, &window_objective_options_main_events, WindowClass::EditorObjectiveOptions, WF_10); w->widgets = window_editor_objective_options_main_widgets; w->pressed_widgets = 0; w->hold_down_widgets = window_editor_objective_options_page_hold_down_widgets[WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN]; diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp index 8d1d8ec54d..1201b3fd73 100644 --- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp +++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp @@ -281,12 +281,12 @@ rct_window* WindowEditorScenarioOptionsOpen() { rct_window* w; - w = window_bring_to_front_by_class(WC_EDITOR_SCENARIO_OPTIONS); + w = window_bring_to_front_by_class(WindowClass::EditorScenarioOptions); if (w != nullptr) return w; w = WindowCreateCentred( - 280, 148, window_editor_scenario_options_page_events[0], WC_EDITOR_SCENARIO_OPTIONS, WF_NO_SCROLLING); + 280, 148, window_editor_scenario_options_page_events[0], WindowClass::EditorScenarioOptions, WF_NO_SCROLLING); w->widgets = window_editor_scenario_options_widgets[0]; w->hold_down_widgets = window_editor_scenario_options_page_hold_down_widgets[0]; WindowInitScrollWidgets(*w); @@ -542,8 +542,8 @@ static void WindowEditorScenarioOptionsFinancialMousedown(rct_window* w, rct_wid if (gScreenFlags == SCREEN_FLAGS_PLAYING) { - window_invalidate_by_class(WC_FINANCES); - window_invalidate_by_class(WC_BOTTOM_TOOLBAR); + window_invalidate_by_class(WindowClass::Finances); + window_invalidate_by_class(WindowClass::BottomToolbar); } } diff --git a/src/openrct2-ui/windows/Error.cpp b/src/openrct2-ui/windows/Error.cpp index ffe65a7ccd..4780fbd79a 100644 --- a/src/openrct2-ui/windows/Error.cpp +++ b/src/openrct2-ui/windows/Error.cpp @@ -60,7 +60,7 @@ rct_window* WindowErrorOpen(std::string_view title, std::string_view message) int32_t numLines, width, height, maxY; rct_window* w; - window_close_by_class(WC_ERROR); + window_close_by_class(WindowClass::Error); auto& buffer = _window_error_text; buffer.assign("{BLACK}"); buffer.append(title); @@ -109,7 +109,8 @@ rct_window* WindowErrorOpen(std::string_view title, std::string_view message) } w = WindowCreate( - windowPosition, width, height, &window_error_events, WC_ERROR, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_RESIZABLE); + windowPosition, width, height, &window_error_events, WindowClass::Error, + WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_RESIZABLE); w->widgets = window_error_widgets; w->error.var_480 = 0; if (!gDisableErrorWindowSound) diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index 3ac818118c..cdb1468e1c 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -1014,12 +1014,12 @@ public: rct_window* WindowFinancesOpen() { - return WindowFocusOrCreate(WC_FINANCES, WW_OTHER_TABS, WH_SUMMARY, WF_10); + return WindowFocusOrCreate(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10); } rct_window* WindowFinancesResearchOpen() { - auto* window = WindowFocusOrCreate(WC_FINANCES, WW_OTHER_TABS, WH_SUMMARY, WF_10); + auto* window = WindowFocusOrCreate(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10); if (window != nullptr) window->SetPage(WINDOW_FINANCES_PAGE_RESEARCH); diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index dc1ab89590..f7acedeab3 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -199,13 +199,13 @@ rct_window* WindowFootpathOpen() } // Check if window is already open - rct_window* window = window_bring_to_front_by_class(WC_FOOTPATH); + rct_window* window = window_bring_to_front_by_class(WindowClass::Footpath); if (window != nullptr) { return window; } - window = WindowCreate(ScreenCoordsXY(0, 29), WW, WH, &window_footpath_events, WC_FOOTPATH, 0); + window = WindowCreate(ScreenCoordsXY(0, 29), WW, WH, &window_footpath_events, WindowClass::Footpath, 0); window->widgets = window_footpath_widgets; WindowInitScrollWidgets(*window); @@ -232,7 +232,7 @@ static void WindowFootpathClose(rct_window* w) viewport_set_visibility(0); map_invalidate_map_selection_tiles(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::TopToolbar); hide_gridlines(); } @@ -519,7 +519,7 @@ static void WindowFootpathUpdate(rct_window* w) { window_close(*w); } - else if (gCurrentToolWidget.window_classification != WC_FOOTPATH) + else if (gCurrentToolWidget.window_classification != WindowClass::Footpath) { window_close(*w); } @@ -534,7 +534,7 @@ static void WindowFootpathUpdate(rct_window* w) { window_close(*w); } - else if (gCurrentToolWidget.window_classification != WC_FOOTPATH) + else if (gCurrentToolWidget.window_classification != WindowClass::Footpath) { window_close(*w); } @@ -917,7 +917,7 @@ static void WindowFootpathSetProvisionalPathAtPoint(const ScreenCoordsXY& screen auto constructFlags = FootpathCreateConstructFlags(pathType); _window_footpath_cost = footpath_provisional_set( pathType, gFootpathSelection.Railings, { info.Loc, z }, slope, constructFlags); - window_invalidate_by_class(WC_FOOTPATH); + window_invalidate_by_class(WindowClass::Footpath); } } @@ -1270,7 +1270,7 @@ static void WindowFootpathRemove() */ static void WindowFootpathSetEnabledAndPressedWidgets() { - rct_window* w = window_find_by_class(WC_FOOTPATH); + rct_window* w = window_find_by_class(WindowClass::Footpath); if (w == nullptr) { return; @@ -1380,7 +1380,7 @@ static PathConstructFlags FootpathCreateConstructFlags(ObjectEntryIndex& type) void window_footpath_keyboard_shortcut_turn_left() { - rct_window* w = window_find_by_class(WC_FOOTPATH); + rct_window* w = window_find_by_class(WindowClass::Footpath); if (w == nullptr || WidgetIsDisabled(*w, WIDX_DIRECTION_NW) || WidgetIsDisabled(*w, WIDX_DIRECTION_NE) || WidgetIsDisabled(*w, WIDX_DIRECTION_SW) || WidgetIsDisabled(*w, WIDX_DIRECTION_SE) || _footpathConstructionMode != 2) { @@ -1393,7 +1393,7 @@ void window_footpath_keyboard_shortcut_turn_left() void window_footpath_keyboard_shortcut_turn_right() { - rct_window* w = window_find_by_class(WC_FOOTPATH); + rct_window* w = window_find_by_class(WindowClass::Footpath); if (w == nullptr || WidgetIsDisabled(*w, WIDX_DIRECTION_NW) || WidgetIsDisabled(*w, WIDX_DIRECTION_NE) || WidgetIsDisabled(*w, WIDX_DIRECTION_SW) || WidgetIsDisabled(*w, WIDX_DIRECTION_SE) || _footpathConstructionMode != 2) { @@ -1406,7 +1406,7 @@ void window_footpath_keyboard_shortcut_turn_right() void window_footpath_keyboard_shortcut_slope_down() { - rct_window* w = window_find_by_class(WC_FOOTPATH); + rct_window* w = window_find_by_class(WindowClass::Footpath); if (w == nullptr || WidgetIsDisabled(*w, WIDX_SLOPEDOWN) || WidgetIsDisabled(*w, WIDX_LEVEL) || WidgetIsDisabled(*w, WIDX_SLOPEUP) || w->widgets[WIDX_LEVEL].type == WindowWidgetType::Empty) { @@ -1429,7 +1429,7 @@ void window_footpath_keyboard_shortcut_slope_down() void window_footpath_keyboard_shortcut_slope_up() { - rct_window* w = window_find_by_class(WC_FOOTPATH); + rct_window* w = window_find_by_class(WindowClass::Footpath); if (w == nullptr || WidgetIsDisabled(*w, WIDX_SLOPEDOWN) || WidgetIsDisabled(*w, WIDX_LEVEL) || WidgetIsDisabled(*w, WIDX_SLOPEUP) || w->widgets[WIDX_LEVEL].type == WindowWidgetType::Empty) { @@ -1452,7 +1452,7 @@ void window_footpath_keyboard_shortcut_slope_up() void window_footpath_keyboard_shortcut_demolish_current() { - rct_window* w = window_find_by_class(WC_FOOTPATH); + rct_window* w = window_find_by_class(WindowClass::Footpath); if (w == nullptr || WidgetIsDisabled(*w, WIDX_REMOVE) || w->widgets[WIDX_REMOVE].type == WindowWidgetType::Empty || (!gCheatsBuildInPauseMode && game_is_paused())) { @@ -1464,7 +1464,7 @@ void window_footpath_keyboard_shortcut_demolish_current() void window_footpath_keyboard_shortcut_build_current() { - rct_window* w = window_find_by_class(WC_FOOTPATH); + rct_window* w = window_find_by_class(WindowClass::Footpath); if (w == nullptr || WidgetIsDisabled(*w, WIDX_CONSTRUCT) || w->widgets[WIDX_CONSTRUCT].type == WindowWidgetType::Empty) { return; diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index 4b54d3ed68..55f178727e 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -116,7 +116,7 @@ rct_window* WindowGameBottomToolbarOpen() rct_window* window = WindowCreate( ScreenCoordsXY(0, screenHeight - toolbar_height), screenWidth, toolbar_height, &window_game_bottom_toolbar_events, - WC_BOTTOM_TOOLBAR, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND); + WindowClass::BottomToolbar, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND); window->widgets = window_game_bottom_toolbar_widgets; window->frame_no = 0; @@ -142,7 +142,7 @@ static void WindowGameBottomToolbarMouseup(rct_window* w, rct_widgetindex widget case WIDX_LEFT_OUTSET: case WIDX_MONEY: if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) - context_open_window(WC_FINANCES); + context_open_window(WindowClass::Finances); break; case WIDX_GUESTS: context_open_window_view(WV_PARK_GUESTS); @@ -153,7 +153,7 @@ static void WindowGameBottomToolbarMouseup(rct_window* w, rct_widgetindex widget case WIDX_MIDDLE_INSET: if (News::IsQueueEmpty()) { - context_open_window(WC_RECENT_NEWS); + context_open_window(WindowClass::RecentNews); } else { @@ -183,7 +183,7 @@ static void WindowGameBottomToolbarMouseup(rct_window* w, rct_widgetindex widget break; case WIDX_RIGHT_OUTSET: case WIDX_DATE: - context_open_window(WC_RECENT_NEWS); + context_open_window(WindowClass::RecentNews); break; } } @@ -338,7 +338,7 @@ void WindowGameBottomToolbarInvalidateNewsItem() { if (gScreenFlags == SCREEN_FLAGS_PLAYING) { - widget_invalidate_by_class(WC_BOTTOM_TOOLBAR, WIDX_MIDDLE_OUTSET); + widget_invalidate_by_class(WindowClass::BottomToolbar, WIDX_MIDDLE_OUTSET); } } @@ -406,7 +406,7 @@ static void WindowGameBottomToolbarDrawLeftPanel(rct_drawpixelinfo* dpi, rct_win w->windowPos.y + widget.midY() - (line_height == 10 ? 5 : 6) }; colour_t colour - = (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_MONEY + = (gHoverWidget.window_classification == WindowClass::BottomToolbar && gHoverWidget.widget_index == WIDX_MONEY ? COLOUR_WHITE : NOT_TRANSLUCENT(w->colours[0])); StringId stringId = gCash < 0 ? STR_BOTTOM_TOOLBAR_CASH_NEGATIVE : STR_BOTTOM_TOOLBAR_CASH; @@ -435,7 +435,7 @@ static void WindowGameBottomToolbarDrawLeftPanel(rct_drawpixelinfo* dpi, rct_win StringId stringId = gNumGuestsInPark == 1 ? _guestCountFormatsSingular[gGuestChangeModifier] : _guestCountFormats[gGuestChangeModifier]; colour_t colour - = (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_GUESTS + = (gHoverWidget.window_classification == WindowClass::BottomToolbar && gHoverWidget.widget_index == WIDX_GUESTS ? COLOUR_WHITE : NOT_TRANSLUCENT(w->colours[0])); auto ft = Formatter(); @@ -502,7 +502,7 @@ static void WindowGameBottomToolbarDrawRightPanel(rct_drawpixelinfo* dpi, rct_wi int32_t day = ((gDateMonthTicks * days_in_month[month]) >> 16) & 0xFF; colour_t colour - = (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_DATE + = (gHoverWidget.window_classification == WindowClass::BottomToolbar && gHoverWidget.widget_index == WIDX_DATE ? COLOUR_WHITE : NOT_TRANSLUCENT(w->colours[0])); StringId stringId = DateFormatStringFormatIds[gConfigGeneral.date_format]; diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 2621eac9f9..fa69b26f74 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -630,7 +630,7 @@ private: pickupAction.SetCallback([peepnum = number](const GameAction* ga, const GameActions::Result* result) { if (result->Error != GameActions::Status::Ok) return; - rct_window* wind = window_find_by_number(WC_PEEP, peepnum); + rct_window* wind = window_find_by_number(WindowClass::Peep, peepnum); if (wind != nullptr) { tool_set(*wind, WC_PEEP__WIDX_PICKUP, Tool::Picker); @@ -1293,7 +1293,7 @@ private: if (index >= no_list_items) return; - auto intent = Intent(WC_RIDE); + auto intent = Intent(WindowClass::Ride); intent.putExtra(INTENT_EXTRA_RIDE_ID, list_item_positions[index]); context_open_intent(&intent); } @@ -1924,14 +1924,15 @@ rct_window* WindowGuestOpen(Peep* peep) return WindowStaffOpen(peep); } - auto* window = static_cast(window_bring_to_front_by_number(WC_PEEP, peep->sprite_index.ToUnderlying())); + auto* window = static_cast( + window_bring_to_front_by_number(WindowClass::Peep, peep->sprite_index.ToUnderlying())); if (window == nullptr) { int32_t windowWidth = 192; if (gConfigGeneral.debugging_tools) windowWidth += TabWidth; - window = WindowCreate(WC_PEEP, windowWidth, 157, WF_RESIZABLE); + window = WindowCreate(WindowClass::Peep, windowWidth, 157, WF_RESIZABLE); if (window == nullptr) { return nullptr; diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index 7ccdf35ca3..011ae01378 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -282,7 +282,7 @@ public: Close(); break; case WIDX_MAP: - context_open_window(WC_MAP); + context_open_window(WindowClass::Map); break; case WIDX_TRACKING: _trackingOnly = !_trackingOnly; @@ -963,10 +963,10 @@ private: rct_window* WindowGuestListOpen() { - auto* window = window_bring_to_front_by_class(WC_GUEST_LIST); + auto* window = window_bring_to_front_by_class(WindowClass::GuestList); if (window == nullptr) { - window = WindowCreate(WC_GUEST_LIST, 350, 330, WF_10 | WF_RESIZABLE); + window = WindowCreate(WindowClass::GuestList, 350, 330, WF_10 | WF_RESIZABLE); } return window; } @@ -986,7 +986,7 @@ rct_window* WindowGuestListOpenWithFilter(GuestListFilterType type, int32_t inde void WindowGuestListRefreshList() { - auto* w = window_find_by_class(WC_GUEST_LIST); + auto* w = window_find_by_class(WindowClass::GuestList); if (w != nullptr) { static_cast(w)->RefreshList(); diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp index 6d861784b6..f565a3fbc6 100644 --- a/src/openrct2-ui/windows/InstallTrack.cpp +++ b/src/openrct2-ui/windows/InstallTrack.cpp @@ -106,7 +106,7 @@ rct_window* WindowInstallTrackOpen(const utf8* path) return nullptr; } - window_close_by_class(WC_EDITOR_OBJECT_SELECTION); + window_close_by_class(WindowClass::EditorObjectSelection); window_close_construction_windows(); gTrackDesignSceneryToggle = false; @@ -117,7 +117,7 @@ rct_window* WindowInstallTrackOpen(const utf8* path) int32_t x = screenWidth / 2 - 201; int32_t y = std::max(TOP_TOOLBAR_HEIGHT + 1, screenHeight / 2 - 200); - rct_window* w = WindowCreate(ScreenCoordsXY(x, y), WW, WH, &window_install_track_events, WC_INSTALL_TRACK, 0); + rct_window* w = WindowCreate(ScreenCoordsXY(x, y), WW, WH, &window_install_track_events, WindowClass::InstallTrack, 0); w->widgets = window_install_track_widgets; WindowInitScrollWidgets(*w); w->track_list.track_list_being_updated = false; diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index 14dbcab1f7..ff12b7976b 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -340,5 +340,5 @@ private: rct_window* WindowLandOpen() { - return WindowFocusOrCreate(WC_LAND, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0); + return WindowFocusOrCreate(WindowClass::Land, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0); } diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index ed7eee2bbb..b407c02f02 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -246,7 +246,7 @@ public: if (_landRightsCost != MONEY32_UNDEFINED) { _landRightsCost = MONEY32_UNDEFINED; - window_invalidate_by_class(WC_CLEAR_SCENERY); + window_invalidate_by_class(WindowClass::ClearScenery); } return; } @@ -393,7 +393,7 @@ private: { if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) return false; - if (gCurrentToolWidget.window_classification != WC_LAND_RIGHTS) + if (gCurrentToolWidget.window_classification != WindowClass::LandRights) return false; return true; } @@ -401,5 +401,6 @@ private: rct_window* WindowLandRightsOpen() { - return WindowFocusOrCreate(WC_LAND_RIGHTS, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0); + return WindowFocusOrCreate( + WindowClass::LandRights, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0); } diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index 5d065e6745..54f80b6e5d 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -274,10 +274,10 @@ rct_window* WindowLoadsaveOpen( const u8string path = WindowLoadsaveGetDir(type); - rct_window* w = window_bring_to_front_by_class(WC_LOADSAVE); + rct_window* w = window_bring_to_front_by_class(WindowClass::Loadsave); if (w == nullptr) { - w = WindowCreateCentred(WW, WH, &window_loadsave_events, WC_LOADSAVE, WF_STICK_TO_FRONT | WF_RESIZABLE); + w = WindowCreateCentred(WW, WH, &window_loadsave_events, WindowClass::Loadsave, WF_STICK_TO_FRONT | WF_RESIZABLE); w->widgets = window_loadsave_widgets; w->min_width = WW; @@ -334,7 +334,7 @@ rct_window* WindowLoadsaveOpen( static void WindowLoadsaveClose(rct_window* w) { _listItems.clear(); - window_close_by_class(WC_LOADSAVE_OVERWRITE_PROMPT); + window_close_by_class(WindowClass::LoadsaveOverwritePrompt); } static void WindowLoadsaveResize(rct_window* w) @@ -990,7 +990,7 @@ static void WindowLoadsaveSelect(rct_window* w, const char* path) case (LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME): SetAndSaveConfigPath(gConfigGeneral.last_save_game_directory, pathBuffer); WindowLoadsaveInvokeCallback(MODAL_RESULT_OK, pathBuffer); - window_close_by_class(WC_LOADSAVE); + window_close_by_class(WindowClass::Loadsave); gfx_invalidate_screen(); break; @@ -1002,7 +1002,7 @@ static void WindowLoadsaveSelect(rct_window* w, const char* path) gCurrentLoadedPath = pathBuffer; gFirstTimeSaving = false; - window_close_by_class(WC_LOADSAVE); + window_close_by_class(WindowClass::Loadsave); gfx_invalidate_screen(); WindowLoadsaveInvokeCallback(MODAL_RESULT_OK, pathBuffer); @@ -1036,7 +1036,7 @@ static void WindowLoadsaveSelect(rct_window* w, const char* path) if (scenario_save(pathBuffer, gConfigGeneral.save_plugin_data ? 3 : 2)) { gCurrentLoadedPath = pathBuffer; - window_close_by_class(WC_LOADSAVE); + window_close_by_class(WindowClass::Loadsave); gfx_invalidate_screen(); WindowLoadsaveInvokeCallback(MODAL_RESULT_OK, pathBuffer); } @@ -1059,7 +1059,7 @@ static void WindowLoadsaveSelect(rct_window* w, const char* path) if (success) { - window_close_by_class(WC_LOADSAVE); + window_close_by_class(WindowClass::Loadsave); WindowLoadsaveInvokeCallback(MODAL_RESULT_OK, pathBuffer); title_load(); } @@ -1075,10 +1075,10 @@ static void WindowLoadsaveSelect(rct_window* w, const char* path) case (LOADSAVETYPE_LOAD | LOADSAVETYPE_TRACK): { SetAndSaveConfigPath(gConfigGeneral.last_save_track_directory, pathBuffer); - auto intent = Intent(WC_INSTALL_TRACK); + auto intent = Intent(WindowClass::InstallTrack); intent.putExtra(INTENT_EXTRA_PATH, std::string{ pathBuffer }); context_open_intent(&intent); - window_close_by_class(WC_LOADSAVE); + window_close_by_class(WindowClass::Loadsave); WindowLoadsaveInvokeCallback(MODAL_RESULT_OK, pathBuffer); break; } @@ -1096,7 +1096,7 @@ static void WindowLoadsaveSelect(rct_window* w, const char* path) if (success) { - window_close_by_class(WC_LOADSAVE); + window_close_by_class(WindowClass::Loadsave); WindowRideMeasurementsDesignCancel(); WindowLoadsaveInvokeCallback(MODAL_RESULT_OK, path); } @@ -1109,7 +1109,7 @@ static void WindowLoadsaveSelect(rct_window* w, const char* path) } case (LOADSAVETYPE_LOAD | LOADSAVETYPE_HEIGHTMAP): - window_close_by_class(WC_LOADSAVE); + window_close_by_class(WindowClass::Loadsave); WindowLoadsaveInvokeCallback(MODAL_RESULT_OK, pathBuffer); break; } @@ -1152,10 +1152,10 @@ static rct_window* WindowOverwritePromptOpen(const char* name, const char* path) { rct_window* w; - window_close_by_class(WC_LOADSAVE_OVERWRITE_PROMPT); + window_close_by_class(WindowClass::LoadsaveOverwritePrompt); w = WindowCreateCentred( - OVERWRITE_WW, OVERWRITE_WH, &window_overwrite_prompt_events, WC_LOADSAVE_OVERWRITE_PROMPT, WF_STICK_TO_FRONT); + OVERWRITE_WW, OVERWRITE_WH, &window_overwrite_prompt_events, WindowClass::LoadsaveOverwritePrompt, WF_STICK_TO_FRONT); w->widgets = window_overwrite_prompt_widgets; WindowInitScrollWidgets(*w); @@ -1176,12 +1176,12 @@ static void WindowOverwritePromptMouseup(rct_window* w, rct_widgetindex widgetIn switch (widgetIndex) { case WIDX_OVERWRITE_OVERWRITE: - loadsaveWindow = window_find_by_class(WC_LOADSAVE); + loadsaveWindow = window_find_by_class(WindowClass::Loadsave); if (loadsaveWindow != nullptr) WindowLoadsaveSelect(loadsaveWindow, _window_overwrite_prompt_path); // As the window_loadsave_select function can change the order of the // windows we can't use window_close(w). - window_close_by_class(WC_LOADSAVE_OVERWRITE_PROMPT); + window_close_by_class(WindowClass::LoadsaveOverwritePrompt); break; case WIDX_OVERWRITE_CANCEL: diff --git a/src/openrct2-ui/windows/Main.cpp b/src/openrct2-ui/windows/Main.cpp index 4f95140b64..f1e46c0947 100644 --- a/src/openrct2-ui/windows/Main.cpp +++ b/src/openrct2-ui/windows/Main.cpp @@ -73,5 +73,6 @@ private: */ rct_window* WindowMainOpen() { - return WindowCreate(WC_MAIN_WINDOW, { 0, 0 }, context_get_width(), context_get_height(), WF_STICK_TO_BACK); + return WindowCreate( + WindowClass::MainWindow, { 0, 0 }, context_get_width(), context_get_height(), WF_STICK_TO_BACK); } diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index 7029701cc9..c9ded877a2 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -269,7 +269,7 @@ public: _mapWidthAndHeightLinked = !_mapWidthAndHeightLinked; break; case WIDX_MAP_GENERATOR: - context_open_window(WC_MAPGEN); + context_open_window(WindowClass::Mapgen); break; default: if (widgetIndex >= WIDX_PEOPLE_TAB && widgetIndex <= WIDX_RIDES_TAB) @@ -819,7 +819,7 @@ public: if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) { // scenario editor: build park entrance selected, show rotate button - if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WC_MAP + if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::Map && gCurrentToolWidget.widget_index == WIDX_BUILD_PARK_ENTRANCE) { widgets[WIDX_ROTATE_90].type = WindowWidgetType::FlatBtn; @@ -829,7 +829,7 @@ public: widgets[WIDX_SET_LAND_RIGHTS].type = WindowWidgetType::FlatBtn; // If any tool is active - if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WC_MAP) + if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::Map) { // if not in set land rights mode: show the default scenario editor buttons if (gCurrentToolWidget.widget_index != WIDX_SET_LAND_RIGHTS) @@ -1449,7 +1449,7 @@ rct_window* WindowMapOpen() { try { - rct_window* w = WindowFocusOrCreate(WC_MAP, 245, 259, WF_10); + rct_window* w = WindowFocusOrCreate(WindowClass::Map, 245, 259, WF_10); w->selected_tab = 0; w->list_information_type = 0; return w; @@ -1465,7 +1465,7 @@ void WindowMapReset() rct_window* w; // Check if window is even opened - w = window_bring_to_front_by_class(WC_MAP); + w = window_bring_to_front_by_class(WindowClass::Map); if (w == nullptr) { return; diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp index 1cb8c5c5ed..2696fdedbf 100644 --- a/src/openrct2-ui/windows/MapGen.cpp +++ b/src/openrct2-ui/windows/MapGen.cpp @@ -421,13 +421,13 @@ static void WindowMapgenChangeMapSize(int32_t sizeOffset) rct_window* WindowMapgenOpen() { - rct_window* w = window_bring_to_front_by_class(WC_MAPGEN); + rct_window* w = window_bring_to_front_by_class(WindowClass::Mapgen); if (w != nullptr) { return w; } - w = WindowCreateCentred(WW, WH, PageEvents[WINDOW_MAPGEN_PAGE_BASE], WC_MAPGEN, WF_10); + w = WindowCreateCentred(WW, WH, PageEvents[WINDOW_MAPGEN_PAGE_BASE], WindowClass::Mapgen, WF_10); w->number = 0; w->frame_no = 0; @@ -1180,7 +1180,7 @@ static void WindowMapgenHeightmapLoadsaveCallback(int32_t result, const utf8* pa } // The window needs to be open while using the map - rct_window* const w = context_open_window(WC_MAPGEN); + rct_window* const w = context_open_window(WindowClass::Mapgen); _heightmapLoaded = true; WindowMapgenSetPage(w, WINDOW_MAPGEN_PAGE_HEIGHTMAP); @@ -1204,7 +1204,7 @@ static void WindowMapgenHeightmapMouseup(rct_window* w, rct_widgetindex widgetIn // Page widgets case WIDX_HEIGHTMAP_SELECT: { - auto intent = Intent(WC_LOADSAVE); + auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_HEIGHTMAP); intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(WindowMapgenHeightmapLoadsaveCallback)); context_open_intent(&intent); diff --git a/src/openrct2-ui/windows/MapTooltip.cpp b/src/openrct2-ui/windows/MapTooltip.cpp index 9397d9e085..3b20ded612 100644 --- a/src/openrct2-ui/windows/MapTooltip.cpp +++ b/src/openrct2-ui/windows/MapTooltip.cpp @@ -61,7 +61,7 @@ void WindowMapTooltipUpdateVisibility() if (ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR) { // The map tooltip is drawn by the bottom toolbar - window_invalidate_by_class(WC_BOTTOM_TOOLBAR); + window_invalidate_by_class(WindowClass::BottomToolbar); return; } @@ -84,9 +84,9 @@ void WindowMapTooltipUpdateVisibility() if (_cursorHoldDuration < 25 || stringId == STR_NONE || InputTestPlaceObjectModifier( static_cast(PLACE_OBJECT_MODIFIER_COPY_Z | PLACE_OBJECT_MODIFIER_SHIFT_Z)) - || window_find_by_class(WC_ERROR) != nullptr) + || window_find_by_class(WindowClass::Error) != nullptr) { - window_close_by_class(WC_MAP_TOOLTIP); + window_close_by_class(WindowClass::MapTooltip); } else { @@ -107,11 +107,11 @@ static void WindowMapTooltipOpen() const CursorState* state = context_get_cursor_state(); ScreenCoordsXY pos = { state->position.x - (width / 2), state->position.y + 15 }; - w = window_find_by_class(WC_MAP_TOOLTIP); + w = window_find_by_class(WindowClass::MapTooltip); if (w == nullptr) { w = WindowCreate( - pos, width, height, &window_map_tooltip_events, WC_MAP_TOOLTIP, + pos, width, height, &window_map_tooltip_events, WindowClass::MapTooltip, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND); w->widgets = window_map_tooltip_widgets; } diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index 6a1f7166b8..cd597268a7 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -128,7 +128,7 @@ public: } else { - auto intent = Intent(WC_RIDE); + auto intent = Intent(WindowClass::Ride); intent.putExtra(INTENT_EXTRA_RIDE_ID, currentRide->id.ToUnderlying()); context_open_intent(&intent); } @@ -237,7 +237,7 @@ public: case RideConstructionState::Back: case RideConstructionState::Selected: if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) - && gCurrentToolWidget.window_classification == WC_RIDE_CONSTRUCTION) + && gCurrentToolWidget.window_classification == WindowClass::RideConstruction) { tool_cancel(); } @@ -362,12 +362,12 @@ private: { tool_cancel(); if (currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_NO_TRACK)) - window_close_by_class(WC_RIDE_CONSTRUCTION); + window_close_by_class(WindowClass::RideConstruction); } else { gRideEntranceExitPlaceType = gRideEntranceExitPlaceType ^ 1; - window_invalidate_by_class(WC_RIDE_CONSTRUCTION); + window_invalidate_by_class(WindowClass::RideConstruction); gCurrentToolWidget.widget_index = (gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_ENTRANCE) ? WIDX_MAZE_ENTRANCE : WIDX_MAZE_EXIT; @@ -425,14 +425,15 @@ private: rct_window* WindowMazeConstructionOpen() { - return WindowFocusOrCreate(WC_RIDE_CONSTRUCTION, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE); + return WindowFocusOrCreate( + WindowClass::RideConstruction, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE); } void WindowMazeConstructionUpdatePressedWidgets() { rct_window* w; - w = window_find_by_class(WC_RIDE_CONSTRUCTION); + w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr) return; diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp index 81bee5f497..30d572a52a 100644 --- a/src/openrct2-ui/windows/Multiplayer.cpp +++ b/src/openrct2-ui/windows/Multiplayer.cpp @@ -232,10 +232,11 @@ static ScreenCoordsXY _windowInformationSize; rct_window* WindowMultiplayerOpen() { // Check if window is already open - rct_window* window = window_bring_to_front_by_class(WC_MULTIPLAYER); + rct_window* window = window_bring_to_front_by_class(WindowClass::Multiplayer); if (window == nullptr) { - window = WindowCreateAutoPos(320, 144, &window_multiplayer_players_events, WC_MULTIPLAYER, WF_10 | WF_RESIZABLE); + window = WindowCreateAutoPos( + 320, 144, &window_multiplayer_players_events, WindowClass::Multiplayer, WF_10 | WF_RESIZABLE); WindowMultiplayerSetPage(window, WINDOW_MULTIPLAYER_PAGE_INFORMATION); } diff --git a/src/openrct2-ui/windows/NetworkStatus.cpp b/src/openrct2-ui/windows/NetworkStatus.cpp index 5aa965bdd6..1f6906b87d 100644 --- a/src/openrct2-ui/windows/NetworkStatus.cpp +++ b/src/openrct2-ui/windows/NetworkStatus.cpp @@ -59,11 +59,11 @@ rct_window* WindowNetworkStatusOpen(const char* text, close_callback onClose) safe_strcpy(window_network_status_text, text, sizeof(window_network_status_text)); // Check if window is already open - rct_window* window = window_bring_to_front_by_class_with_flags(WC_NETWORK_STATUS, 0); + rct_window* window = window_bring_to_front_by_class_with_flags(WindowClass::NetworkStatus, 0); if (window != nullptr) return window; - window = WindowCreateCentred(420, 90, &window_network_status_events, WC_NETWORK_STATUS, WF_10 | WF_TRANSPARENT); + window = WindowCreateCentred(420, 90, &window_network_status_events, WindowClass::NetworkStatus, WF_10 | WF_TRANSPARENT); window->widgets = window_network_status_widgets; WindowInitScrollWidgets(*window); @@ -84,13 +84,13 @@ rct_window* WindowNetworkStatusOpen(const char* text, close_callback onClose) void WindowNetworkStatusClose() { _onClose = nullptr; - window_close_by_class(WC_NETWORK_STATUS); + window_close_by_class(WindowClass::NetworkStatus); } rct_window* WindowNetworkStatusOpenPassword() { rct_window* window; - window = window_bring_to_front_by_class(WC_NETWORK_STATUS); + window = window_bring_to_front_by_class(WindowClass::NetworkStatus); if (window == nullptr) return nullptr; diff --git a/src/openrct2-ui/windows/NewCampaign.cpp b/src/openrct2-ui/windows/NewCampaign.cpp index 88d7b18569..d0d0eb7bc9 100644 --- a/src/openrct2-ui/windows/NewCampaign.cpp +++ b/src/openrct2-ui/windows/NewCampaign.cpp @@ -260,7 +260,7 @@ public: gameAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) { if (result->Error == GameActions::Status::Ok) { - window_close_by_class(WC_NEW_CAMPAIGN); + window_close_by_class(WindowClass::NewCampaign); } }); GameActions::Execute(&gameAction); @@ -373,7 +373,7 @@ public: rct_window* WindowNewCampaignOpen(int16_t campaignType) { - auto w = static_cast(window_bring_to_front_by_class(WC_NEW_CAMPAIGN)); + auto w = static_cast(window_bring_to_front_by_class(WindowClass::NewCampaign)); if (w != nullptr) { if (w->campaign.campaign_type == campaignType) @@ -382,7 +382,7 @@ rct_window* WindowNewCampaignOpen(int16_t campaignType) window_close(*w); } - w = WindowCreate(WC_NEW_CAMPAIGN, WW, WH, 0); + w = WindowCreate(WindowClass::NewCampaign, WW, WH, 0); if (w != nullptr) { w->SetCampaign(campaignType); @@ -392,7 +392,7 @@ rct_window* WindowNewCampaignOpen(int16_t campaignType) void WindowCampaignRefreshRides() { - auto w = static_cast(window_find_by_class(WC_NEW_CAMPAIGN)); + auto w = static_cast(window_find_by_class(WindowClass::NewCampaign)); if (w != nullptr) { w->RefreshRides(); diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index ac8b7825c2..1d8abc536e 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -526,7 +526,7 @@ private: auto count = GetNumTrackDesigns(item); if (count > 0) { - auto intent = Intent(WC_TRACK_DESIGN_LIST); + auto intent = Intent(WindowClass::TrackDesignList); intent.putExtra(INTENT_EXTRA_RIDE_TYPE, item.Type); intent.putExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, item.EntryIndex); context_open_intent(&intent); @@ -955,16 +955,16 @@ rct_window* WindowNewRideOpen() { rct_window* window; - window = window_bring_to_front_by_class(WC_CONSTRUCT_RIDE); + window = window_bring_to_front_by_class(WindowClass::ConstructRide); if (window) { return window; } - window_close_by_class(WC_TRACK_DESIGN_LIST); - window_close_by_class(WC_TRACK_DESIGN_PLACE); + window_close_by_class(WindowClass::TrackDesignList); + window_close_by_class(WindowClass::TrackDesignPlace); - window = WindowCreate(WC_CONSTRUCT_RIDE, WindowWidth, WindowHeight, WF_10 | WF_AUTO_POSITION); + window = WindowCreate(WindowClass::ConstructRide, WindowWidth, WindowHeight, WF_10 | WF_AUTO_POSITION); return window; } @@ -981,7 +981,7 @@ rct_window* WindowNewRideOpenResearch() */ void WindowNewRideFocus(RideSelection rideItem) { - auto w = static_cast(window_find_by_class(WC_CONSTRUCT_RIDE)); + auto w = static_cast(window_find_by_class(WindowClass::ConstructRide)); if (!w) { return; diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index e3214ba0e7..912e6d2179 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -75,7 +75,7 @@ public: Close(); break; case WIDX_SETTINGS: - context_open_window(WC_NOTIFICATION_OPTIONS); + context_open_window(WindowClass::NotificationOptions); break; } } @@ -311,5 +311,5 @@ public: rct_window* WindowNewsOpen() { - return WindowFocusOrCreate(WC_RECENT_NEWS, WW, WH, 0); + return WindowFocusOrCreate(WindowClass::RecentNews, WW, WH, 0); } diff --git a/src/openrct2-ui/windows/NewsOptions.cpp b/src/openrct2-ui/windows/NewsOptions.cpp index 0f05ad3a34..2fb4984540 100644 --- a/src/openrct2-ui/windows/NewsOptions.cpp +++ b/src/openrct2-ui/windows/NewsOptions.cpp @@ -273,5 +273,5 @@ private: rct_window* WindowNewsOptionsOpen() { - return WindowFocusOrCreate(WC_NOTIFICATION_OPTIONS, WW, WH, WF_CENTRE_SCREEN); + return WindowFocusOrCreate(WindowClass::NotificationOptions, WW, WH, WF_CENTRE_SCREEN); } diff --git a/src/openrct2-ui/windows/ObjectLoadError.cpp b/src/openrct2-ui/windows/ObjectLoadError.cpp index 2aec660adf..2e51ce9676 100644 --- a/src/openrct2-ui/windows/ObjectLoadError.cpp +++ b/src/openrct2-ui/windows/ObjectLoadError.cpp @@ -110,7 +110,7 @@ private: if (_downloadStatusInfo == DownloadStatusInfo()) { - context_force_close_window_by_class(WC_NETWORK_STATUS); + context_force_close_window_by_class(WindowClass::NetworkStatus); } else { @@ -133,7 +133,7 @@ private: str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS_FROM, ft.Data()); } - auto intent = Intent(WC_NETWORK_STATUS); + auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string(str_downloading_objects)); intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { _downloadingObjects = false; }); context_open_intent(&intent); @@ -564,10 +564,10 @@ public: rct_window* WindowObjectLoadErrorOpen(utf8* path, size_t numMissingObjects, const ObjectEntryDescriptor* missingObjects) { // Check if window is already open - auto* window = window_bring_to_front_by_class(WC_OBJECT_LOAD_ERROR); + auto* window = window_bring_to_front_by_class(WindowClass::ObjectLoadError); if (window == nullptr) { - window = WindowCreate(WC_OBJECT_LOAD_ERROR, WW, WH, 0); + window = WindowCreate(WindowClass::ObjectLoadError, WW, WH, 0); } static_cast(window)->Initialise(path, numMissingObjects, missingObjects); diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 7e91a57905..acdfae0399 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -1189,7 +1189,7 @@ private: if (dropdownIndex == EnumValue(CurrencyType::Custom) + 1) { // Add 1 because the separator occupies a position gConfigGeneral.currency_format = static_cast(dropdownIndex - 1); - context_open_window(WC_CUSTOM_CURRENCY_CONFIG); + context_open_window(WindowClass::CustomCurrencyConfig); } else { @@ -1305,7 +1305,7 @@ private: OpenRCT2::Audio::Pause(); else OpenRCT2::Audio::Resume(); - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::TopToolbar); config_save_default(); Invalidate(); break; @@ -1531,7 +1531,7 @@ private: switch (widgetIndex) { case WIDX_HOTKEY_DROPDOWN: - context_open_window(WC_KEYBOARD_SHORTCUT_LIST); + context_open_window(WindowClass::KeyboardShortcutList); break; case WIDX_SCREEN_EDGE_SCROLLING: gConfigGeneral.edge_scrolling ^= 1; @@ -1553,43 +1553,43 @@ private: gConfigInterface.toolbar_show_finances ^= 1; config_save_default(); Invalidate(); - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::TopToolbar); break; case WIDX_TOOLBAR_SHOW_RESEARCH: gConfigInterface.toolbar_show_research ^= 1; config_save_default(); Invalidate(); - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::TopToolbar); break; case WIDX_TOOLBAR_SHOW_CHEATS: gConfigInterface.toolbar_show_cheats ^= 1; config_save_default(); Invalidate(); - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::TopToolbar); break; case WIDX_TOOLBAR_SHOW_NEWS: gConfigInterface.toolbar_show_news ^= 1; config_save_default(); Invalidate(); - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::TopToolbar); break; case WIDX_TOOLBAR_SHOW_MUTE: gConfigInterface.toolbar_show_mute ^= 1; config_save_default(); Invalidate(); - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::TopToolbar); break; case WIDX_TOOLBAR_SHOW_CHAT: gConfigInterface.toolbar_show_chat ^= 1; config_save_default(); Invalidate(); - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::TopToolbar); break; case WIDX_TOOLBAR_SHOW_ZOOM: gConfigInterface.toolbar_show_zoom ^= 1; config_save_default(); Invalidate(); - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::TopToolbar); break; case WIDX_INVERT_DRAG: gConfigGeneral.invert_viewport_drag ^= 1; @@ -1597,7 +1597,7 @@ private: Invalidate(); break; case WIDX_THEMES_BUTTON: - context_open_window(WC_THEMES); + context_open_window(WindowClass::Themes); Invalidate(); break; } @@ -1683,7 +1683,7 @@ private: case WIDX_SCENARIO_UNLOCKING: gConfigGeneral.scenario_unlocking_enabled ^= 1; config_save_default(); - window_close_by_class(WC_SCENARIO_SELECT); + window_close_by_class(WindowClass::ScenarioSelect); break; case WIDX_AUTO_OPEN_SHOPS: gConfigGeneral.auto_open_shops = !gConfigGeneral.auto_open_shops; @@ -1803,7 +1803,7 @@ private: gConfigInterface.scenarioselect_last_tab = 0; config_save_default(); Invalidate(); - window_close_by_class(WC_SCENARIO_SELECT); + window_close_by_class(WindowClass::ScenarioSelect); } break; } @@ -2192,5 +2192,5 @@ private: */ rct_window* WindowOptionsOpen() { - return WindowFocusOrCreate(WC_OPTIONS, WW, WH, WF_CENTRE_SCREEN); + return WindowFocusOrCreate(WindowClass::Options, WW, WH, WF_CENTRE_SCREEN); } diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index 8244b652cb..a0c337efeb 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -413,7 +413,7 @@ private: switch (widgetIndex) { case WIDX_BUY_LAND_RIGHTS: - context_open_window(WC_LAND_RIGHTS); + context_open_window(WindowClass::LandRights); break; case WIDX_LOCATE: ScrollToViewport(); @@ -1298,7 +1298,7 @@ private: static ParkWindow* ParkWindowOpen(uint8_t page) { - auto* wnd = WindowFocusOrCreate(WC_PARK_INFORMATION, 230, 174 + 9, WF_10); + auto* wnd = WindowFocusOrCreate(WindowClass::ParkInformation, 230, 174 + 9, WF_10); if (wnd != nullptr && page != WINDOW_PARK_PAGE_ENTRANCE) { wnd->OnMouseUp(WIDX_TAB_1 + page); diff --git a/src/openrct2-ui/windows/PatrolArea.cpp b/src/openrct2-ui/windows/PatrolArea.cpp index 0a5ad9c603..f54d754739 100644 --- a/src/openrct2-ui/windows/PatrolArea.cpp +++ b/src/openrct2-ui/windows/PatrolArea.cpp @@ -266,7 +266,7 @@ private: { if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) return false; - if (gCurrentToolWidget.window_classification != WC_PATROL_AREA) + if (gCurrentToolWidget.window_classification != WindowClass::PatrolArea) return false; return true; } @@ -274,7 +274,7 @@ private: bool IsStaffWindowOpen() { // If staff window for this patrol area was closed, tool is no longer active - auto staffWindow = window_find_by_number(WC_PEEP, _staffId); + auto staffWindow = window_find_by_number(WindowClass::Peep, _staffId); return staffWindow != nullptr; } @@ -287,7 +287,8 @@ private: rct_window* WindowPatrolAreaOpen(EntityId staffId) { - auto w = WindowFocusOrCreate(WC_PATROL_AREA, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0); + auto w = WindowFocusOrCreate( + WindowClass::PatrolArea, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0); if (w != nullptr) { w->SetStaffId(staffId); @@ -297,6 +298,6 @@ rct_window* WindowPatrolAreaOpen(EntityId staffId) EntityId WindowPatrolAreaGetCurrentStaffId() { - auto current = reinterpret_cast(window_find_by_class(WC_PATROL_AREA)); + auto current = reinterpret_cast(window_find_by_class(WindowClass::PatrolArea)); return current != nullptr ? current->GetStaffId() : EntityId::GetNull(); } diff --git a/src/openrct2-ui/windows/Player.cpp b/src/openrct2-ui/windows/Player.cpp index da863136dd..b6854d5f08 100644 --- a/src/openrct2-ui/windows/Player.cpp +++ b/src/openrct2-ui/windows/Player.cpp @@ -137,10 +137,10 @@ rct_window* WindowPlayerOpen(uint8_t id) { rct_window* window; - window = window_bring_to_front_by_number(WC_PLAYER, id); + window = window_bring_to_front_by_number(WindowClass::Player, id); if (window == nullptr) { - window = WindowCreateAutoPos(240, 170, &window_player_overview_events, WC_PLAYER, WF_RESIZABLE); + window = WindowCreateAutoPos(240, 170, &window_player_overview_events, WindowClass::Player, WF_RESIZABLE); window->number = id; window->page = 0; window->frame_no = 0; diff --git a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp index 71cecdc322..919573843a 100644 --- a/src/openrct2-ui/windows/RefurbishRidePrompt.cpp +++ b/src/openrct2-ui/windows/RefurbishRidePrompt.cpp @@ -96,16 +96,17 @@ rct_window* WindowRideRefurbishPromptOpen(Ride* ride) rct_window* w; RefurbishRidePromptWindow* newWindow; - w = window_find_by_class(WC_DEMOLISH_RIDE_PROMPT); + w = window_find_by_class(WindowClass::DemolishRidePrompt); if (w != nullptr) { auto windowPos = w->windowPos; window_close(*w); - newWindow = WindowCreate(WC_DEMOLISH_RIDE_PROMPT, windowPos, WW, WH, WF_TRANSPARENT); + newWindow = WindowCreate(WindowClass::DemolishRidePrompt, windowPos, WW, WH, WF_TRANSPARENT); } else { - newWindow = WindowCreate(WC_DEMOLISH_RIDE_PROMPT, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT); + newWindow = WindowCreate( + WindowClass::DemolishRidePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT); } newWindow->SetRide(ride); diff --git a/src/openrct2-ui/windows/Research.cpp b/src/openrct2-ui/windows/Research.cpp index 2b4ff2a4e8..c5eebf6633 100644 --- a/src/openrct2-ui/windows/Research.cpp +++ b/src/openrct2-ui/windows/Research.cpp @@ -161,10 +161,10 @@ rct_window* WindowResearchOpen() { rct_window* w; - w = window_bring_to_front_by_class(WC_RESEARCH); + w = window_bring_to_front_by_class(WindowClass::Research); if (w == nullptr) { - w = WindowCreateAutoPos(WW_FUNDING, WH_FUNDING, window_research_page_events[0], WC_RESEARCH, WF_10); + w = WindowCreateAutoPos(WW_FUNDING, WH_FUNDING, window_research_page_events[0], WindowClass::Research, WF_10); w->widgets = window_research_page_widgets[0]; w->number = 0; w->page = 0; diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index e389a5ba92..36e342daf5 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -1158,7 +1158,7 @@ static rct_window* WindowRideOpen(Ride* ride) { rct_window* w; - w = WindowCreateAutoPos(316, 207, window_ride_page_events[0], WC_RIDE, WF_10 | WF_RESIZABLE); + w = WindowCreateAutoPos(316, 207, window_ride_page_events[0], WindowClass::Ride, WF_10 | WF_RESIZABLE); w->widgets = window_ride_page_widgets[WINDOW_RIDE_PAGE_MAIN]; w->hold_down_widgets = window_ride_page_hold_down_widgets[WINDOW_RIDE_PAGE_MAIN]; w->rideId = ride->id; @@ -1193,7 +1193,7 @@ rct_window* WindowRideMainOpen(Ride* ride) return nullptr; } - rct_window* w = window_bring_to_front_by_number(WC_RIDE, ride->id.ToUnderlying()); + rct_window* w = window_bring_to_front_by_number(WindowClass::Ride, ride->id.ToUnderlying()); if (w == nullptr) { w = WindowRideOpen(ride); @@ -1234,7 +1234,7 @@ static rct_window* WindowRideOpenStation(Ride* ride, StationIndex stationIndex) if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES)) return WindowRideMainOpen(ride); - auto w = window_bring_to_front_by_number(WC_RIDE, ride->id.ToUnderlying()); + auto w = window_bring_to_front_by_number(WindowClass::Ride, ride->id.ToUnderlying()); if (w == nullptr) { w = WindowRideOpen(ride); @@ -1339,7 +1339,7 @@ rct_window* WindowRideOpenVehicle(Vehicle* vehicle) view++; } - rct_window* w = window_find_by_number(WC_RIDE, ride->id.ToUnderlying()); + rct_window* w = window_find_by_number(WindowClass::Ride, ride->id.ToUnderlying()); if (w != nullptr) { w->Invalidate(); @@ -1361,10 +1361,10 @@ rct_window* WindowRideOpenVehicle(Vehicle* vehicle) continue; numPeepsLeft--; - rct_window* w2 = window_find_by_number(WC_PEEP, vehicle->peep[i]); + rct_window* w2 = window_find_by_number(WindowClass::Peep, vehicle->peep[i]); if (w2 == nullptr) { - auto intent = Intent(WC_PEEP); + auto intent = Intent(WindowClass::Peep); intent.putExtra(INTENT_EXTRA_PEEP, peep); context_open_intent(&intent); openedPeepWindow = 1; @@ -1374,8 +1374,8 @@ rct_window* WindowRideOpenVehicle(Vehicle* vehicle) } } - w = openedPeepWindow ? window_find_by_number(WC_RIDE, ride->id.ToUnderlying()) - : window_bring_to_front_by_number(WC_RIDE, ride->id.ToUnderlying()); + w = openedPeepWindow ? window_find_by_number(WindowClass::Ride, ride->id.ToUnderlying()) + : window_bring_to_front_by_number(WindowClass::Ride, ride->id.ToUnderlying()); } if (w == nullptr) @@ -1417,10 +1417,10 @@ static void WindowRideSetPage(rct_window* w, int32_t page) if (page == WINDOW_RIDE_PAGE_VEHICLE) { - auto constructionWindow = window_find_by_class(WC_RIDE_CONSTRUCTION); + auto constructionWindow = window_find_by_class(WindowClass::RideConstruction); if (constructionWindow != nullptr && constructionWindow->number == w->number) { - window_close_by_class(WC_RIDE_CONSTRUCTION); + window_close_by_class(WindowClass::RideConstruction); // Closing the construction window sets the tab to the first page, which we don't want here, // as user just clicked the Vehicle page WindowRideSetPage(w, WINDOW_RIDE_PAGE_VEHICLE); @@ -1647,7 +1647,7 @@ static void WindowRideMainMouseup(rct_window* w, rct_widgetindex widgetIndex) if (ride != nullptr) { ride_construct(ride); - if (window_find_by_number(WC_RIDE_CONSTRUCTION, ride->id.ToUnderlying()) != nullptr) + if (window_find_by_number(WindowClass::RideConstruction, ride->id.ToUnderlying()) != nullptr) { window_close(*w); } @@ -3756,7 +3756,7 @@ static void WindowRideLocateMechanic(rct_window* w) context_show_error(STR_UNABLE_TO_LOCATE_MECHANIC, STR_NONE, {}); else { - auto intent = Intent(WC_PEEP); + auto intent = Intent(WindowClass::Peep); intent.putExtra(INTENT_EXTRA_PEEP, mechanic); context_open_intent(&intent); } @@ -3988,7 +3988,7 @@ static void WindowRideMaintenanceDropdown(rct_window* w, rct_widgetindex widgetI break; } ride->lifecycle_flags &= ~(RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN); - window_invalidate_by_number(WC_RIDE, w->number); + window_invalidate_by_number(WindowClass::Ride, w->number); break; } if (ride->lifecycle_flags @@ -5379,7 +5379,7 @@ static void WindowRideMeasurementsDesignSave(rct_window* w) } auto trackName = ride->GetName(); - auto intent = Intent(WC_LOADSAVE); + auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_TRACK); intent.putExtra(INTENT_EXTRA_TRACK_DESIGN, _trackDesign.get()); intent.putExtra(INTENT_EXTRA_PATH, trackName); @@ -6857,7 +6857,7 @@ static void WindowRideCustomerMouseup(rct_window* w, rct_widgetindex widgetIndex break; case WIDX_SHOW_GUESTS_THOUGHTS: { - auto intent = Intent(WC_GUEST_LIST); + auto intent = Intent(WindowClass::GuestList); intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsThinkingAboutRide)); intent.putExtra(INTENT_EXTRA_RIDE_ID, w->number); context_open_intent(&intent); @@ -6865,7 +6865,7 @@ static void WindowRideCustomerMouseup(rct_window* w, rct_widgetindex widgetIndex } case WIDX_SHOW_GUESTS_ON_RIDE: { - auto intent = Intent(WC_GUEST_LIST); + auto intent = Intent(WindowClass::GuestList); intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsOnRide)); intent.putExtra(INTENT_EXTRA_RIDE_ID, w->number); context_open_intent(&intent); @@ -6873,7 +6873,7 @@ static void WindowRideCustomerMouseup(rct_window* w, rct_widgetindex widgetIndex } case WIDX_SHOW_GUESTS_QUEUING: { - auto intent = Intent(WC_GUEST_LIST); + auto intent = Intent(WindowClass::GuestList); intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsInQueue)); intent.putExtra(INTENT_EXTRA_RIDE_ID, w->number); context_open_intent(&intent); diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 3a2b7c92e2..7ec2d519ab 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -178,7 +178,7 @@ static int32_t RideGetAlternativeType(Ride* ride) /* move to ride.c */ static void CloseRideWindowForConstruction(RideId rideId) { - rct_window* w = window_find_by_number(WC_RIDE, rideId.ToUnderlying()); + rct_window* w = window_find_by_number(WindowClass::Ride, rideId.ToUnderlying()); if (w != nullptr && w->page == 1) window_close(*w); } @@ -285,7 +285,7 @@ public: } currentRide->SetToDefaultInspectionInterval(); - auto intent = Intent(WC_RIDE); + auto intent = Intent(WindowClass::Ride); intent.putExtra(INTENT_EXTRA_RIDE_ID, currentRide->id.ToUnderlying()); context_open_intent(&intent); } @@ -913,7 +913,7 @@ public: case RideConstructionState::Back: case RideConstructionState::Selected: if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) - && gCurrentToolWidget.window_classification == WC_RIDE_CONSTRUCTION) + && gCurrentToolWidget.window_classification == WindowClass::RideConstruction) { tool_cancel(); } @@ -2567,13 +2567,13 @@ private: tool_cancel(); if (currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_NO_TRACK)) { - window_close_by_class(WC_RIDE_CONSTRUCTION); + window_close_by_class(WindowClass::RideConstruction); } } else { gRideEntranceExitPlaceType = gRideEntranceExitPlaceType ^ 1; - window_invalidate_by_class(WC_RIDE_CONSTRUCTION); + window_invalidate_by_class(WindowClass::RideConstruction); gCurrentToolWidget.widget_index = (gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_ENTRANCE) ? WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE : WC_RIDE_CONSTRUCTION__WIDX_EXIT; @@ -2733,16 +2733,17 @@ rct_window* WindowRideConstructionOpen() return context_open_window_view(WV_MAZE_CONSTRUCTION); case RideConstructionWindowContext::Default: return WindowCreate( - WC_RIDE_CONSTRUCTION, ScreenCoordsXY(0, 29), 166, 394, WF_NO_AUTO_CLOSE); + WindowClass::RideConstruction, ScreenCoordsXY(0, 29), 166, 394, WF_NO_AUTO_CLOSE); } - return WindowCreate(WC_RIDE_CONSTRUCTION, ScreenCoordsXY(0, 29), 166, 394, WF_NO_AUTO_CLOSE); + return WindowCreate( + WindowClass::RideConstruction, ScreenCoordsXY(0, 29), 166, 394, WF_NO_AUTO_CLOSE); } static void CloseConstructWindowOnCompletion(Ride* ride) { if (_rideConstructionState == RideConstructionState::State0) { - auto w = window_find_by_class(WC_RIDE_CONSTRUCTION); + auto w = window_find_by_class(WindowClass::RideConstruction); if (w != nullptr) { if (ride_are_all_possible_entrances_and_exits_built(ride).Successful) @@ -2759,7 +2760,7 @@ static void CloseConstructWindowOnCompletion(Ride* ride) static void window_ride_construction_do_entrance_exit_check() { - auto w = window_find_by_class(WC_RIDE_CONSTRUCTION); + auto w = window_find_by_class(WindowClass::RideConstruction); auto ride = get_ride(_currentRideIndex); if (w == nullptr || ride == nullptr) { @@ -2768,7 +2769,7 @@ static void window_ride_construction_do_entrance_exit_check() if (_rideConstructionState == RideConstructionState::State0) { - w = window_find_by_class(WC_RIDE_CONSTRUCTION); + w = window_find_by_class(WindowClass::RideConstruction); if (w != nullptr) { if (!ride_are_all_possible_entrances_and_exits_built(ride).Successful) @@ -2819,7 +2820,7 @@ static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, c window_ride_construction_update_active_elements(); } - window_close_by_class(WC_ERROR); + window_close_by_class(WindowClass::Error); CloseConstructWindowOnCompletion(ride); } @@ -2862,7 +2863,7 @@ static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga, window_ride_construction_update_active_elements(); } - window_close_by_class(WC_ERROR); + window_close_by_class(WindowClass::Error); CloseConstructWindowOnCompletion(ride); } @@ -2986,7 +2987,7 @@ void WindowRideConstructionUpdateActiveElementsImpl() return; } - auto window = static_cast(window_find_by_class(WC_RIDE_CONSTRUCTION)); + auto window = static_cast(window_find_by_class(WindowClass::RideConstruction)); if (!window) { return; @@ -3204,7 +3205,7 @@ void ride_construction_toolupdate_construct(const ScreenCoordsXY& screenCoords) if (ride->type != RIDE_TYPE_MAZE) { - auto window = static_cast(window_find_by_class(WC_RIDE_CONSTRUCTION)); + auto window = static_cast(window_find_by_class(WindowClass::RideConstruction)); if (!window) { return; @@ -3509,7 +3510,7 @@ void ride_construction_tooldown_construct(const ScreenCoordsXY& screenCoords) _currentTrackSelectionFlags = 0; auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); context_broadcast_intent(&intent); - w = window_find_by_class(WC_RIDE_CONSTRUCTION); + w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr) break; @@ -3542,7 +3543,7 @@ void ride_construction_tooldown_construct(const ScreenCoordsXY& screenCoords) || zAttempts == (numAttempts - 1) || z < 0) { OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Error, 0, state->position.x); - w = window_find_by_class(WC_RIDE_CONSTRUCTION); + w = window_find_by_class(WindowClass::RideConstruction); if (w != nullptr) { tool_set(*w, WIDX_CONSTRUCT, Tool::Crosshair); @@ -3558,7 +3559,7 @@ void ride_construction_tooldown_construct(const ScreenCoordsXY& screenCoords) } else { - window_close_by_class(WC_ERROR); + window_close_by_class(WindowClass::Error); OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, _currentTrackBegin); break; } @@ -3574,7 +3575,7 @@ void ride_construction_tooldown_construct(const ScreenCoordsXY& screenCoords) _currentTrackBegin.z = z; _currentTrackSelectionFlags = 0; window_ride_construction_update_active_elements(); - w = window_find_by_class(WC_RIDE_CONSTRUCTION); + w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr) break; @@ -3627,7 +3628,7 @@ void ride_construction_tooldown_construct(const ScreenCoordsXY& screenCoords) void window_ride_construction_keyboard_shortcut_turn_left() { - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty) { return; @@ -3873,7 +3874,7 @@ void window_ride_construction_keyboard_shortcut_turn_left() void window_ride_construction_keyboard_shortcut_turn_right() { - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty) { return; @@ -4119,7 +4120,7 @@ void window_ride_construction_keyboard_shortcut_turn_right() void window_ride_construction_keyboard_shortcut_use_track_default() { - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty) { return; @@ -4149,7 +4150,7 @@ void window_ride_construction_keyboard_shortcut_use_track_default() void window_ride_construction_keyboard_shortcut_slope_down() { - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty) { return; @@ -4259,7 +4260,7 @@ void window_ride_construction_keyboard_shortcut_slope_down() void window_ride_construction_keyboard_shortcut_slope_up() { - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr || WidgetIsDisabled(*w, WIDX_STRAIGHT) || w->widgets[WIDX_STRAIGHT].type == WindowWidgetType::Empty) { return; @@ -4365,7 +4366,7 @@ void window_ride_construction_keyboard_shortcut_slope_up() void window_ride_construction_keyboard_shortcut_chain_lift_toggle() { - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr || WidgetIsDisabled(*w, WIDX_CHAIN_LIFT) || w->widgets[WIDX_CHAIN_LIFT].type == WindowWidgetType::Empty) { return; @@ -4376,7 +4377,7 @@ void window_ride_construction_keyboard_shortcut_chain_lift_toggle() void window_ride_construction_keyboard_shortcut_bank_left() { - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr || WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT) || w->widgets[WIDX_BANK_STRAIGHT].type == WindowWidgetType::Empty) { @@ -4412,7 +4413,7 @@ void window_ride_construction_keyboard_shortcut_bank_left() void window_ride_construction_keyboard_shortcut_bank_right() { - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr || WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT) || w->widgets[WIDX_BANK_STRAIGHT].type == WindowWidgetType::Empty) { @@ -4448,7 +4449,7 @@ void window_ride_construction_keyboard_shortcut_bank_right() void window_ride_construction_keyboard_shortcut_previous_track() { - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr || WidgetIsDisabled(*w, WIDX_PREVIOUS_SECTION) || w->widgets[WIDX_PREVIOUS_SECTION].type == WindowWidgetType::Empty) { @@ -4460,7 +4461,7 @@ void window_ride_construction_keyboard_shortcut_previous_track() void window_ride_construction_keyboard_shortcut_next_track() { - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr || WidgetIsDisabled(*w, WIDX_NEXT_SECTION) || w->widgets[WIDX_NEXT_SECTION].type == WindowWidgetType::Empty) { @@ -4472,7 +4473,7 @@ void window_ride_construction_keyboard_shortcut_next_track() void window_ride_construction_keyboard_shortcut_build_current() { - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr || WidgetIsDisabled(*w, WIDX_CONSTRUCT) || w->widgets[WIDX_CONSTRUCT].type == WindowWidgetType::Empty) { return; @@ -4483,7 +4484,7 @@ void window_ride_construction_keyboard_shortcut_build_current() void window_ride_construction_keyboard_shortcut_demolish_current() { - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr || WidgetIsDisabled(*w, WIDX_DEMOLISH) || w->widgets[WIDX_DEMOLISH].type == WindowWidgetType::Empty) { return; diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index 7719669cda..817fadc432 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -410,7 +410,7 @@ public: } else { - auto intent = Intent(WC_RIDE); + auto intent = Intent(WindowClass::Ride); intent.putExtra(INTENT_EXTRA_RIDE_ID, rideIndex.ToUnderlying()); context_open_intent(&intent); } @@ -964,10 +964,10 @@ private: rct_window* WindowRideListOpen() { // Check if window is already open - auto* window = window_bring_to_front_by_class(WC_RIDE_LIST); + auto* window = window_bring_to_front_by_class(WindowClass::RideList); if (window == nullptr) { - window = WindowCreate(WC_RIDE_LIST, ScreenCoordsXY(32, 32), WW, WH, WF_10 | WF_RESIZABLE); + window = WindowCreate(WindowClass::RideList, ScreenCoordsXY(32, 32), WW, WH, WF_10 | WF_RESIZABLE); } return window; } diff --git a/src/openrct2-ui/windows/SavePrompt.cpp b/src/openrct2-ui/windows/SavePrompt.cpp index 15eb97fedd..34f5a49edc 100644 --- a/src/openrct2-ui/windows/SavePrompt.cpp +++ b/src/openrct2-ui/windows/SavePrompt.cpp @@ -119,7 +119,7 @@ rct_window* WindowSavePromptOpen() } // Check if window is already open - window = window_bring_to_front_by_class(WC_SAVE_PROMPT); + window = window_bring_to_front_by_class(WindowClass::SavePrompt); if (window != nullptr) { window_close(*window); @@ -143,7 +143,8 @@ rct_window* WindowSavePromptOpen() log_warning("Invalid save prompt mode %u", prompt_mode); return nullptr; } - window = WindowCreateCentred(width, height, &window_save_prompt_events, WC_SAVE_PROMPT, WF_TRANSPARENT | WF_STICK_TO_FRONT); + window = WindowCreateCentred( + width, height, &window_save_prompt_events, WindowClass::SavePrompt, WF_TRANSPARENT | WF_STICK_TO_FRONT); window->widgets = widgets; WindowInitScrollWidgets(*window); @@ -155,7 +156,7 @@ rct_window* WindowSavePromptOpen() OpenRCT2::Audio::StopAll(); } - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::TopToolbar); stringId = window_save_prompt_labels[EnumValue(prompt_mode)][0]; if (stringId == STR_LOAD_GAME_PROMPT_TITLE && gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) @@ -181,7 +182,7 @@ static void WindowSavePromptClose(rct_window* w) OpenRCT2::Audio::Resume(); } - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::TopToolbar); } /** @@ -213,7 +214,7 @@ static void WindowSavePromptMouseup(rct_window* w, rct_widgetindex widgetIndex) if (gScreenFlags & (SCREEN_FLAGS_EDITOR)) { - intent = std::make_unique(WC_LOADSAVE); + intent = std::make_unique(WindowClass::Loadsave); intent->putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); intent->putExtra(INTENT_EXTRA_PATH, gScenarioName); } diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index d81c9095d7..dee4c36767 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -157,10 +157,10 @@ rct_window* WindowScenarioselectOpen(scenarioselect_callback callback, bool titl if (_titleEditor != titleEditor) { _titleEditor = titleEditor; - window_close_by_class(WC_SCENARIO_SELECT); + window_close_by_class(WindowClass::ScenarioSelect); } - auto window = window_bring_to_front_by_class(WC_SCENARIO_SELECT); + auto window = window_bring_to_front_by_class(WindowClass::ScenarioSelect); if (window != nullptr) return window; @@ -187,7 +187,7 @@ rct_window* WindowScenarioselectOpen(std::function callb windowWidth = ScenarioSelectGetWindowWidth(); window = WindowCreateCentred( - windowWidth, windowHeight, &window_scenarioselect_events, WC_SCENARIO_SELECT, + windowWidth, windowHeight, &window_scenarioselect_events, WindowClass::ScenarioSelect, WF_10 | (titleEditor ? WF_STICK_TO_FRONT : 0)); window->widgets = window_scenarioselect_widgets; diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 29e546ee78..a06ddadfe4 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -171,7 +171,7 @@ public: viewport_set_visibility(0); if (gWindowSceneryScatterEnabled) - window_close_by_class(WC_SCENERY_SCATTER); + window_close_by_class(WindowClass::SceneryScatter); if (scenery_tool_is_active()) tool_cancel(); @@ -183,7 +183,7 @@ public: { case WIDX_SCENERY_CLOSE: if (gWindowSceneryScatterEnabled) - window_close_by_class(WC_SCENERY_SCATTER); + window_close_by_class(WindowClass::SceneryScatter); Close(); break; case WIDX_SCENERY_ROTATE_OBJECTS_BUTTON: @@ -196,14 +196,14 @@ public: gWindowSceneryPaintEnabled ^= 1; gWindowSceneryEyedropperEnabled = false; if (gWindowSceneryScatterEnabled) - window_close_by_class(WC_SCENERY_SCATTER); + window_close_by_class(WindowClass::SceneryScatter); Invalidate(); break; case WIDX_SCENERY_EYEDROPPER_BUTTON: gWindowSceneryPaintEnabled = 0; gWindowSceneryEyedropperEnabled = !gWindowSceneryEyedropperEnabled; if (gWindowSceneryScatterEnabled) - window_close_by_class(WC_SCENERY_SCATTER); + window_close_by_class(WindowClass::SceneryScatter); scenery_remove_ghost_tool_placement(); Invalidate(); break; @@ -211,7 +211,7 @@ public: gWindowSceneryPaintEnabled = 0; gWindowSceneryEyedropperEnabled = false; if (gWindowSceneryScatterEnabled) - window_close_by_class(WC_SCENERY_SCATTER); + window_close_by_class(WindowClass::SceneryScatter); else if ( network_get_mode() != NETWORK_MODE_CLIENT || network_can_perform_command(network_get_current_player_group_index(), -2)) @@ -833,7 +833,7 @@ public: SortTabs(); PrepareWidgets(); - window_invalidate_by_class(WC_SCENERY); + window_invalidate_by_class(WindowClass::Scenery); } int32_t GetRequiredWidth() const @@ -1354,10 +1354,10 @@ private: rct_window* WindowSceneryOpen() { - auto* w = static_cast(window_bring_to_front_by_class(WC_SCENERY)); + auto* w = static_cast(window_bring_to_front_by_class(WindowClass::Scenery)); if (w == nullptr) { - w = WindowCreate(WC_SCENERY); + w = WindowCreate(WindowClass::Scenery); } return w; } @@ -1366,7 +1366,7 @@ void WindowScenerySetSelectedItem( const ScenerySelection& scenery, const std::optional primary, const std::optional secondary, const std::optional tertiary, const std::optional rotation) { - auto* w = static_cast(window_bring_to_front_by_class(WC_SCENERY)); + auto* w = static_cast(window_bring_to_front_by_class(WindowClass::Scenery)); if (w != nullptr) { w->SetSelectedItem(scenery, primary, secondary, tertiary, rotation); @@ -1376,7 +1376,7 @@ void WindowScenerySetSelectedItem( void WindowScenerySetSelectedTab(const ObjectEntryIndex sceneryGroupIndex) { // Should this bring to front? - auto* w = static_cast(window_find_by_class(WC_SCENERY)); + auto* w = static_cast(window_find_by_class(WindowClass::Scenery)); if (w != nullptr) { return w->SetSelectedTab(sceneryGroupIndex); @@ -1402,7 +1402,7 @@ void WindowScenerySetDefaultPlacementConfiguration() const ScenerySelection WindowSceneryGetTabSelection() { - auto* w = static_cast(window_find_by_class(WC_SCENERY)); + auto* w = static_cast(window_find_by_class(WindowClass::Scenery)); if (w != nullptr) { return w->GetTabSelection(); @@ -1415,7 +1415,7 @@ const ScenerySelection WindowSceneryGetTabSelection() void WindowSceneryInit() { - auto* w = static_cast(window_find_by_class(WC_SCENERY)); + auto* w = static_cast(window_find_by_class(WindowClass::Scenery)); if (w != nullptr) { w->Init(); diff --git a/src/openrct2-ui/windows/SceneryScatter.cpp b/src/openrct2-ui/windows/SceneryScatter.cpp index ee0c02a365..952188a350 100644 --- a/src/openrct2-ui/windows/SceneryScatter.cpp +++ b/src/openrct2-ui/windows/SceneryScatter.cpp @@ -195,10 +195,10 @@ public: rct_window* WindowSceneryScatterOpen() { // Check if window is already open - auto* window = window_find_by_class(WC_SCENERY_SCATTER); + auto* window = window_find_by_class(WindowClass::SceneryScatter); if (window == nullptr) { - window = WindowCreate(WC_SCENERY_SCATTER, 86, 100); + window = WindowCreate(WindowClass::SceneryScatter, 86, 100); } return window; diff --git a/src/openrct2-ui/windows/ServerList.cpp b/src/openrct2-ui/windows/ServerList.cpp index 022739defb..1c8f34da9b 100644 --- a/src/openrct2-ui/windows/ServerList.cpp +++ b/src/openrct2-ui/windows/ServerList.cpp @@ -121,11 +121,12 @@ rct_window* WindowServerListOpen() rct_window* window; // Check if window is already open - window = window_bring_to_front_by_class(WC_SERVER_LIST); + window = window_bring_to_front_by_class(WindowClass::ServerList); if (window != nullptr) return window; - window = WindowCreateCentred(WWIDTH_MIN, WHEIGHT_MIN, &window_server_list_events, WC_SERVER_LIST, WF_10 | WF_RESIZABLE); + window = WindowCreateCentred( + WWIDTH_MIN, WHEIGHT_MIN, &window_server_list_events, WindowClass::ServerList, WF_10 | WF_RESIZABLE); window_server_list_widgets[WIDX_PLAYER_NAME_INPUT].string = _playerName; window->widgets = window_server_list_widgets; @@ -195,7 +196,7 @@ static void WindowServerListMouseup(rct_window* w, rct_widgetindex widgetIndex) WindowTextInputOpen(w, widgetIndex, STR_ADD_SERVER, STR_ENTER_HOSTNAME_OR_IP_ADDRESS, {}, STR_NONE, 0, 128); break; case WIDX_START_SERVER: - context_open_window(WC_SERVER_START); + context_open_window(WindowClass::ServerStart); break; } } diff --git a/src/openrct2-ui/windows/ServerStart.cpp b/src/openrct2-ui/windows/ServerStart.cpp index 822a733f3c..64b5ae900e 100644 --- a/src/openrct2-ui/windows/ServerStart.cpp +++ b/src/openrct2-ui/windows/ServerStart.cpp @@ -138,7 +138,7 @@ public: break; case WIDX_LOAD_SERVER: network_set_password(_password); - auto intent = Intent(WC_LOADSAVE); + auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(LoadSaveCallback)); context_open_intent(&intent); @@ -147,7 +147,7 @@ public: } void OnPrepareDraw() override { - ColourSchemeUpdateByClass(this, WC_SERVER_LIST); + ColourSchemeUpdateByClass(this, WindowClass::ServerList); WidgetSetCheckboxValue(*this, WIDX_ADVERTISE_CHECKBOX, gConfigNetwork.advertise); auto ft = Formatter::Common(); @@ -301,7 +301,7 @@ private: rct_window* WindowServerStartOpen() { - return WindowFocusOrCreate(WC_SERVER_START, WW, WH, WF_CENTRE_SCREEN); + return WindowFocusOrCreate(WindowClass::ServerStart, WW, WH, WF_CENTRE_SCREEN); } #endif diff --git a/src/openrct2-ui/windows/ShortcutKeys.cpp b/src/openrct2-ui/windows/ShortcutKeys.cpp index 1174191ac7..cf8d82aece 100644 --- a/src/openrct2-ui/windows/ShortcutKeys.cpp +++ b/src/openrct2-ui/windows/ShortcutKeys.cpp @@ -78,8 +78,9 @@ public: auto registeredShortcut = shortcutManager.GetShortcut(shortcutId); if (registeredShortcut != nullptr) { - window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT); - auto w = WindowCreate(WC_CHANGE_KEYBOARD_SHORTCUT, CHANGE_WW, CHANGE_WH, WF_CENTRE_SCREEN); + window_close_by_class(WindowClass::ChangeKeyboardShortcut); + auto w = WindowCreate( + WindowClass::ChangeKeyboardShortcut, CHANGE_WW, CHANGE_WH, WF_CENTRE_SCREEN); if (w != nullptr) { w->_shortcutId = shortcutId; @@ -545,7 +546,7 @@ private: void ChangeShortcutWindow::NotifyShortcutKeysWindow() { - auto w = window_find_by_class(WC_KEYBOARD_SHORTCUT_LIST); + auto w = window_find_by_class(WindowClass::KeyboardShortcutList); if (w != nullptr) { static_cast(w)->RefreshBindings(); @@ -554,10 +555,10 @@ void ChangeShortcutWindow::NotifyShortcutKeysWindow() rct_window* WindowShortcutKeysOpen() { - auto w = window_bring_to_front_by_class(WC_KEYBOARD_SHORTCUT_LIST); + auto w = window_bring_to_front_by_class(WindowClass::KeyboardShortcutList); if (w == nullptr) { - w = WindowCreate(WC_KEYBOARD_SHORTCUT_LIST, WW, WH, WF_RESIZABLE); + w = WindowCreate(WindowClass::KeyboardShortcutList, WW, WH, WF_RESIZABLE); } return w; } diff --git a/src/openrct2-ui/windows/Sign.cpp b/src/openrct2-ui/windows/Sign.cpp index 55e670663b..03bcd660f9 100644 --- a/src/openrct2-ui/windows/Sign.cpp +++ b/src/openrct2-ui/windows/Sign.cpp @@ -318,12 +318,12 @@ public: */ rct_window* WindowSignOpen(rct_windownumber number) { - auto* w = static_cast(window_bring_to_front_by_number(WC_BANNER, number)); + auto* w = static_cast(window_bring_to_front_by_number(WindowClass::Banner, number)); if (w != nullptr) return w; - w = WindowCreate(WC_BANNER, WW, WH, 0); + w = WindowCreate(WindowClass::Banner, WW, WH, 0); if (w == nullptr) return nullptr; @@ -341,12 +341,12 @@ rct_window* WindowSignOpen(rct_windownumber number) */ rct_window* WindowSignSmallOpen(rct_windownumber number) { - auto* w = static_cast(window_bring_to_front_by_number(WC_BANNER, number)); + auto* w = static_cast(window_bring_to_front_by_number(WindowClass::Banner, number)); if (w != nullptr) return w; - w = WindowCreate(WC_BANNER, WW, WH, 0); + w = WindowCreate(WindowClass::Banner, WW, WH, 0); if (w == nullptr) return nullptr; diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index eab9ddab77..e846f3ba40 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -320,7 +320,7 @@ private: void CommonPrepareDrawBefore() { - ColourSchemeUpdateByClass(this, static_cast(WC_STAFF)); + ColourSchemeUpdateByClass(this, static_cast(WindowClass::Staff)); if (window_staff_page_widgets[page] != widgets) { @@ -378,7 +378,7 @@ private: pickupAction.SetCallback([peepnum = number](const GameAction* ga, const GameActions::Result* result) { if (result->Error != GameActions::Status::Ok) return; - rct_window* wind = window_find_by_number(WC_PEEP, peepnum); + rct_window* wind = window_find_by_number(WindowClass::Peep, peepnum); if (wind != nullptr) { tool_set(*wind, WC_STAFF__WIDX_PICKUP, Tool::Picker); @@ -389,7 +389,7 @@ private: break; case WIDX_FIRE: { - auto intent = Intent(WC_FIRE_PROMPT); + auto intent = Intent(WindowClass::FirePrompt); intent.putExtra(INTENT_EXTRA_PEEP, staff); context_open_intent(&intent); break; @@ -467,7 +467,7 @@ private: return; } - window_close_by_class(WC_PATROL_AREA); + window_close_by_class(WindowClass::PatrolArea); auto staffSetPatrolAreaAction = StaffSetPatrolAreaAction( staff->sprite_index, {}, StaffSetPatrolAreaMode::ClearAll); @@ -478,7 +478,7 @@ private: auto staffId = EntityId::FromUnderlying(number); if (WindowPatrolAreaGetCurrentStaffId() == staffId) { - window_close_by_class(WC_PATROL_AREA); + window_close_by_class(WindowClass::PatrolArea); } else { @@ -1245,12 +1245,12 @@ private: rct_window* WindowStaffOpen(Peep* peep) { - auto w = static_cast(window_bring_to_front_by_number(WC_PEEP, peep->sprite_index.ToUnderlying())); + auto w = static_cast(window_bring_to_front_by_number(WindowClass::Peep, peep->sprite_index.ToUnderlying())); if (w != nullptr) return w; - w = WindowCreate(WC_PEEP, WW, WH, WF_10 | WF_RESIZABLE); + w = WindowCreate(WindowClass::Peep, WW, WH, WF_10 | WF_RESIZABLE); if (w == nullptr) return nullptr; diff --git a/src/openrct2-ui/windows/StaffFirePrompt.cpp b/src/openrct2-ui/windows/StaffFirePrompt.cpp index afbdee4aee..986dd359be 100644 --- a/src/openrct2-ui/windows/StaffFirePrompt.cpp +++ b/src/openrct2-ui/windows/StaffFirePrompt.cpp @@ -56,13 +56,13 @@ rct_window* WindowStaffFirePromptOpen(Peep* peep) rct_window* w; // Check if the confirm window already exists. - w = window_bring_to_front_by_number(WC_FIRE_PROMPT, peep->sprite_index.ToUnderlying()); + w = window_bring_to_front_by_number(WindowClass::FirePrompt, peep->sprite_index.ToUnderlying()); if (w != nullptr) { return w; } - w = WindowCreateCentred(WW, WH, &window_staff_fire_events, WC_FIRE_PROMPT, WF_TRANSPARENT); + w = WindowCreateCentred(WW, WH, &window_staff_fire_events, WindowClass::FirePrompt, WF_TRANSPARENT); w->widgets = window_staff_fire_widgets; WindowInitScrollWidgets(*w); diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 8711df5857..07652ea616 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -147,7 +147,7 @@ public: } break; case WIDX_STAFF_LIST_MAP: - context_open_window(WC_MAP); + context_open_window(WindowClass::Map); break; case WIDX_STAFF_LIST_QUICK_FIRE: _quickFireMode = !_quickFireMode; @@ -184,7 +184,7 @@ public: InvalidateWidget(WIDX_STAFF_LIST_HANDYMEN_TAB + _selectedTab); // Enable highlighting of these staff members in map window - if (window_find_by_class(WC_MAP) != nullptr) + if (window_find_by_class(WindowClass::Map) != nullptr) { gWindowMapFlashingFlags |= MapFlashingFlags::StaffListOpen; for (auto peep : EntityList()) @@ -355,7 +355,7 @@ public: auto peep = GetEntity(spriteIndex); if (peep != nullptr) { - auto intent = Intent(WC_PEEP); + auto intent = Intent(WindowClass::Peep); intent.putExtra(INTENT_EXTRA_PEEP, peep); context_open_intent(&intent); } @@ -529,7 +529,7 @@ private: auto actionResult = res->GetData(); // Open window for new staff. auto* staff = GetEntity(actionResult.StaffEntityId); - auto intent = Intent(WC_PEEP); + auto intent = Intent(WindowClass::Peep); intent.putExtra(INTENT_EXTRA_PEEP, staff); context_open_intent(&intent); }); @@ -705,12 +705,12 @@ private: rct_window* WindowStaffListOpen() { - return WindowFocusOrCreate(WC_STAFF_LIST, WW, WH, WF_10 | WF_RESIZABLE); + return WindowFocusOrCreate(WindowClass::StaffList, WW, WH, WF_10 | WF_RESIZABLE); } void WindowStaffListRefresh() { - auto* window = window_find_by_class(WC_STAFF_LIST); + auto* window = window_find_by_class(WindowClass::StaffList); if (window != nullptr) { static_cast(window)->RefreshList(); diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index 7f88c61d63..26fd784a45 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -70,7 +70,7 @@ public: // Save calling window details so that the information can be passed back to the correct window & widget if (parentWindow == nullptr) { - _parentWidget.window.classification = WC_NULL; + _parentWidget.window.classification = WindowClass::Null; _parentWidget.window.number = 0; _parentWidget.widget_index = 0; @@ -360,7 +360,7 @@ private: bool HasParentWindow() const { - return _parentWidget.window.classification != WC_NULL; + return _parentWidget.window.classification != WindowClass::Null; } rct_window* GetParentWindow() const @@ -374,10 +374,10 @@ void WindowTextInputRawOpen( rct_window* call_w, rct_widgetindex call_widget, StringId title, StringId description, const Formatter& descriptionArgs, const_utf8string existing_text, int32_t maxLength) { - window_close_by_class(WC_TEXTINPUT); + window_close_by_class(WindowClass::Textinput); auto height = TextInputWindow::CalculateWindowHeight(existing_text); - auto w = WindowCreate(WC_TEXTINPUT, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT); + auto w = WindowCreate(WindowClass::Textinput, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT); if (w != nullptr) { w->SetParentWindow(call_w, call_widget); @@ -391,7 +391,7 @@ void WindowTextInputOpen( std::function callback, std::function cancelCallback) { auto height = TextInputWindow::CalculateWindowHeight(initialValue); - auto w = WindowCreate(WC_TEXTINPUT, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT); + auto w = WindowCreate(WindowClass::Textinput, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT); if (w != nullptr) { w->SetTitle(title, description); @@ -416,7 +416,7 @@ void WindowTextInputKey(rct_window* w, char keychar) // If the return button is pressed stop text input if (keychar == '\r') { - if (w->classification == WC_TEXTINPUT) + if (w->classification == WindowClass::Textinput) { auto textInputWindow = static_cast(w); textInputWindow->OnReturnPressed(); diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index dbdebc3364..c5f45294c8 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -162,92 +162,92 @@ static int32_t window_themes_tab_sprites[] = { SPR_TAB_FINANCES_MARKETING_0, }; -static rct_windowclass window_themes_tab_1_classes[] = { - WC_TOP_TOOLBAR, - WC_BOTTOM_TOOLBAR, - WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR, - WC_EDITOR_TRACK_BOTTOM_TOOLBAR, - WC_TITLE_MENU, - WC_TITLE_EXIT, - WC_TITLE_OPTIONS, - WC_SCENARIO_SELECT, +static WindowClass window_themes_tab_1_classes[] = { + WindowClass::TopToolbar, + WindowClass::BottomToolbar, + WindowClass::EditorScenarioBottomToolbar, + WindowClass::EditorTrackBottomToolbar, + WindowClass::TitleMenu, + WindowClass::TitleExit, + WindowClass::TitleOptions, + WindowClass::ScenarioSelect, }; -static rct_windowclass window_themes_tab_2_classes[] = { - WC_PARK_INFORMATION, - WC_FINANCES, - WC_NEW_CAMPAIGN, - WC_RESEARCH, - WC_MAP, - WC_VIEWPORT, - WC_RECENT_NEWS, +static WindowClass window_themes_tab_2_classes[] = { + WindowClass::ParkInformation, + WindowClass::Finances, + WindowClass::NewCampaign, + WindowClass::Research, + WindowClass::Map, + WindowClass::Viewport, + WindowClass::RecentNews, }; -static rct_windowclass window_themes_tab_3_classes[] = { - WC_LAND, - WC_WATER, - WC_CLEAR_SCENERY, - WC_LAND_RIGHTS, - WC_SCENERY, - WC_SCENERY_SCATTER, - WC_FOOTPATH, - WC_RIDE_CONSTRUCTION, - WC_TRACK_DESIGN_PLACE, - WC_CONSTRUCT_RIDE, - WC_TRACK_DESIGN_LIST, - WC_PATROL_AREA, +static WindowClass window_themes_tab_3_classes[] = { + WindowClass::Land, + WindowClass::Water, + WindowClass::ClearScenery, + WindowClass::LandRights, + WindowClass::Scenery, + WindowClass::SceneryScatter, + WindowClass::Footpath, + WindowClass::RideConstruction, + WindowClass::TrackDesignPlace, + WindowClass::ConstructRide, + WindowClass::TrackDesignList, + WindowClass::PatrolArea, }; -static rct_windowclass window_themes_tab_4_classes[] = { - WC_RIDE, - WC_RIDE_LIST, - WC_PEEP, - WC_GUEST_LIST, - WC_STAFF, - WC_STAFF_LIST, - WC_BANNER, +static WindowClass window_themes_tab_4_classes[] = { + WindowClass::Ride, + WindowClass::RideList, + WindowClass::Peep, + WindowClass::GuestList, + WindowClass::Staff, + WindowClass::StaffList, + WindowClass::Banner, }; -static rct_windowclass window_themes_tab_5_classes[] = { - WC_EDITOR_OBJECT_SELECTION, - WC_EDITOR_INVENTION_LIST, - WC_EDITOR_SCENARIO_OPTIONS, - WC_EDITOR_OBJECTIVE_OPTIONS, - WC_MAPGEN, - WC_MANAGE_TRACK_DESIGN, - WC_INSTALL_TRACK, +static WindowClass window_themes_tab_5_classes[] = { + WindowClass::EditorObjectSelection, + WindowClass::EditorInventionList, + WindowClass::EditorScenarioOptions, + WindowClass::EditorObjectiveOptions, + WindowClass::Mapgen, + WindowClass::ManageTrackDesign, + WindowClass::InstallTrack, }; -static rct_windowclass window_themes_tab_6_classes[] = { - WC_CHEATS, - WC_TILE_INSPECTOR, - WC_VIEW_CLIPPING, - WC_TRANSPARENCY, - WC_THEMES, - WC_OPTIONS, - WC_KEYBOARD_SHORTCUT_LIST, - WC_CHANGE_KEYBOARD_SHORTCUT, - WC_LOADSAVE, - WC_ABOUT, - WC_CHANGELOG, - WC_SERVER_LIST, - WC_MULTIPLAYER, - WC_PLAYER, - WC_CHAT, - WC_CONSOLE, +static WindowClass window_themes_tab_6_classes[] = { + WindowClass::Cheats, + WindowClass::TileInspector, + WindowClass::ViewClipping, + WindowClass::Transparency, + WindowClass::Themes, + WindowClass::Options, + WindowClass::KeyboardShortcutList, + WindowClass::ChangeKeyboardShortcut, + WindowClass::Loadsave, + WindowClass::About, + WindowClass::Changelog, + WindowClass::ServerList, + WindowClass::Multiplayer, + WindowClass::Player, + WindowClass::Chat, + WindowClass::Console, }; -static rct_windowclass window_themes_tab_7_classes[] = { - WC_SAVE_PROMPT, - WC_DEMOLISH_RIDE_PROMPT, - WC_FIRE_PROMPT, - WC_TRACK_DELETE_PROMPT, - WC_LOADSAVE_OVERWRITE_PROMPT, - WC_NETWORK_STATUS, +static WindowClass window_themes_tab_7_classes[] = { + WindowClass::SavePrompt, + WindowClass::DemolishRidePrompt, + WindowClass::FirePrompt, + WindowClass::TrackDeletePrompt, + WindowClass::LoadsaveOverwritePrompt, + WindowClass::NetworkStatus, }; // clang-format on -static rct_windowclass* window_themes_tab_classes[] = { +static WindowClass* window_themes_tab_classes[] = { nullptr, window_themes_tab_1_classes, window_themes_tab_2_classes, @@ -271,9 +271,9 @@ static void WindowThemesInitVars() _selected_tab = WINDOW_THEMES_TAB_SETTINGS; } -static rct_windowclass GetWindowClassTabIndex(int32_t index) +static WindowClass GetWindowClassTabIndex(int32_t index) { - rct_windowclass* classes = window_themes_tab_classes[_selected_tab]; + WindowClass* classes = window_themes_tab_classes[_selected_tab]; return classes[index]; } @@ -319,11 +319,11 @@ rct_window* WindowThemesOpen() rct_window* window; // Check if window is already open - window = window_bring_to_front_by_class(WC_THEMES); + window = window_bring_to_front_by_class(WindowClass::Themes); if (window != nullptr) return window; - window = WindowCreateAutoPos(320, 107, &window_themes_events, WC_THEMES, WF_10 | WF_RESIZABLE); + window = WindowCreateAutoPos(320, 107, &window_themes_events, WindowClass::Themes, WF_10 | WF_RESIZABLE); window->widgets = window_themes_widgets; WindowThemesInitVars(); @@ -571,7 +571,7 @@ static void WindowThemesDropdown(rct_window* w, rct_widgetindex widgetIndex, int case WIDX_THEMES_LIST: if (dropdownIndex != -1) { - rct_windowclass wc = GetWindowClassTabIndex(_colour_index_1); + WindowClass wc = GetWindowClassTabIndex(_colour_index_1); uint8_t colour = ThemeGetColour(wc, _colour_index_2); colour = (colour & COLOUR_FLAG_TRANSLUCENT) | dropdownIndex; ThemeSetColour(wc, _colour_index_2, colour); @@ -627,7 +627,7 @@ void WindowThemesScrollmousedown(rct_window* w, int32_t scrollIndex, const Scree _colour_index_1 = screenCoords.y / _row_height; _colour_index_2 = ((screenCoords.x - _button_offset_x) / 12); - rct_windowclass wc = GetWindowClassTabIndex(_colour_index_1); + WindowClass wc = GetWindowClassTabIndex(_colour_index_1); int32_t numColours = ThemeDescGetNumColours(wc); if (_colour_index_2 < numColours) { @@ -735,7 +735,7 @@ void WindowThemesInvalidate(rct_window* w) w->pressed_widgets = pressed_widgets | (1 << widgetIndex); - if (window_find_by_class(WC_DROPDOWN) == nullptr) + if (window_find_by_class(WindowClass::Dropdown) == nullptr) { _colour_index_1 = -1; _colour_index_2 = -1; @@ -884,7 +884,7 @@ void WindowThemesScrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scro } } - rct_windowclass wc = GetWindowClassTabIndex(i); + WindowClass wc = GetWindowClassTabIndex(i); int32_t numColours = ThemeDescGetNumColours(wc); for (uint8_t j = 0; j < numColours; j++) { diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index 1522f45e69..8a3f2c912c 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -515,11 +515,11 @@ rct_window* WindowTileInspectorOpen() rct_window* window; // Check if window is already open - window = window_bring_to_front_by_class(WC_TILE_INSPECTOR); + window = window_bring_to_front_by_class(WindowClass::TileInspector); if (window != nullptr) return window; - window = WindowCreate(ScreenCoordsXY(0, 29), WW, WH, &TileInspectorWindowEvents, WC_TILE_INSPECTOR, WF_RESIZABLE); + window = WindowCreate(ScreenCoordsXY(0, 29), WW, WH, &TileInspectorWindowEvents, WindowClass::TileInspector, WF_RESIZABLE); WindowTileInspectorSetPage(window, TileInspectorPage::Default); window->min_width = MIN_WW; @@ -1167,7 +1167,7 @@ static void WindowTileInspectorUpdate(rct_window* w) widget_invalidate(*w, WIDX_LIST); } - if (gCurrentToolWidget.window_classification != WC_TILE_INSPECTOR) + if (gCurrentToolWidget.window_classification != WindowClass::TileInspector) window_close(*w); } diff --git a/src/openrct2-ui/windows/TitleExit.cpp b/src/openrct2-ui/windows/TitleExit.cpp index f326b9ce9b..39330ee155 100644 --- a/src/openrct2-ui/windows/TitleExit.cpp +++ b/src/openrct2-ui/windows/TitleExit.cpp @@ -44,8 +44,8 @@ rct_window* WindowTitleExitOpen() rct_window* window; window = WindowCreate( - ScreenCoordsXY(context_get_width() - 40, context_get_height() - 64), 40, 64, &window_title_exit_events, WC_TITLE_EXIT, - WF_STICK_TO_BACK | WF_TRANSPARENT); + ScreenCoordsXY(context_get_width() - 40, context_get_height() - 64), 40, 64, &window_title_exit_events, + WindowClass::TitleExit, WF_STICK_TO_BACK | WF_TRANSPARENT); window->widgets = window_title_exit_widgets; WindowInitScrollWidgets(*window); diff --git a/src/openrct2-ui/windows/TitleLogo.cpp b/src/openrct2-ui/windows/TitleLogo.cpp index f926bc9384..65519b5085 100644 --- a/src/openrct2-ui/windows/TitleLogo.cpp +++ b/src/openrct2-ui/windows/TitleLogo.cpp @@ -45,7 +45,7 @@ static rct_window_event_list window_title_logo_events([](auto& events) rct_window* WindowTitleLogoOpen() { rct_window* window = WindowCreate( - ScreenCoordsXY(0, 0), WW, WH, &window_title_logo_events, WC_TITLE_LOGO, WF_STICK_TO_BACK | WF_TRANSPARENT); + ScreenCoordsXY(0, 0), WW, WH, &window_title_logo_events, WindowClass::TitleLogo, WF_STICK_TO_BACK | WF_TRANSPARENT); window->widgets = window_title_logo_widgets; WindowInitScrollWidgets(*window); window->colours[0] = TRANSLUCENT(COLOUR_GREY); diff --git a/src/openrct2-ui/windows/TitleMenu.cpp b/src/openrct2-ui/windows/TitleMenu.cpp index aa48d62bc2..8d45fc5411 100644 --- a/src/openrct2-ui/windows/TitleMenu.cpp +++ b/src/openrct2-ui/windows/TitleMenu.cpp @@ -83,7 +83,7 @@ rct_window* WindowTitleMenuOpen() const uint16_t windowHeight = MenuButtonDims.height + UpdateButtonDims.height; window = WindowCreate( - ScreenCoordsXY(0, context_get_height() - 182), 0, windowHeight, &window_title_menu_events, WC_TITLE_MENU, + ScreenCoordsXY(0, context_get_height() - 182), 0, windowHeight, &window_title_menu_events, WindowClass::TitleMenu, WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_BACKGROUND); window->widgets = window_title_menu_widgets; @@ -130,43 +130,43 @@ static void WindowTitleMenuMouseup(rct_window* w, rct_widgetindex widgetIndex) switch (widgetIndex) { case WIDX_START_NEW_GAME: - windowToOpen = window_find_by_class(WC_SCENARIO_SELECT); + windowToOpen = window_find_by_class(WindowClass::ScenarioSelect); if (windowToOpen != nullptr) { window_bring_to_front(*windowToOpen); } else { - window_close_by_class(WC_LOADSAVE); - window_close_by_class(WC_SERVER_LIST); + window_close_by_class(WindowClass::Loadsave); + window_close_by_class(WindowClass::ServerList); WindowScenarioselectOpen(WindowTitleMenuScenarioselectCallback, false); } break; case WIDX_CONTINUE_SAVED_GAME: - windowToOpen = window_find_by_class(WC_LOADSAVE); + windowToOpen = window_find_by_class(WindowClass::Loadsave); if (windowToOpen != nullptr) { window_bring_to_front(*windowToOpen); } else { - window_close_by_class(WC_SCENARIO_SELECT); - window_close_by_class(WC_SERVER_LIST); + window_close_by_class(WindowClass::ScenarioSelect); + window_close_by_class(WindowClass::ServerList); auto loadOrQuitAction = LoadOrQuitAction(LoadOrQuitModes::OpenSavePrompt); GameActions::Execute(&loadOrQuitAction); } break; case WIDX_MULTIPLAYER: - windowToOpen = window_find_by_class(WC_SERVER_LIST); + windowToOpen = window_find_by_class(WindowClass::ServerList); if (windowToOpen != nullptr) { window_bring_to_front(*windowToOpen); } else { - window_close_by_class(WC_SCENARIO_SELECT); - window_close_by_class(WC_LOADSAVE); - context_open_window(WC_SERVER_LIST); + window_close_by_class(WindowClass::ScenarioSelect); + window_close_by_class(WindowClass::Loadsave); + context_open_window(WindowClass::ServerList); } break; case WIDX_NEW_VERSION: diff --git a/src/openrct2-ui/windows/TitleOptions.cpp b/src/openrct2-ui/windows/TitleOptions.cpp index ef32768382..c49de7438c 100644 --- a/src/openrct2-ui/windows/TitleOptions.cpp +++ b/src/openrct2-ui/windows/TitleOptions.cpp @@ -40,7 +40,7 @@ static rct_window_event_list window_title_options_events([](auto& events) rct_window* WindowTitleOptionsOpen() { rct_window* window = WindowCreate( - ScreenCoordsXY(context_get_width() - 80, 0), 80, 15, &window_title_options_events, WC_TITLE_OPTIONS, + ScreenCoordsXY(context_get_width() - 80, 0), 80, 15, &window_title_options_events, WindowClass::TitleOptions, WF_STICK_TO_BACK | WF_TRANSPARENT); window->widgets = window_title_options_widgets; WindowInitScrollWidgets(*window); @@ -56,7 +56,7 @@ static void WindowTitleOptionsMouseup(rct_window* w, rct_widgetindex widgetIndex switch (widgetIndex) { case WIDX_OPTIONS: - context_open_window(WC_OPTIONS); + context_open_window(WindowClass::Options); break; } } diff --git a/src/openrct2-ui/windows/Tooltip.cpp b/src/openrct2-ui/windows/Tooltip.cpp index d56835bbf8..9190f442d3 100644 --- a/src/openrct2-ui/windows/Tooltip.cpp +++ b/src/openrct2-ui/windows/Tooltip.cpp @@ -43,7 +43,7 @@ void WindowTooltipReset(const ScreenCoordsXY& screenCoords) { gTooltipCursor = screenCoords; gTooltipTimeout = 0; - gTooltipWidget.window_classification = 255; + gTooltipWidget.window_classification = WindowClass::Null; input_set_state(InputState::Normal); input_set_flag(INPUT_FLAG_4, false); } @@ -69,7 +69,7 @@ static int32_t FormatTextForTooltip(const OpenRCT2String& message) void WindowTooltipShow(const OpenRCT2String& message, ScreenCoordsXY screenCoords) { - auto* w = window_find_by_class(WC_ERROR); + auto* w = window_find_by_class(WindowClass::Error); if (w != nullptr) return; @@ -94,7 +94,8 @@ void WindowTooltipShow(const OpenRCT2String& message, ScreenCoordsXY screenCoord screenCoords.y -= height + 40; screenCoords.y = std::clamp(screenCoords.y, 22, max_y); - w = WindowCreate(screenCoords, width, height, &window_tooltip_events, WC_TOOLTIP, WF_TRANSPARENT | WF_STICK_TO_FRONT); + w = WindowCreate( + screenCoords, width, height, &window_tooltip_events, WindowClass::Tooltip, WF_TRANSPARENT | WF_STICK_TO_FRONT); w->widgets = window_tooltip_widgets; reset_tooltip_not_shown(); @@ -146,9 +147,9 @@ void WindowTooltipOpen(rct_window* widgetWindow, rct_widgetindex widgetIndex, co */ void WindowTooltipClose() { - window_close_by_class(WC_TOOLTIP); + window_close_by_class(WindowClass::Tooltip); gTooltipTimeout = 0; - gTooltipWidget.window_classification = 255; + gTooltipWidget.window_classification = WindowClass::Null; } /** diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index fe072996d1..e36fdda37c 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -338,7 +338,7 @@ static int16_t _unkF64F0A; rct_window* WindowTopToolbarOpen() { rct_window* window = WindowCreate( - ScreenCoordsXY(0, 0), context_get_width(), TOP_TOOLBAR_HEIGHT + 1, &window_top_toolbar_events, WC_TOP_TOOLBAR, + ScreenCoordsXY(0, 0), context_get_width(), TOP_TOOLBAR_HEIGHT + 1, &window_top_toolbar_events, WindowClass::TopToolbar, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND); window->widgets = window_top_toolbar_widgets; @@ -385,35 +385,35 @@ static void WindowTopToolbarMouseup(rct_window* w, rct_widgetindex widgetIndex) if (!tool_set(*w, WIDX_SCENERY, Tool::Arrow)) { input_set_flag(INPUT_FLAG_6, true); - context_open_window(WC_SCENERY); + context_open_window(WindowClass::Scenery); } break; case WIDX_PATH: ToggleFootpathWindow(); break; case WIDX_CONSTRUCT_RIDE: - context_open_window(WC_CONSTRUCT_RIDE); + context_open_window(WindowClass::ConstructRide); break; case WIDX_RIDES: - context_open_window(WC_RIDE_LIST); + context_open_window(WindowClass::RideList); break; case WIDX_PARK: - context_open_window(WC_PARK_INFORMATION); + context_open_window(WindowClass::ParkInformation); break; case WIDX_STAFF: - context_open_window(WC_STAFF_LIST); + context_open_window(WindowClass::StaffList); break; case WIDX_GUESTS: - context_open_window(WC_GUEST_LIST); + context_open_window(WindowClass::GuestList); break; case WIDX_FINANCES: - context_open_window(WC_FINANCES); + context_open_window(WindowClass::Finances); break; case WIDX_RESEARCH: - context_open_window(WC_RESEARCH); + context_open_window(WindowClass::Research); break; case WIDX_NEWS: - context_open_window(WC_RECENT_NEWS); + context_open_window(WindowClass::RecentNews); break; case WIDX_MUTE: OpenRCT2::Audio::ToggleAllSounds(); @@ -534,7 +534,7 @@ static void WindowTopToolbarMousedown(rct_window* w, rct_widgetindex widgetIndex static void WindowTopToolbarScenarioselectCallback(const utf8* path) { - window_close_by_class(WC_EDITOR_OBJECT_SELECTION); + window_close_by_class(WindowClass::EditorObjectSelection); game_notify_map_change(); GetContext()->LoadParkFromFile(path, false, true); game_load_scripts(); @@ -573,7 +573,7 @@ static void WindowTopToolbarDropdown(rct_window* w, rct_widgetindex widgetIndex, { case DDIDX_NEW_GAME: { - auto intent = Intent(WC_SCENARIO_SELECT); + auto intent = Intent(WindowClass::ScenarioSelect); intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(WindowTopToolbarScenarioselectCallback)); context_open_intent(&intent); break; @@ -591,7 +591,7 @@ static void WindowTopToolbarDropdown(rct_window* w, rct_widgetindex widgetIndex, case DDIDX_SAVE_GAME_AS: if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) { - auto intent = Intent(WC_LOADSAVE); + auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); intent.putExtra(INTENT_EXTRA_PATH, gScenarioName); context_open_intent(&intent); @@ -603,10 +603,10 @@ static void WindowTopToolbarDropdown(rct_window* w, rct_widgetindex widgetIndex, } break; case DDIDX_ABOUT: - context_open_window(WC_ABOUT); + context_open_window(WindowClass::About); break; case DDIDX_OPTIONS: - context_open_window(WC_OPTIONS); + context_open_window(WindowClass::Options); break; case DDIDX_SCREENSHOT: gScreenshotCountdown = 10; @@ -628,8 +628,8 @@ static void WindowTopToolbarDropdown(rct_window* w, rct_widgetindex widgetIndex, break; case DDIDX_QUIT_TO_MENU: { - window_close_by_class(WC_MANAGE_TRACK_DESIGN); - window_close_by_class(WC_TRACK_DELETE_PROMPT); + window_close_by_class(WindowClass::ManageTrackDesign); + window_close_by_class(WindowClass::TrackDeletePrompt); auto loadOrQuitAction = LoadOrQuitAction(LoadOrQuitModes::OpenSavePrompt, PromptMode::SaveBeforeQuit); GameActions::Execute(&loadOrQuitAction); break; @@ -825,7 +825,7 @@ static void WindowTopToolbarInvalidate(rct_window* w) } // Footpath button pressed down - if (window_find_by_class(WC_FOOTPATH) == nullptr) + if (window_find_by_class(WindowClass::Footpath) == nullptr) w->pressed_widgets &= ~(1ULL << WIDX_PATH); else w->pressed_widgets |= (1ULL << WIDX_PATH); @@ -1244,7 +1244,7 @@ static void Sub6E1F34SmallScenery( const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, uint8_t* outQuadrant, Direction* outRotation) { - rct_window* w = window_find_by_class(WC_SCENERY); + rct_window* w = window_find_by_class(WindowClass::Scenery); if (w == nullptr) { @@ -1440,7 +1440,7 @@ static void Sub6E1F34SmallScenery( static void Sub6E1F34PathItem( const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, int32_t* outZ) { - rct_window* w = window_find_by_class(WC_SCENERY); + rct_window* w = window_find_by_class(WindowClass::Scenery); if (w == nullptr) { @@ -1473,7 +1473,7 @@ static void Sub6E1F34PathItem( static void Sub6E1F34Wall( const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, uint8_t* outEdges) { - rct_window* w = window_find_by_class(WC_SCENERY); + rct_window* w = window_find_by_class(WindowClass::Scenery); if (w == nullptr) { @@ -1562,7 +1562,7 @@ static void Sub6E1F34Wall( static void Sub6E1F34LargeScenery( const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, Direction* outDirection) { - rct_window* w = window_find_by_class(WC_SCENERY); + rct_window* w = window_find_by_class(WindowClass::Scenery); if (w == nullptr) { @@ -1662,7 +1662,7 @@ static void Sub6E1F34Banner( const ScreenCoordsXY& sourceScreenPos, ObjectEntryIndex sceneryIndex, CoordsXY& gridPos, int32_t* outZ, Direction* outDirection) { - rct_window* w = window_find_by_class(WC_SCENERY); + rct_window* w = window_find_by_class(WindowClass::Scenery); if (w == nullptr) { @@ -2022,7 +2022,7 @@ static uint8_t TopToolbarToolUpdateLandPaint(const ScreenCoordsXY& screenPos) if (gClearSceneryCost != MONEY64_UNDEFINED) { gClearSceneryCost = MONEY64_UNDEFINED; - window_invalidate_by_class(WC_CLEAR_SCENERY); + window_invalidate_by_class(WindowClass::ClearScenery); } return state_changed; } @@ -2093,7 +2093,7 @@ static void TopToolbarToolUpdateSceneryClear(const ScreenCoordsXY& screenPos) if (gClearSceneryCost != cost) { gClearSceneryCost = cost; - window_invalidate_by_class(WC_CLEAR_SCENERY); + window_invalidate_by_class(WindowClass::ClearScenery); } } @@ -2119,7 +2119,7 @@ static void TopToolbarToolUpdateLand(const ScreenCoordsXY& screenPos) { gLandToolRaiseCost = raise_cost; gLandToolLowerCost = lower_cost; - window_invalidate_by_class(WC_LAND); + window_invalidate_by_class(WindowClass::Land); } return; } @@ -2145,7 +2145,7 @@ static void TopToolbarToolUpdateLand(const ScreenCoordsXY& screenPos) { gLandToolRaiseCost = raise_cost; gLandToolLowerCost = lower_cost; - window_invalidate_by_class(WC_LAND); + window_invalidate_by_class(WindowClass::Land); } return; } @@ -2205,7 +2205,7 @@ static void TopToolbarToolUpdateLand(const ScreenCoordsXY& screenPos) { gLandToolRaiseCost = raise_cost; gLandToolLowerCost = lower_cost; - window_invalidate_by_class(WC_LAND); + window_invalidate_by_class(WindowClass::Land); } return; } @@ -2222,7 +2222,7 @@ static void TopToolbarToolUpdateLand(const ScreenCoordsXY& screenPos) { gLandToolRaiseCost = raise_cost; gLandToolLowerCost = lower_cost; - window_invalidate_by_class(WC_LAND); + window_invalidate_by_class(WindowClass::Land); } return; } @@ -2331,7 +2331,7 @@ static void TopToolbarToolUpdateLand(const ScreenCoordsXY& screenPos) { gLandToolRaiseCost = raise_cost; gLandToolLowerCost = lower_cost; - window_invalidate_by_class(WC_LAND); + window_invalidate_by_class(WindowClass::Land); } } @@ -2363,7 +2363,7 @@ static void TopToolbarToolUpdateWater(const ScreenCoordsXY& screenPos) { gWaterToolRaiseCost = raiseCost; gWaterToolLowerCost = lowerCost; - window_invalidate_by_class(WC_WATER); + window_invalidate_by_class(WindowClass::Water); } return; } @@ -2379,7 +2379,7 @@ static void TopToolbarToolUpdateWater(const ScreenCoordsXY& screenPos) { gWaterToolRaiseCost = MONEY64_UNDEFINED; gWaterToolLowerCost = MONEY64_UNDEFINED; - window_invalidate_by_class(WC_WATER); + window_invalidate_by_class(WindowClass::Water); } return; } @@ -2455,7 +2455,7 @@ static void TopToolbarToolUpdateWater(const ScreenCoordsXY& screenPos) { gWaterToolRaiseCost = raiseCost; gWaterToolLowerCost = lowerCost; - window_invalidate_by_class(WC_WATER); + window_invalidate_by_class(WindowClass::Water); } } @@ -3169,7 +3169,7 @@ static void WindowTopToolbarToolDrag(rct_window* w, rct_widgetindex widgetIndex, switch (widgetIndex) { case WIDX_CLEAR_SCENERY: - if (window_find_by_class(WC_ERROR) == nullptr && (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) + if (window_find_by_class(WindowClass::Error) == nullptr && (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)) { auto action = GetClearAction(); GameActions::Execute(&action); @@ -3333,13 +3333,13 @@ static void TopToolbarMapMenuDropdown(int16_t dropdownIndex) switch (dropdownIndex) { case 0: - context_open_window(WC_MAP); + context_open_window(WindowClass::Map); break; case 1: - context_open_window(WC_VIEWPORT); + context_open_window(WindowClass::Viewport); break; case 2: - context_open_window(WC_MAPGEN); + context_open_window(WindowClass::Mapgen); break; } } @@ -3519,23 +3519,23 @@ static void TopToolbarCheatsMenuDropdown(int16_t dropdownIndex) switch (dropdownIndex) { case DDIDX_CHEATS: - context_open_window(WC_CHEATS); + context_open_window(WindowClass::Cheats); break; case DDIDX_TILE_INSPECTOR: - context_open_window(WC_TILE_INSPECTOR); + context_open_window(WindowClass::TileInspector); break; case DDIDX_OBJECT_SELECTION: window_close_all(); - context_open_window(WC_EDITOR_OBJECT_SELECTION); + context_open_window(WindowClass::EditorObjectSelection); break; case DDIDX_INVENTIONS_LIST: - context_open_window(WC_EDITOR_INVENTION_LIST); + context_open_window(WindowClass::EditorInventionList); break; case DDIDX_SCENARIO_OPTIONS: - context_open_window(WC_EDITOR_SCENARIO_OPTIONS); + context_open_window(WindowClass::EditorScenarioOptions); break; case DDIDX_OBJECTIVE_OPTIONS: - context_open_window(WC_EDITOR_OBJECTIVE_OPTIONS); + context_open_window(WindowClass::EditorObjectiveOptions); break; case DDIDX_ENABLE_SANDBOX_MODE: CheatsSet(CheatType::SandboxMode, !gCheatsSandboxMode); @@ -3560,7 +3560,7 @@ static void TopToolbarInitDebugMenu(rct_window* w, rct_widget* widget) { w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[0] | 0x80, Dropdown::Flag::StayOpen, TOP_TOOLBAR_DEBUG_COUNT); - Dropdown::SetChecked(DDIDX_DEBUG_PAINT, window_find_by_class(WC_DEBUG_PAINT) != nullptr); + Dropdown::SetChecked(DDIDX_DEBUG_PAINT, window_find_by_class(WindowClass::DebugPaint) != nullptr); } static void TopToolbarInitNetworkMenu(rct_window* w, rct_widget* widget) @@ -3591,13 +3591,13 @@ static void TopToolbarDebugMenuDropdown(int16_t dropdownIndex) break; } case DDIDX_DEBUG_PAINT: - if (window_find_by_class(WC_DEBUG_PAINT) == nullptr) + if (window_find_by_class(WindowClass::DebugPaint) == nullptr) { - context_open_window(WC_DEBUG_PAINT); + context_open_window(WindowClass::DebugPaint); } else { - window_close_by_class(WC_DEBUG_PAINT); + window_close_by_class(WindowClass::DebugPaint); } break; } @@ -3612,7 +3612,7 @@ static void TopToolbarNetworkMenuDropdown(int16_t dropdownIndex) switch (dropdownIndex) { case DDIDX_MULTIPLAYER: - context_open_window(WC_MULTIPLAYER); + context_open_window(WindowClass::Multiplayer); break; case DDIDX_MULTIPLAYER_RECONNECT: network_reconnect(); @@ -3765,9 +3765,9 @@ static void TopToolbarViewMenuDropdown(int16_t dropdownIndex) w->viewport->flags ^= VIEWPORT_FLAG_PATH_HEIGHTS; break; case DDIDX_VIEW_CLIPPING: - if (window_find_by_class(WC_VIEW_CLIPPING) == nullptr) + if (window_find_by_class(WindowClass::ViewClipping) == nullptr) { - context_open_window(WC_VIEW_CLIPPING); + context_open_window(WindowClass::ViewClipping); } else { @@ -3779,7 +3779,7 @@ static void TopToolbarViewMenuDropdown(int16_t dropdownIndex) w->viewport->flags ^= VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES; break; case DDIDX_TRANSPARENCY: - context_open_window(WC_TRANSPARENCY); + context_open_window(WindowClass::Transparency); break; default: return; @@ -3794,14 +3794,14 @@ static void TopToolbarViewMenuDropdown(int16_t dropdownIndex) */ static void ToggleFootpathWindow() { - if (window_find_by_class(WC_FOOTPATH) == nullptr) + if (window_find_by_class(WindowClass::Footpath) == nullptr) { - context_open_window(WC_FOOTPATH); + context_open_window(WindowClass::Footpath); } else { tool_cancel(); - window_close_by_class(WC_FOOTPATH); + window_close_by_class(WindowClass::Footpath); } } @@ -3811,7 +3811,7 @@ static void ToggleFootpathWindow() */ static void ToggleLandWindow(rct_window* topToolbar, rct_widgetindex widgetIndex) { - if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WC_TOP_TOOLBAR + if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::TopToolbar && gCurrentToolWidget.widget_index == WIDX_LAND) { tool_cancel(); @@ -3822,7 +3822,7 @@ static void ToggleLandWindow(rct_window* topToolbar, rct_widgetindex widgetIndex show_gridlines(); tool_set(*topToolbar, widgetIndex, Tool::DigDown); input_set_flag(INPUT_FLAG_6, true); - context_open_window(WC_LAND); + context_open_window(WindowClass::Land); } } @@ -3832,7 +3832,7 @@ static void ToggleLandWindow(rct_window* topToolbar, rct_widgetindex widgetIndex */ static void ToggleClearSceneryWindow(rct_window* topToolbar, rct_widgetindex widgetIndex) { - if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == WC_TOP_TOOLBAR + if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == WindowClass::TopToolbar && gCurrentToolWidget.widget_index == WIDX_CLEAR_SCENERY)) { tool_cancel(); @@ -3842,7 +3842,7 @@ static void ToggleClearSceneryWindow(rct_window* topToolbar, rct_widgetindex wid show_gridlines(); tool_set(*topToolbar, widgetIndex, Tool::Crosshair); input_set_flag(INPUT_FLAG_6, true); - context_open_window(WC_CLEAR_SCENERY); + context_open_window(WindowClass::ClearScenery); } } @@ -3852,7 +3852,7 @@ static void ToggleClearSceneryWindow(rct_window* topToolbar, rct_widgetindex wid */ static void ToggleWaterWindow(rct_window* topToolbar, rct_widgetindex widgetIndex) { - if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WC_TOP_TOOLBAR + if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WindowClass::TopToolbar && gCurrentToolWidget.widget_index == WIDX_WATER) { tool_cancel(); @@ -3863,7 +3863,7 @@ static void ToggleWaterWindow(rct_window* topToolbar, rct_widgetindex widgetInde show_gridlines(); tool_set(*topToolbar, widgetIndex, Tool::WaterDown); input_set_flag(INPUT_FLAG_6, true); - context_open_window(WC_WATER); + context_open_window(WindowClass::Water); } } @@ -3875,7 +3875,7 @@ bool LandToolIsActive() { if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) return false; - if (gCurrentToolWidget.window_classification != WC_TOP_TOOLBAR) + if (gCurrentToolWidget.window_classification != WindowClass::TopToolbar) return false; if (gCurrentToolWidget.widget_index != WIDX_LAND) return false; @@ -3890,7 +3890,7 @@ bool ClearSceneryToolIsActive() { if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) return false; - if (gCurrentToolWidget.window_classification != WC_TOP_TOOLBAR) + if (gCurrentToolWidget.window_classification != WindowClass::TopToolbar) return false; if (gCurrentToolWidget.widget_index != WIDX_CLEAR_SCENERY) return false; @@ -3905,7 +3905,7 @@ bool WaterToolIsActive() { if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) return false; - if (gCurrentToolWidget.window_classification != WC_TOP_TOOLBAR) + if (gCurrentToolWidget.window_classification != WindowClass::TopToolbar) return false; if (gCurrentToolWidget.widget_index != WIDX_WATER) return false; diff --git a/src/openrct2-ui/windows/TrackDesignManage.cpp b/src/openrct2-ui/windows/TrackDesignManage.cpp index cb92587d10..a12e400c5e 100644 --- a/src/openrct2-ui/windows/TrackDesignManage.cpp +++ b/src/openrct2-ui/windows/TrackDesignManage.cpp @@ -94,14 +94,14 @@ static void WindowTrackDesignListReloadTracks(); */ rct_window* WindowTrackManageOpen(TrackDesignFileRef* tdFileRef) { - window_close_by_class(WC_MANAGE_TRACK_DESIGN); + window_close_by_class(WindowClass::ManageTrackDesign); rct_window* w = WindowCreateCentred( - WW, WH, &window_track_manage_events, WC_MANAGE_TRACK_DESIGN, WF_STICK_TO_FRONT | WF_TRANSPARENT); + WW, WH, &window_track_manage_events, WindowClass::ManageTrackDesign, WF_STICK_TO_FRONT | WF_TRANSPARENT); w->widgets = window_track_manage_widgets; WindowInitScrollWidgets(*w); - rct_window* trackDesignListWindow = window_find_by_class(WC_TRACK_DESIGN_LIST); + rct_window* trackDesignListWindow = window_find_by_class(WindowClass::TrackDesignList); if (trackDesignListWindow != nullptr) { trackDesignListWindow->track_list.track_list_being_updated = true; @@ -118,7 +118,7 @@ rct_window* WindowTrackManageOpen(TrackDesignFileRef* tdFileRef) */ static void WindowTrackManageClose(rct_window* w) { - rct_window* trackDesignListWindow = window_find_by_class(WC_TRACK_DESIGN_LIST); + rct_window* trackDesignListWindow = window_find_by_class(WindowClass::TrackDesignList); if (trackDesignListWindow != nullptr) { trackDesignListWindow->track_list.track_list_being_updated = false; @@ -134,7 +134,7 @@ static void WindowTrackManageMouseup(rct_window* w, rct_widgetindex widgetIndex) switch (widgetIndex) { case WIDX_CLOSE: - window_close_by_class(WC_TRACK_DELETE_PROMPT); + window_close_by_class(WindowClass::TrackDeletePrompt); window_close(*w); break; case WIDX_RENAME: @@ -173,7 +173,7 @@ static void WindowTrackManageTextinput(rct_window* w, rct_widgetindex widgetInde if (track_repository_rename(_trackDesignFileReference->path, text)) { - window_close_by_class(WC_TRACK_DELETE_PROMPT); + window_close_by_class(WindowClass::TrackDeletePrompt); window_close(*w); WindowTrackDesignListReloadTracks(); } @@ -199,14 +199,15 @@ static void WindowTrackManagePaint(rct_window* w, rct_drawpixelinfo* dpi) */ static void WindowTrackDeletePromptOpen() { - window_close_by_class(WC_TRACK_DELETE_PROMPT); + window_close_by_class(WindowClass::TrackDeletePrompt); int32_t screenWidth = context_get_width(); int32_t screenHeight = context_get_height(); rct_window* w = WindowCreate( ScreenCoordsXY( std::max(TOP_TOOLBAR_HEIGHT + 1, (screenWidth - WW_DELETE_PROMPT) / 2), (screenHeight - WH_DELETE_PROMPT) / 2), - WW_DELETE_PROMPT, WH_DELETE_PROMPT, &window_track_delete_prompt_events, WC_TRACK_DELETE_PROMPT, WF_STICK_TO_FRONT); + WW_DELETE_PROMPT, WH_DELETE_PROMPT, &window_track_delete_prompt_events, WindowClass::TrackDeletePrompt, + WF_STICK_TO_FRONT); w->widgets = window_track_delete_prompt_widgets; WindowInitScrollWidgets(*w); w->flags |= WF_TRANSPARENT; @@ -228,7 +229,7 @@ static void WindowTrackDeletePromptMouseup(rct_window* w, rct_widgetindex widget window_close(*w); if (track_repository_delete(_trackDesignFileReference->path)) { - window_close_by_class(WC_MANAGE_TRACK_DESIGN); + window_close_by_class(WindowClass::ManageTrackDesign); WindowTrackDesignListReloadTracks(); } else @@ -256,7 +257,7 @@ static void WindowTrackDeletePromptPaint(rct_window* w, rct_drawpixelinfo* dpi) static void WindowTrackDesignListReloadTracks() { - rct_window* trackListWindow = window_find_by_class(WC_TRACK_DESIGN_LIST); + rct_window* trackListWindow = window_find_by_class(WindowClass::TrackDesignList); if (trackListWindow != nullptr) { trackListWindow->track_list.reload_track_designs = true; diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 2a99e2348a..725830ff3e 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -126,7 +126,7 @@ public: case WIDX_SELECT_DIFFERENT_DESIGN: Close(); - auto intent = Intent(WC_TRACK_DESIGN_LIST); + auto intent = Intent(WindowClass::TrackDesignList); intent.putExtra(INTENT_EXTRA_RIDE_TYPE, _window_track_list_item.Type); intent.putExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, _window_track_list_item.EntryIndex); context_open_intent(&intent); @@ -137,7 +137,7 @@ public: void OnUpdate() override { if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) - if (gCurrentToolWidget.window_classification != WC_TRACK_DESIGN_PLACE) + if (gCurrentToolWidget.window_classification != WindowClass::TrackDesignPlace) Close(); } @@ -233,22 +233,22 @@ public: auto getRide = get_ride(rideId); if (getRide != nullptr) { - window_close_by_class(WC_ERROR); + window_close_by_class(WindowClass::Error); OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, trackLoc); _currentRideIndex = rideId; if (track_design_are_entrance_and_exit_placed()) { - auto intent = Intent(WC_RIDE); + auto intent = Intent(WindowClass::Ride); intent.putExtra(INTENT_EXTRA_RIDE_ID, rideId.ToUnderlying()); context_open_intent(&intent); - auto wnd = window_find_by_class(WC_TRACK_DESIGN_PLACE); + auto wnd = window_find_by_class(WindowClass::TrackDesignPlace); window_close(*wnd); } else { ride_initialise_construction_window(getRide); - auto wnd = window_find_by_class(WC_RIDE_CONSTRUCTION); + auto wnd = window_find_by_class(WindowClass::RideConstruction); window_event_mouse_up_call(wnd, WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); } } @@ -622,7 +622,7 @@ rct_window* WindowTrackPlaceOpen(const TrackDesignFileRef* tdFileRef) window_close_construction_windows(); - auto* window = WindowFocusOrCreate(WC_TRACK_DESIGN_PLACE, WW, WH, 0); + auto* window = WindowFocusOrCreate(WindowClass::TrackDesignPlace, WW, WH, 0); if (window != nullptr) { window->Init(std::move(openTrackDesign)); @@ -632,7 +632,7 @@ rct_window* WindowTrackPlaceOpen(const TrackDesignFileRef* tdFileRef) void TrackPlaceClearProvisionalTemporarily() { - auto* trackPlaceWnd = static_cast(window_find_by_class(WC_TRACK_DESIGN_PLACE)); + auto* trackPlaceWnd = static_cast(window_find_by_class(WindowClass::TrackDesignPlace)); if (trackPlaceWnd != nullptr) { trackPlaceWnd->ClearProvisionalTemporarily(); @@ -641,7 +641,7 @@ void TrackPlaceClearProvisionalTemporarily() void TrackPlaceRestoreProvisional() { - auto* trackPlaceWnd = static_cast(window_find_by_class(WC_TRACK_DESIGN_PLACE)); + auto* trackPlaceWnd = static_cast(window_find_by_class(WindowClass::TrackDesignPlace)); if (trackPlaceWnd != nullptr) { trackPlaceWnd->RestoreProvisional(); diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index 516ef1e5ad..c7bdc1c338 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -136,7 +136,7 @@ private: TrackDesignFileRef* tdRef = &_trackDesigns[trackDesignIndex]; if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { - auto intent = Intent(WC_MANAGE_TRACK_DESIGN); + auto intent = Intent(WindowClass::ManageTrackDesign); intent.putExtra(INTENT_EXTRA_TRACK_DESIGN, tdRef); context_open_intent(&intent); } @@ -148,7 +148,7 @@ private: context_show_error(STR_THIS_DESIGN_WILL_BE_BUILT_WITH_AN_ALTERNATIVE_VEHICLE_TYPE, STR_NONE, {}); } - auto intent = Intent(WC_TRACK_DESIGN_PLACE); + auto intent = Intent(WindowClass::TrackDesignPlace); intent.putExtra(INTENT_EXTRA_TRACK_DESIGN, tdRef); context_open_intent(&intent); } @@ -249,8 +249,8 @@ public: // try to load the track manager again, and an infinite loop will result. if ((gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && gScreenAge != 0) { - window_close_by_number(WC_MANAGE_TRACK_DESIGN, number); - window_close_by_number(WC_TRACK_DELETE_PROMPT, number); + window_close_by_number(WindowClass::ManageTrackDesign, number); + window_close_by_number(WindowClass::TrackDeletePrompt, number); Editor::LoadTrackManager(); } } @@ -276,7 +276,7 @@ public: Close(); if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) { - context_open_window(WC_CONSTRUCT_RIDE); + context_open_window(WindowClass::ConstructRide); } break; case WIDX_FILTER_STRING: @@ -757,7 +757,7 @@ rct_window* WindowTrackListOpen(const RideSelection item) { screenPos = { 0, TOP_TOOLBAR_HEIGHT + 2 }; } - auto* w = WindowCreate(WC_TRACK_DESIGN_LIST, WW, WH, 0); + auto* w = WindowCreate(WindowClass::TrackDesignList, WW, WH, 0); w->SetRideSelection(item); return w; } diff --git a/src/openrct2-ui/windows/Transparency.cpp b/src/openrct2-ui/windows/Transparency.cpp index ece3aad09e..dd4cb1c0e3 100644 --- a/src/openrct2-ui/windows/Transparency.cpp +++ b/src/openrct2-ui/windows/Transparency.cpp @@ -246,9 +246,9 @@ private: rct_window* WindowTransparencyOpen() { - auto* window = window_bring_to_front_by_class(WC_TRANSPARENCY); + auto* window = window_bring_to_front_by_class(WindowClass::Transparency); if (window == nullptr) - window = WindowCreate(WC_TRANSPARENCY, ScreenCoordsXY(32, 32), WW, WH); + window = WindowCreate(WindowClass::Transparency, ScreenCoordsXY(32, 32), WW, WH); return window; } diff --git a/src/openrct2-ui/windows/ViewClipping.cpp b/src/openrct2-ui/windows/ViewClipping.cpp index 3fc58a6569..7118a057c2 100644 --- a/src/openrct2-ui/windows/ViewClipping.cpp +++ b/src/openrct2-ui/windows/ViewClipping.cpp @@ -390,7 +390,7 @@ private: { if (!(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) return false; - if (gCurrentToolWidget.window_classification != WC_VIEW_CLIPPING) + if (gCurrentToolWidget.window_classification != WindowClass::ViewClipping) return false; return _toolActive; } @@ -398,10 +398,10 @@ private: rct_window* WindowViewClippingOpen() { - auto* window = window_bring_to_front_by_class(WC_VIEW_CLIPPING); + auto* window = window_bring_to_front_by_class(WindowClass::ViewClipping); if (window == nullptr) { - window = WindowCreate(WC_VIEW_CLIPPING, ScreenCoordsXY(32, 32), WW, WH); + window = WindowCreate(WindowClass::ViewClipping, ScreenCoordsXY(32, 32), WW, WH); } return window; } diff --git a/src/openrct2-ui/windows/Viewport.cpp b/src/openrct2-ui/windows/Viewport.cpp index de2af8d829..d7a5c62618 100644 --- a/src/openrct2-ui/windows/Viewport.cpp +++ b/src/openrct2-ui/windows/Viewport.cpp @@ -60,7 +60,7 @@ private: { number = 1; window_visit_each([&](rct_window* w) { - if (w != nullptr && w != this && w->classification == WC_VIEWPORT) + if (w != nullptr && w != this && w->classification == WindowClass::Viewport) { if (w->number >= number) number = w->number + 1; @@ -221,7 +221,7 @@ rct_window* WindowViewportOpen() int32_t width = (screenWidth / 2); int32_t height = (screenHeight / 2); - auto* w = WindowCreate(WC_VIEWPORT, std::max(WW, width), std::max(WH, height), WF_RESIZABLE); + auto* w = WindowCreate(WindowClass::Viewport, std::max(WW, width), std::max(WH, height), WF_RESIZABLE); if (w != nullptr) return w; diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index 0270681430..bc417140e9 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -187,5 +187,5 @@ private: rct_window* WindowWaterOpen() { - return WindowFocusOrCreate(WC_WATER, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0); + return WindowFocusOrCreate(WindowClass::Water, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0); } diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index e9cb9ae8f3..19e492f26a 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -317,7 +317,7 @@ namespace OpenRCT2 void Quit() override { gSavePromptMode = PromptMode::Quit; - context_open_window(WC_SAVE_PROMPT); + context_open_window(WindowClass::SavePrompt); } bool Initialise() final override @@ -707,7 +707,7 @@ namespace OpenRCT2 } // The path needs to be duplicated as it's a const here // which the window function doesn't like - auto intent = Intent(WC_OBJECT_LOAD_ERROR); + auto intent = Intent(WindowClass::ObjectLoadError); intent.putExtra(INTENT_EXTRA_PATH, path); intent.putExtra(INTENT_EXTRA_LIST, const_cast(e.MissingObjects.data())); intent.putExtra(INTENT_EXTRA_LIST_COUNT, static_cast(e.MissingObjects.size())); @@ -1454,13 +1454,13 @@ void context_set_cursor_trap(bool value) GetContext()->GetUiContext()->SetCursorTrap(value); } -rct_window* context_open_window(rct_windowclass wc) +rct_window* context_open_window(WindowClass wc) { auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); return windowManager->OpenWindow(wc); } -rct_window* context_open_window_view(rct_windowclass wc) +rct_window* context_open_window_view(uint8_t wc) { auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); return windowManager->OpenView(wc); @@ -1484,7 +1484,7 @@ void context_broadcast_intent(Intent* intent) windowManager->BroadcastIntent(*intent); } -void context_force_close_window_by_class(rct_windowclass windowClass) +void context_force_close_window_by_class(WindowClass windowClass) { auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); windowManager->ForceClose(windowClass); diff --git a/src/openrct2/Context.h b/src/openrct2/Context.h index cf841f102f..6de3276183 100644 --- a/src/openrct2/Context.h +++ b/src/openrct2/Context.h @@ -11,6 +11,7 @@ #include "common.h" #include "core/String.hpp" +#include "interface/WindowClasses.h" #include "world/Location.hpp" #include @@ -31,7 +32,6 @@ struct IGameStateSnapshots; class Intent; struct rct_window; -using rct_windowclass = uint8_t; struct NewVersionInfo; struct TTFFontDescriptor; @@ -208,13 +208,13 @@ int32_t context_get_width(); int32_t context_get_height(); bool context_has_focus(); void context_set_cursor_trap(bool value); -rct_window* context_open_window(rct_windowclass wc); +rct_window* context_open_window(WindowClass wc); rct_window* context_open_detail_window(uint8_t type, int32_t id); rct_window* context_open_window_view(uint8_t view); rct_window* context_show_error(StringId title, StringId message, const class Formatter& args); rct_window* context_open_intent(Intent* intent); void context_broadcast_intent(Intent* intent); -void context_force_close_window_by_class(rct_windowclass wc); +void context_force_close_window_by_class(WindowClass wc); void context_update_map_tooltip(); void context_handle_input(); void context_input_handle_keyboard(bool isTitle); diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index 4c7939756d..7026e3c10f 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -92,8 +92,8 @@ namespace Editor static rct_window* OpenEditorWindows() { - auto* main = context_open_window(WC_MAIN_WINDOW); - context_open_window(WC_TOP_TOOLBAR); + auto* main = context_open_window(WindowClass::MainWindow); + context_open_window(WindowClass::TopToolbar); context_open_window_view(WV_EDITOR_BOTTOM_TOOLBAR); return main; } @@ -126,7 +126,7 @@ namespace Editor void ConvertSaveToScenario() { tool_cancel(); - auto intent = Intent(WC_LOADSAVE); + auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(ConvertSaveToScenarioCallback)); context_open_intent(&intent); @@ -399,12 +399,12 @@ namespace Editor switch (gEditorStep) { case EditorStep::ObjectSelection: - if (window_find_by_class(WC_EDITOR_OBJECT_SELECTION) != nullptr) + if (window_find_by_class(WindowClass::EditorObjectSelection) != nullptr) { return; } - if (window_find_by_class(WC_INSTALL_TRACK) != nullptr) + if (window_find_by_class(WindowClass::InstallTrack) != nullptr) { return; } @@ -414,31 +414,31 @@ namespace Editor object_manager_unload_all_objects(); } - context_open_window(WC_EDITOR_OBJECT_SELECTION); + context_open_window(WindowClass::EditorObjectSelection); break; case EditorStep::InventionsListSetUp: - if (window_find_by_class(WC_EDITOR_INVENTION_LIST) != nullptr) + if (window_find_by_class(WindowClass::EditorInventionList) != nullptr) { return; } - context_open_window(WC_EDITOR_INVENTION_LIST); + context_open_window(WindowClass::EditorInventionList); break; case EditorStep::OptionsSelection: - if (window_find_by_class(WC_EDITOR_SCENARIO_OPTIONS) != nullptr) + if (window_find_by_class(WindowClass::EditorScenarioOptions) != nullptr) { return; } - context_open_window(WC_EDITOR_SCENARIO_OPTIONS); + context_open_window(WindowClass::EditorScenarioOptions); break; case EditorStep::ObjectiveSelection: - if (window_find_by_class(WC_EDITOR_OBJECTIVE_OPTIONS) != nullptr) + if (window_find_by_class(WindowClass::EditorObjectiveOptions) != nullptr) { return; } - context_open_window(WC_EDITOR_OBJECTIVE_OPTIONS); + context_open_window(WindowClass::EditorObjectiveOptions); break; case EditorStep::LandscapeEditor: case EditorStep::SaveScenario: diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 6cd56f0336..03ac5a0778 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -95,7 +95,7 @@ using namespace OpenRCT2; void game_reset_speed() { gGameSpeed = 1; - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::TopToolbar); } void game_increase_game_speed() @@ -103,7 +103,7 @@ void game_increase_game_speed() gGameSpeed = std::min(gConfigGeneral.debugging_tools ? 5 : 4, gGameSpeed + 1); if (gGameSpeed == 5) gGameSpeed = 8; - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::TopToolbar); } void game_reduce_game_speed() @@ -111,7 +111,7 @@ void game_reduce_game_speed() gGameSpeed = std::max(1, gGameSpeed - 1); if (gGameSpeed == 7) gGameSpeed = 4; - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::TopToolbar); } /** @@ -120,9 +120,9 @@ void game_reduce_game_speed() */ void game_create_windows() { - context_open_window(WC_MAIN_WINDOW); - context_open_window(WC_TOP_TOOLBAR); - context_open_window(WC_BOTTOM_TOOLBAR); + context_open_window(WindowClass::MainWindow); + context_open_window(WindowClass::TopToolbar); + context_open_window(WindowClass::BottomToolbar); window_resize_gui(context_get_width(), context_get_height()); } @@ -300,7 +300,7 @@ void update_palette_effects() void pause_toggle() { gGamePaused ^= GAME_PAUSED_NORMAL; - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::TopToolbar); if (gGamePaused & GAME_PAUSED_NORMAL) { OpenRCT2::Audio::StopAll(); @@ -323,7 +323,7 @@ bool game_is_not_paused() */ static void load_landscape() { - auto intent = Intent(WC_LOADSAVE); + auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_LANDSCAPE); context_open_intent(&intent); } @@ -603,7 +603,7 @@ std::unique_ptr create_save_game_as_intent() { auto name = Path::GetFileNameWithoutExtension(gScenarioSavePath); - auto intent = std::make_unique(WC_LOADSAVE); + auto intent = std::make_unique(WindowClass::Loadsave); intent->putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_GAME); intent->putExtra(INTENT_EXTRA_PATH, name); @@ -722,7 +722,7 @@ static void game_load_or_quit_no_save_prompt_callback(int32_t result, const utf8 { game_notify_map_change(); game_unload_scripts(); - window_close_by_class(WC_EDITOR_OBJECT_SELECTION); + window_close_by_class(WindowClass::EditorObjectSelection); context_load_park_from_file(path); game_load_scripts(); game_notify_map_changed(); @@ -748,7 +748,7 @@ void game_load_or_quit_no_save_prompt() } else { - auto intent = Intent(WC_LOADSAVE); + auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(game_load_or_quit_no_save_prompt_callback)); context_open_intent(&intent); diff --git a/src/openrct2/Input.h b/src/openrct2/Input.h index 2d5922f0d6..ff6e92ba73 100644 --- a/src/openrct2/Input.h +++ b/src/openrct2/Input.h @@ -68,7 +68,7 @@ enum PLACE_OBJECT_MODIFIER struct widget_ref { - rct_windowclass window_classification; + WindowClass window_classification; rct_windownumber window_number; rct_widgetindex widget_index; }; diff --git a/src/openrct2/actions/LoadOrQuitAction.cpp b/src/openrct2/actions/LoadOrQuitAction.cpp index 82411494d1..5fd7033873 100644 --- a/src/openrct2/actions/LoadOrQuitAction.cpp +++ b/src/openrct2/actions/LoadOrQuitAction.cpp @@ -42,10 +42,10 @@ GameActions::Result LoadOrQuitAction::Execute() const { case LoadOrQuitModes::OpenSavePrompt: gSavePromptMode = _savePromptMode; - context_open_window(WC_SAVE_PROMPT); + context_open_window(WindowClass::SavePrompt); break; case LoadOrQuitModes::CloseSavePrompt: - window_close_by_class(WC_SAVE_PROMPT); + window_close_by_class(WindowClass::SavePrompt); break; default: game_load_or_quit_no_save_prompt(); diff --git a/src/openrct2/actions/ParkSetParameterAction.cpp b/src/openrct2/actions/ParkSetParameterAction.cpp index d6cd6f7387..c5910f0dbe 100644 --- a/src/openrct2/actions/ParkSetParameterAction.cpp +++ b/src/openrct2/actions/ParkSetParameterAction.cpp @@ -51,19 +51,19 @@ GameActions::Result ParkSetParameterAction::Execute() const if (gParkFlags & PARK_FLAGS_PARK_OPEN) { gParkFlags &= ~PARK_FLAGS_PARK_OPEN; - window_invalidate_by_class(WC_PARK_INFORMATION); + window_invalidate_by_class(WindowClass::ParkInformation); } break; case ParkParameter::Open: if (!(gParkFlags & PARK_FLAGS_PARK_OPEN)) { gParkFlags |= PARK_FLAGS_PARK_OPEN; - window_invalidate_by_class(WC_PARK_INFORMATION); + window_invalidate_by_class(WindowClass::ParkInformation); } break; case ParkParameter::SamePriceInPark: gSamePriceThroughoutPark = _value; - window_invalidate_by_class(WC_RIDE); + window_invalidate_by_class(WindowClass::Ride); break; default: return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); diff --git a/src/openrct2/actions/RideCreateAction.cpp b/src/openrct2/actions/RideCreateAction.cpp index 7c9391ae15..c2595025c1 100644 --- a/src/openrct2/actions/RideCreateAction.cpp +++ b/src/openrct2/actions/RideCreateAction.cpp @@ -319,7 +319,7 @@ GameActions::Result RideCreateAction::Execute() const ride->MinCarsPerTrain = rideEntry->min_cars_in_train; ride->MaxCarsPerTrain = rideEntry->max_cars_in_train; ride_set_vehicle_colours_to_random_preset(ride, _colour2); - window_invalidate_by_class(WC_RIDE_LIST); + window_invalidate_by_class(WindowClass::RideList); res.Expenditure = ExpenditureType::RideConstruction; res.SetData(RideId{ rideIndex }); diff --git a/src/openrct2/actions/RideDemolishAction.cpp b/src/openrct2/actions/RideDemolishAction.cpp index c332cbe3d3..fc00b6846f 100644 --- a/src/openrct2/actions/RideDemolishAction.cpp +++ b/src/openrct2/actions/RideDemolishAction.cpp @@ -157,10 +157,10 @@ GameActions::Result RideDemolishAction::DemolishRide(Ride* ride) const gParkValue = GetContext()->GetGameState()->GetPark().CalculateParkValue(); // Close windows related to the demolished ride - window_close_by_number(WC_RIDE_CONSTRUCTION, rideId.ToUnderlying()); - window_close_by_number(WC_RIDE, rideId.ToUnderlying()); - window_close_by_number(WC_DEMOLISH_RIDE_PROMPT, rideId.ToUnderlying()); - window_close_by_class(WC_NEW_CAMPAIGN); + window_close_by_number(WindowClass::RideConstruction, rideId.ToUnderlying()); + window_close_by_number(WindowClass::Ride, rideId.ToUnderlying()); + window_close_by_number(WindowClass::DemolishRidePrompt, rideId.ToUnderlying()); + window_close_by_class(WindowClass::NewCampaign); // Refresh windows that display the ride name auto windowManager = OpenRCT2::GetContext()->GetUiContext()->GetWindowManager(); @@ -284,7 +284,7 @@ GameActions::Result RideDemolishAction::RefurbishRide(Ride* ride) const res.Position = { location, tile_element_height(location) }; } - window_close_by_number(WC_DEMOLISH_RIDE_PROMPT, _rideIndex.ToUnderlying()); + window_close_by_number(WindowClass::DemolishRidePrompt, _rideIndex.ToUnderlying()); return res; } diff --git a/src/openrct2/actions/RideSetAppearanceAction.cpp b/src/openrct2/actions/RideSetAppearanceAction.cpp index b5275d1be1..0536e7f284 100644 --- a/src/openrct2/actions/RideSetAppearanceAction.cpp +++ b/src/openrct2/actions/RideSetAppearanceAction.cpp @@ -142,7 +142,7 @@ GameActions::Result RideSetAppearanceAction::Execute() const ride->SetLifecycleFlag(RIDE_LIFECYCLE_RANDOM_SHOP_COLOURS, static_cast(_value)); break; } - window_invalidate_by_number(WC_RIDE, _rideIndex.ToUnderlying()); + window_invalidate_by_number(WindowClass::Ride, _rideIndex.ToUnderlying()); auto res = GameActions::Result(); if (!ride->overall_view.IsNull()) diff --git a/src/openrct2/actions/RideSetPriceAction.cpp b/src/openrct2/actions/RideSetPriceAction.cpp index ae66fa0f23..2eadbe71f6 100644 --- a/src/openrct2/actions/RideSetPriceAction.cpp +++ b/src/openrct2/actions/RideSetPriceAction.cpp @@ -105,7 +105,7 @@ GameActions::Result RideSetPriceAction::Execute() const if (shopItem == ShopItem::None) { ride->price[0] = _price; - window_invalidate_by_class(WC_RIDE); + window_invalidate_by_class(WindowClass::Ride); return res; } } @@ -113,7 +113,7 @@ GameActions::Result RideSetPriceAction::Execute() const if (!shop_item_has_common_price(shopItem)) { ride->price[0] = _price; - window_invalidate_by_class(WC_RIDE); + window_invalidate_by_class(WindowClass::Ride); return res; } } @@ -126,7 +126,7 @@ GameActions::Result RideSetPriceAction::Execute() const if ((ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO) == 0) { ride->price[1] = _price; - window_invalidate_by_class(WC_RIDE); + window_invalidate_by_class(WindowClass::Ride); return res; } } @@ -134,7 +134,7 @@ GameActions::Result RideSetPriceAction::Execute() const if (!shop_item_has_common_price(shopItem)) { ride->price[1] = _price; - window_invalidate_by_class(WC_RIDE); + window_invalidate_by_class(WindowClass::Ride); return res; } } @@ -183,7 +183,7 @@ void RideSetPriceAction::RideSetCommonPrice(ShopItem shopItem) const } if (invalidate) { - window_invalidate_by_number(WC_RIDE, ride.id.ToUnderlying()); + window_invalidate_by_number(WindowClass::Ride, ride.id.ToUnderlying()); } } } diff --git a/src/openrct2/actions/RideSetSettingAction.cpp b/src/openrct2/actions/RideSetSettingAction.cpp index d630414c4a..3ce5495732 100644 --- a/src/openrct2/actions/RideSetSettingAction.cpp +++ b/src/openrct2/actions/RideSetSettingAction.cpp @@ -236,7 +236,7 @@ GameActions::Result RideSetSettingAction::Execute() const auto location = ride->overall_view.ToTileCentre(); res.Position = { location, tile_element_height(location) }; } - window_invalidate_by_number(WC_RIDE, _rideIndex.ToUnderlying()); + window_invalidate_by_number(WindowClass::Ride, _rideIndex.ToUnderlying()); return res; } diff --git a/src/openrct2/actions/RideSetStatusAction.cpp b/src/openrct2/actions/RideSetStatusAction.cpp index 59c2074c46..6a97cf1373 100644 --- a/src/openrct2/actions/RideSetStatusAction.cpp +++ b/src/openrct2/actions/RideSetStatusAction.cpp @@ -157,7 +157,7 @@ GameActions::Result RideSetStatusAction::Execute() const ride->lifecycle_flags &= ~RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING; ride->race_winner = EntityId::GetNull(); ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST; - window_invalidate_by_number(WC_RIDE, _rideIndex.ToUnderlying()); + window_invalidate_by_number(WindowClass::Ride, _rideIndex.ToUnderlying()); break; case RideStatus::Simulating: { @@ -180,7 +180,7 @@ GameActions::Result RideSetStatusAction::Execute() const ride->last_issue_time = 0; ride->GetMeasurement(); ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST; - window_invalidate_by_number(WC_RIDE, _rideIndex.ToUnderlying()); + window_invalidate_by_number(WindowClass::Ride, _rideIndex.ToUnderlying()); break; } case RideStatus::Testing: @@ -199,7 +199,7 @@ GameActions::Result RideSetStatusAction::Execute() const // 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) - rct_window* constructionWindow = window_find_by_number(WC_RIDE_CONSTRUCTION, _rideIndex.ToUnderlying()); + rct_window* constructionWindow = window_find_by_number(WindowClass::RideConstruction, _rideIndex.ToUnderlying()); if (constructionWindow != nullptr) { window_close(*constructionWindow); @@ -232,7 +232,7 @@ GameActions::Result RideSetStatusAction::Execute() const ride->last_issue_time = 0; ride->GetMeasurement(); ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST; - window_invalidate_by_number(WC_RIDE, _rideIndex.ToUnderlying()); + window_invalidate_by_number(WindowClass::Ride, _rideIndex.ToUnderlying()); break; } default: diff --git a/src/openrct2/actions/ScenarioSetSettingAction.cpp b/src/openrct2/actions/ScenarioSetSettingAction.cpp index cf58706178..02202b1d65 100644 --- a/src/openrct2/actions/ScenarioSetSettingAction.cpp +++ b/src/openrct2/actions/ScenarioSetSettingAction.cpp @@ -64,33 +64,33 @@ GameActions::Result ScenarioSetSettingAction::Execute() const gParkFlags &= ~PARK_FLAGS_NO_MONEY; } // Invalidate all windows that have anything to do with finance - window_invalidate_by_class(WC_RIDE); - window_invalidate_by_class(WC_PEEP); - window_invalidate_by_class(WC_PARK_INFORMATION); - window_invalidate_by_class(WC_FINANCES); - window_invalidate_by_class(WC_BOTTOM_TOOLBAR); - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::Ride); + window_invalidate_by_class(WindowClass::Peep); + window_invalidate_by_class(WindowClass::ParkInformation); + window_invalidate_by_class(WindowClass::Finances); + window_invalidate_by_class(WindowClass::BottomToolbar); + window_invalidate_by_class(WindowClass::TopToolbar); } break; case ScenarioSetSetting::InitialCash: gInitialCash = std::clamp(_value, 0.00_GBP, 1000000.00_GBP); gCash = gInitialCash; - window_invalidate_by_class(WC_FINANCES); - window_invalidate_by_class(WC_BOTTOM_TOOLBAR); + window_invalidate_by_class(WindowClass::Finances); + window_invalidate_by_class(WindowClass::BottomToolbar); break; case ScenarioSetSetting::InitialLoan: gBankLoan = std::clamp(_value, 0.00_GBP, 5000000.00_GBP); gMaxBankLoan = std::max(gBankLoan, gMaxBankLoan); - window_invalidate_by_class(WC_FINANCES); + window_invalidate_by_class(WindowClass::Finances); break; case ScenarioSetSetting::MaximumLoanSize: gMaxBankLoan = std::clamp(_value, 0.00_GBP, 5000000.00_GBP); gBankLoan = std::min(gBankLoan, gMaxBankLoan); - window_invalidate_by_class(WC_FINANCES); + window_invalidate_by_class(WindowClass::Finances); break; case ScenarioSetSetting::AnnualInterestRate: gBankLoanInterestRate = std::clamp(_value, 0, 80); - window_invalidate_by_class(WC_FINANCES); + window_invalidate_by_class(WindowClass::Finances); break; case ScenarioSetSetting::ForbidMarketingCampaigns: if (_value != 0) @@ -179,13 +179,13 @@ GameActions::Result ScenarioSetSettingAction::Execute() const gParkFlags |= PARK_FLAGS_PARK_FREE_ENTRY; gParkFlags |= PARK_FLAGS_UNLOCK_ALL_PRICES; } - window_invalidate_by_class(WC_PARK_INFORMATION); - window_invalidate_by_class(WC_RIDE); + window_invalidate_by_class(WindowClass::ParkInformation); + window_invalidate_by_class(WindowClass::Ride); } break; case ScenarioSetSetting::ParkChargeEntryFee: gParkEntranceFee = std::clamp(_value, 0.00_GBP, MAX_ENTRANCE_FEE); - window_invalidate_by_class(WC_PARK_INFORMATION); + window_invalidate_by_class(WindowClass::ParkInformation); break; case ScenarioSetSetting::ForbidTreeRemoval: if (_value != 0) @@ -244,6 +244,6 @@ GameActions::Result ScenarioSetSettingAction::Execute() const log_error("Invalid setting: %u", _setting); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } - window_invalidate_by_class(WC_EDITOR_SCENARIO_OPTIONS); + window_invalidate_by_class(WindowClass::EditorScenarioOptions); return GameActions::Result(); } diff --git a/src/openrct2/actions/SetCheatAction.cpp b/src/openrct2/actions/SetCheatAction.cpp index 5b9d84bd2d..950a61fcfc 100644 --- a/src/openrct2/actions/SetCheatAction.cpp +++ b/src/openrct2/actions/SetCheatAction.cpp @@ -92,13 +92,13 @@ GameActions::Result SetCheatAction::Execute() const { case CheatType::SandboxMode: gCheatsSandboxMode = _param1 != 0; - window_invalidate_by_class(WC_MAP); - window_invalidate_by_class(WC_FOOTPATH); + window_invalidate_by_class(WindowClass::Map); + window_invalidate_by_class(WindowClass::Footpath); break; case CheatType::DisableClearanceChecks: gCheatsDisableClearanceChecks = _param1 != 0; // Required to update the clearance checks overlay on the Cheats button. - window_invalidate_by_class(WC_TOP_TOOLBAR); + window_invalidate_by_class(WindowClass::TopToolbar); break; case CheatType::DisableSupportLimits: gCheatsDisableSupportLimits = _param1 != 0; @@ -217,7 +217,7 @@ GameActions::Result SetCheatAction::Execute() const break; case CheatType::AllowArbitraryRideTypeChanges: gCheatsAllowArbitraryRideTypeChanges = _param1 != 0; - window_invalidate_by_class(WC_RIDE); + window_invalidate_by_class(WindowClass::Ride); break; case CheatType::OwnAllLand: OwnAllLand(); @@ -253,7 +253,7 @@ GameActions::Result SetCheatAction::Execute() const config_save_default(); } - window_invalidate_by_class(WC_CHEATS); + window_invalidate_by_class(WindowClass::Cheats); return GameActions::Result(); } @@ -463,7 +463,7 @@ void SetCheatAction::RenewRides() const { ride.Renew(); } - window_invalidate_by_class(WC_RIDE); + window_invalidate_by_class(WindowClass::Ride); } void SetCheatAction::MakeDestructible() const @@ -473,7 +473,7 @@ void SetCheatAction::MakeDestructible() const ride.lifecycle_flags &= ~RIDE_LIFECYCLE_INDESTRUCTIBLE; ride.lifecycle_flags &= ~RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK; } - window_invalidate_by_class(WC_RIDE); + window_invalidate_by_class(WindowClass::Ride); } void SetCheatAction::ResetRideCrashStatus() const @@ -484,7 +484,7 @@ void SetCheatAction::ResetRideCrashStatus() const ride.lifecycle_flags &= ~RIDE_LIFECYCLE_CRASHED; ride.last_crash_type = RIDE_CRASH_TYPE_NONE; } - window_invalidate_by_class(WC_RIDE); + window_invalidate_by_class(WindowClass::Ride); } void SetCheatAction::Set10MinuteInspection() const @@ -494,7 +494,7 @@ void SetCheatAction::Set10MinuteInspection() const // Set inspection interval to 10 minutes ride.inspection_interval = RIDE_INSPECTION_EVERY_10_MINUTES; } - window_invalidate_by_class(WC_RIDE); + window_invalidate_by_class(WindowClass::Ride); } void SetCheatAction::SetScenarioNoMoney(bool enabled) const @@ -508,29 +508,29 @@ void SetCheatAction::SetScenarioNoMoney(bool enabled) const gParkFlags &= ~PARK_FLAGS_NO_MONEY; } // Invalidate all windows that have anything to do with finance - window_invalidate_by_class(WC_RIDE); - window_invalidate_by_class(WC_PEEP); - window_invalidate_by_class(WC_PARK_INFORMATION); - window_invalidate_by_class(WC_FINANCES); - window_invalidate_by_class(WC_BOTTOM_TOOLBAR); - window_invalidate_by_class(WC_TOP_TOOLBAR); - window_invalidate_by_class(WC_CHEATS); + window_invalidate_by_class(WindowClass::Ride); + window_invalidate_by_class(WindowClass::Peep); + window_invalidate_by_class(WindowClass::ParkInformation); + window_invalidate_by_class(WindowClass::Finances); + window_invalidate_by_class(WindowClass::BottomToolbar); + window_invalidate_by_class(WindowClass::TopToolbar); + window_invalidate_by_class(WindowClass::Cheats); } void SetCheatAction::SetMoney(money32 amount) const { gCash = amount; - window_invalidate_by_class(WC_FINANCES); - window_invalidate_by_class(WC_BOTTOM_TOOLBAR); + window_invalidate_by_class(WindowClass::Finances); + window_invalidate_by_class(WindowClass::BottomToolbar); } void SetCheatAction::AddMoney(money32 amount) const { gCash = add_clamp_money32(gCash, amount); - window_invalidate_by_class(WC_FINANCES); - window_invalidate_by_class(WC_BOTTOM_TOOLBAR); + window_invalidate_by_class(WindowClass::Finances); + window_invalidate_by_class(WindowClass::BottomToolbar); } void SetCheatAction::ClearLoan() const @@ -550,7 +550,7 @@ void SetCheatAction::GenerateGuests(int32_t count) const { park.GenerateGuest(); } - window_invalidate_by_class(WC_BOTTOM_TOOLBAR); + window_invalidate_by_class(WindowClass::BottomToolbar); } void SetCheatAction::SetGuestParameter(int32_t parameter, int32_t value) const @@ -621,7 +621,7 @@ void SetCheatAction::GiveObjectToGuests(int32_t object) const break; } } - window_invalidate_by_class(WC_PEEP); + window_invalidate_by_class(WindowClass::Peep); } void SetCheatAction::RemoveAllGuests() const @@ -668,7 +668,7 @@ void SetCheatAction::RemoveAllGuests() const guest->Remove(); } - window_invalidate_by_class(WC_RIDE); + window_invalidate_by_class(WindowClass::Ride); gfx_invalidate_screen(); } diff --git a/src/openrct2/actions/SetParkEntranceFeeAction.cpp b/src/openrct2/actions/SetParkEntranceFeeAction.cpp index 5d4156feca..24f1d8fbff 100644 --- a/src/openrct2/actions/SetParkEntranceFeeAction.cpp +++ b/src/openrct2/actions/SetParkEntranceFeeAction.cpp @@ -55,6 +55,6 @@ GameActions::Result SetParkEntranceFeeAction::Query() const GameActions::Result SetParkEntranceFeeAction::Execute() const { gParkEntranceFee = _fee; - window_invalidate_by_class(WC_PARK_INFORMATION); + window_invalidate_by_class(WindowClass::ParkInformation); return GameActions::Result(); } diff --git a/src/openrct2/actions/StaffFireAction.cpp b/src/openrct2/actions/StaffFireAction.cpp index 250840accd..cc0c309f9f 100644 --- a/src/openrct2/actions/StaffFireAction.cpp +++ b/src/openrct2/actions/StaffFireAction.cpp @@ -60,7 +60,7 @@ GameActions::Result StaffFireAction::Execute() const log_error("Invalid spriteId. spriteId = %u", _spriteId); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } - window_close_by_class(WC_FIRE_PROMPT); + window_close_by_class(WindowClass::FirePrompt); peep_sprite_remove(staff); // Due to patrol areas best to invalidate the whole screen on removal of staff gfx_invalidate_screen(); diff --git a/src/openrct2/actions/StaffSetCostumeAction.cpp b/src/openrct2/actions/StaffSetCostumeAction.cpp index 2944981c02..c7f6947c10 100644 --- a/src/openrct2/actions/StaffSetCostumeAction.cpp +++ b/src/openrct2/actions/StaffSetCostumeAction.cpp @@ -97,7 +97,7 @@ GameActions::Result StaffSetCostumeAction::Execute() const staff->UpdateCurrentActionSpriteType(); staff->Invalidate(); - window_invalidate_by_number(WC_PEEP, _spriteIndex); + window_invalidate_by_number(WindowClass::Peep, _spriteIndex); auto intent = Intent(INTENT_ACTION_REFRESH_STAFF_LIST); context_broadcast_intent(&intent); diff --git a/src/openrct2/actions/StaffSetOrdersAction.cpp b/src/openrct2/actions/StaffSetOrdersAction.cpp index 2ed8b0b271..5855cd12a8 100644 --- a/src/openrct2/actions/StaffSetOrdersAction.cpp +++ b/src/openrct2/actions/StaffSetOrdersAction.cpp @@ -63,7 +63,7 @@ GameActions::Result StaffSetOrdersAction::Execute() const } staff->StaffOrders = _ordersId; - window_invalidate_by_number(WC_PEEP, _spriteIndex); + window_invalidate_by_number(WindowClass::Peep, _spriteIndex); auto intent = Intent(INTENT_ACTION_REFRESH_STAFF_LIST); context_broadcast_intent(&intent); diff --git a/src/openrct2/audio/Audio.cpp b/src/openrct2/audio/Audio.cpp index e739f5cc6a..4cd5adcafd 100644 --- a/src/openrct2/audio/Audio.cpp +++ b/src/openrct2/audio/Audio.cpp @@ -371,7 +371,7 @@ namespace OpenRCT2::Audio Pause(); } - window_invalidate_by_class(WC_OPTIONS); + window_invalidate_by_class(WindowClass::Options); } void Pause() diff --git a/src/openrct2/cmdline/ConvertCommand.cpp b/src/openrct2/cmdline/ConvertCommand.cpp index 59d452384e..902056e3df 100644 --- a/src/openrct2/cmdline/ConvertCommand.cpp +++ b/src/openrct2/cmdline/ConvertCommand.cpp @@ -118,7 +118,7 @@ exitcode_t CommandLine::HandleCommandConvert(CommandLineArgEnumerator* enumerato // HACK remove the main window so it saves the park with the // correct initial view - window_close_by_class(WC_MAIN_WINDOW); + window_close_by_class(WindowClass::MainWindow); exporter->Export(destinationPath); } diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index 0517cf851b..905fef309d 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -1418,14 +1418,14 @@ void Guest::CheckCantFindRide() return; GuestHeadingToRideId = RideId::GetNull(); - rct_window* w = window_find_by_number(WC_PEEP, sprite_index); + rct_window* w = window_find_by_number(WindowClass::Peep, sprite_index); if (w != nullptr) { window_event_invalidate_call(w); } - window_invalidate_by_number(WC_PEEP, sprite_index); + window_invalidate_by_number(WindowClass::Peep, sprite_index); } /** @@ -2292,7 +2292,7 @@ void Guest::SpendMoney(money16& peep_expend_type, money32 amount, ExpenditureTyp peep_expend_type += static_cast(amount); - window_invalidate_by_number(WC_PEEP, sprite_index); + window_invalidate_by_number(WindowClass::Peep, sprite_index); finance_payment(-amount, expenditure); @@ -3099,10 +3099,10 @@ static void peep_leave_park(Guest* peep) peep->InsertNewThought(PeepThoughtType::GoHome); - rct_window* w = window_find_by_number(WC_PEEP, peep->sprite_index); + rct_window* w = window_find_by_number(WindowClass::Peep, peep->sprite_index); if (w != nullptr) window_event_invalidate_call(w); - window_invalidate_by_number(WC_PEEP, peep->sprite_index); + window_invalidate_by_number(WindowClass::Peep, peep->sprite_index); } template static void peep_head_for_nearest_ride(Guest* peep, bool considerOnlyCloseRides, T predicate) @@ -3334,7 +3334,7 @@ void Guest::UpdateBuying() { CashInPocket += 50.00_GBP; } - window_invalidate_by_number(WC_PEEP, sprite_index); + window_invalidate_by_number(WindowClass::Peep, sprite_index); } sprite_direction ^= 0x10; @@ -3829,7 +3829,7 @@ void Guest::UpdateRideFreeVehicleEnterRide(Ride* ride) if (queueTime != station.QueueTime) { station.QueueTime = queueTime; - window_invalidate_by_number(WC_RIDE, CurrentRide.ToUnderlying()); + window_invalidate_by_number(WindowClass::Ride, CurrentRide.ToUnderlying()); } if (PeepFlags & PEEP_FLAGS_TRACKING) @@ -5634,7 +5634,7 @@ void Guest::UpdateLeavingPark() context_broadcast_intent(&intent); Var37 = 1; - window_invalidate_by_class(WC_GUEST_LIST); + window_invalidate_by_class(WindowClass::GuestList); uint8_t pathingResult; PerformNextAction(pathingResult); if (!(pathingResult & PATHING_OUTSIDE_PARK)) diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index ff2d523d7f..50dcbd4c1c 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -534,7 +534,7 @@ void peep_decrement_num_riders(Peep* peep) */ void peep_window_state_update(Peep* peep) { - rct_window* w = window_find_by_number(WC_PEEP, peep->sprite_index.ToUnderlying()); + rct_window* w = window_find_by_number(WindowClass::Peep, peep->sprite_index.ToUnderlying()); if (w != nullptr) window_event_invalidate_call(w); @@ -550,13 +550,13 @@ void peep_window_state_update(Peep* peep) } } - window_invalidate_by_number(WC_PEEP, peep->sprite_index); - window_invalidate_by_class(WC_GUEST_LIST); + window_invalidate_by_number(WindowClass::Peep, peep->sprite_index); + window_invalidate_by_class(WindowClass::GuestList); } else { - window_invalidate_by_number(WC_PEEP, peep->sprite_index); - window_invalidate_by_class(WC_STAFF_LIST); + window_invalidate_by_number(WindowClass::Peep, peep->sprite_index); + window_invalidate_by_class(WindowClass::StaffList); } } @@ -662,9 +662,9 @@ void peep_sprite_remove(Peep* peep) } peep->Invalidate(); - window_close_by_number(WC_PEEP, peep->sprite_index); + window_close_by_number(WindowClass::Peep, peep->sprite_index); - window_close_by_number(WC_FIRE_PROMPT, EnumValue(peep->Type)); + window_close_by_number(WindowClass::FirePrompt, EnumValue(peep->Type)); auto* staff = peep->As(); // Needed for invalidations after sprite removal @@ -1948,7 +1948,7 @@ static bool peep_interact_with_entrance(Peep* peep, const CoordsXYE& coords, uin } gTotalAdmissions++; - window_invalidate_by_number(WC_PARK_INFORMATION, 0); + window_invalidate_by_number(WindowClass::ParkInformation, 0); guest->Var37 = 1; auto destination = guest->GetDestination(); diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index 5cc120d4a4..7ece65ac7a 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -1306,7 +1306,7 @@ static int32_t cc_open(InteractiveConsole& console, const arguments_t& argv) { // Only this window should be open for safety reasons window_close_all(); - context_open_window(WC_EDITOR_OBJECT_SELECTION); + context_open_window(WindowClass::EditorObjectSelection); } } else if (argv[0] == "inventions_list" && invalidArguments(&invalidTitle, !title)) @@ -1317,12 +1317,12 @@ static int32_t cc_open(InteractiveConsole& console, const arguments_t& argv) } else { - context_open_window(WC_EDITOR_INVENTION_LIST); + context_open_window(WindowClass::EditorInventionList); } } else if (argv[0] == "scenario_options" && invalidArguments(&invalidTitle, !title)) { - context_open_window(WC_EDITOR_SCENARIO_OPTIONS); + context_open_window(WindowClass::EditorScenarioOptions); } else if (argv[0] == "objective_options" && invalidArguments(&invalidTitle, !title)) { @@ -1332,16 +1332,16 @@ static int32_t cc_open(InteractiveConsole& console, const arguments_t& argv) } else { - context_open_window(WC_EDITOR_OBJECTIVE_OPTIONS); + context_open_window(WindowClass::EditorObjectiveOptions); } } else if (argv[0] == "options") { - context_open_window(WC_OPTIONS); + context_open_window(WindowClass::Options); } else if (argv[0] == "themes") { - context_open_window(WC_THEMES); + context_open_window(WindowClass::Themes); } else if (invalidTitle) { @@ -1462,7 +1462,7 @@ static int32_t cc_for_date([[maybe_unused]] InteractiveConsole& console, [[maybe } date_set(year, month, day); - window_invalidate_by_class(WC_BOTTOM_TOOLBAR); + window_invalidate_by_class(WindowClass::BottomToolbar); return 1; } diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 569510befe..a44ea4a498 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -89,7 +89,7 @@ void viewport_init_all() // ? input_reset_flags(); input_set_state(InputState::Reset); - gPressedWidget.window_classification = 255; + gPressedWidget.window_classification = WindowClass::Null; gPickupPeepImage = ImageId(); reset_tooltip_not_shown(); gMapSelectFlags = 0; @@ -535,8 +535,8 @@ static void viewport_move(const ScreenCoordsXY& coords, rct_window* w, rct_viewp // rct2: 0x006E7A15 static void viewport_set_underground_flag(int32_t underground, rct_window* window, rct_viewport* viewport) { - if (window->classification != WC_MAIN_WINDOW - || (window->classification == WC_MAIN_WINDOW && !window->viewport_smart_follow_sprite.IsNull())) + if (window->classification != WindowClass::MainWindow + || (window->classification == WindowClass::MainWindow && !window->viewport_smart_follow_sprite.IsNull())) { if (!underground) { @@ -1916,7 +1916,7 @@ void viewport_invalidate(const rct_viewport* viewport, const ScreenRect& screenR { auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); auto owner = windowManager->GetOwner(viewport); - if (owner != nullptr && owner->classification != WC_MAIN_WINDOW) + if (owner != nullptr && owner->classification != WindowClass::MainWindow) { // note, window_is_visible will update viewport->visibility, so this should have a low hit count if (!window_is_visible(*owner)) diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index c6213930fc..dbfe87970e 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -41,7 +41,7 @@ std::list> g_window_list; rct_window* gWindowAudioExclusive; -widget_identifier gCurrentTextBox = { { 255, 0 }, 0 }; +widget_identifier gCurrentTextBox = { { WindowClass::Null, 0 }, 0 }; char gTextBoxInput[TEXT_INPUT_SIZE] = { 0 }; int32_t gMaxTextBoxInputLength = 0; int32_t gTextBoxFrameNo = 0; @@ -155,7 +155,7 @@ void window_update_all() windowManager->UpdateMouseWheel(); } -static void window_close_surplus(int32_t cap, int8_t avoid_classification) +static void window_close_surplus(int32_t cap, WindowClass avoid_classification) { // find the amount of windows that are currently open auto count = static_cast(g_window_list.size()); @@ -173,8 +173,8 @@ static void window_close_surplus(int32_t cap, int8_t avoid_classification) break; } } - // skip window if window matches specified rct_windowclass (as user may be modifying via options) - if (avoid_classification != -1 && foundW != nullptr && foundW->classification == avoid_classification) + // skip window if window matches specified WindowClass (as user may be modifying via options) + if (avoid_classification != WindowClass::Null && foundW != nullptr && foundW->classification == avoid_classification) { continue; } @@ -195,7 +195,7 @@ void window_set_window_limit(int32_t value) // windows if one sets a limit lower than the number of windows open if (val < prev) { - window_close_surplus(val, WC_OPTIONS); + window_close_surplus(val, WindowClass::Options); } } @@ -284,7 +284,7 @@ template static void window_close_by_condition(TPred pred, uint3 * rct2: 0x006ECCF4 * @param cls (cl) with bit 15 set */ -void window_close_by_class(rct_windowclass cls) +void window_close_by_class(WindowClass cls) { window_close_by_condition([&](rct_window* w) -> bool { return w->classification == cls; }); } @@ -295,13 +295,13 @@ void window_close_by_class(rct_windowclass cls) * @param cls (cl) without bit 15 set * @param number (dx) */ -void window_close_by_number(rct_windowclass cls, rct_windownumber number) +void window_close_by_number(WindowClass cls, rct_windownumber number) { window_close_by_condition([cls, number](rct_window* w) -> bool { return w->classification == cls && w->number == number; }); } // TODO: Refactor this to use variant once the new window class is done. -void window_close_by_number(rct_windowclass cls, EntityId number) +void window_close_by_number(WindowClass cls, EntityId number) { window_close_by_number(cls, static_cast(number.ToUnderlying())); } @@ -312,7 +312,7 @@ void window_close_by_number(rct_windowclass cls, EntityId number) * @param cls (cl) with bit 15 set * @returns the window or NULL if no window was found. */ -rct_window* window_find_by_class(rct_windowclass cls) +rct_window* window_find_by_class(WindowClass cls) { for (auto& w : g_window_list) { @@ -331,7 +331,7 @@ rct_window* window_find_by_class(rct_windowclass cls) * @param number (dx) * @returns the window or NULL if no window was found. */ -rct_window* window_find_by_number(rct_windowclass cls, rct_windownumber number) +rct_window* window_find_by_number(WindowClass cls, rct_windownumber number) { for (auto& w : g_window_list) { @@ -344,7 +344,7 @@ rct_window* window_find_by_number(rct_windowclass cls, rct_windownumber number) } // TODO: Use variant for this once the window framework is done. -rct_window* window_find_by_number(rct_windowclass cls, EntityId id) +rct_window* window_find_by_number(WindowClass cls, EntityId id) { return window_find_by_number(cls, static_cast(id.ToUnderlying())); } @@ -356,7 +356,7 @@ rct_window* window_find_by_number(rct_windowclass cls, EntityId id) */ void window_close_top() { - window_close_by_class(WC_DROPDOWN); + window_close_by_class(WindowClass::Dropdown); if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) { @@ -375,13 +375,13 @@ void window_close_top() */ void window_close_all() { - window_close_by_class(WC_DROPDOWN); + window_close_by_class(WindowClass::Dropdown); window_close_by_condition([](rct_window* w) -> bool { return !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)); }); } -void window_close_all_except_class(rct_windowclass cls) +void window_close_all_except_class(WindowClass cls) { - window_close_by_class(WC_DROPDOWN); + window_close_by_class(WindowClass::Dropdown); window_close_by_condition([cls](rct_window* w) -> bool { return w->classification != cls && !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)); @@ -488,7 +488,7 @@ template static void window_invalidate_by_condition(TPred pred) * rct2: 0x006EC3AC * @param cls (al) with bit 14 set */ -void window_invalidate_by_class(rct_windowclass cls) +void window_invalidate_by_class(WindowClass cls) { window_invalidate_by_condition([cls](rct_window* w) -> bool { return w->classification == cls; }); } @@ -497,14 +497,14 @@ void window_invalidate_by_class(rct_windowclass cls) * Invalidates all windows with the specified window class and number. * rct2: 0x006EC3AC */ -void window_invalidate_by_number(rct_windowclass cls, rct_windownumber number) +void window_invalidate_by_number(WindowClass cls, rct_windownumber number) { window_invalidate_by_condition( [cls, number](rct_window* w) -> bool { return w->classification == cls && w->number == number; }); } // TODO: Use variant for this once the window framework is done. -void window_invalidate_by_number(rct_windowclass cls, EntityId id) +void window_invalidate_by_number(WindowClass cls, EntityId id) { window_invalidate_by_number(cls, static_cast(id.ToUnderlying())); } @@ -551,7 +551,7 @@ template static void widget_invalidate_by_condition(TPred pred) /** * Invalidates the specified widget of all windows that match the specified window class. */ -void widget_invalidate_by_class(rct_windowclass cls, rct_widgetindex widgetIndex) +void widget_invalidate_by_class(WindowClass cls, rct_widgetindex widgetIndex) { window_visit_each([cls, widgetIndex](rct_window* w) { if (w->classification == cls) @@ -565,7 +565,7 @@ void widget_invalidate_by_class(rct_windowclass cls, rct_widgetindex widgetIndex * Invalidates the specified widget of all windows that match the specified window class and number. * rct2: 0x006EC3AC */ -void widget_invalidate_by_number(rct_windowclass cls, rct_windownumber number, rct_widgetindex widgetIndex) +void widget_invalidate_by_number(WindowClass cls, rct_windownumber number, rct_widgetindex widgetIndex) { window_visit_each([cls, number, widgetIndex](rct_window* w) { if (w->classification == cls && w->number == number) @@ -684,7 +684,7 @@ rct_window* window_bring_to_front(rct_window& w) return &w; } -rct_window* window_bring_to_front_by_class_with_flags(rct_windowclass cls, uint16_t flags) +rct_window* window_bring_to_front_by_class_with_flags(WindowClass cls, uint16_t flags) { rct_window* w = window_find_by_class(cls); if (w != nullptr) @@ -697,7 +697,7 @@ rct_window* window_bring_to_front_by_class_with_flags(rct_windowclass cls, uint1 return w; } -rct_window* window_bring_to_front_by_class(rct_windowclass cls) +rct_window* window_bring_to_front_by_class(WindowClass cls) { return window_bring_to_front_by_class_with_flags(cls, WF_WHITE_BORDER_MASK); } @@ -708,7 +708,7 @@ rct_window* window_bring_to_front_by_class(rct_windowclass cls) * cls (cl) * number (dx) */ -rct_window* window_bring_to_front_by_number(rct_windowclass cls, rct_windownumber number) +rct_window* window_bring_to_front_by_number(WindowClass cls, rct_windownumber number) { rct_window* w; @@ -800,7 +800,7 @@ rct_window* window_get_main() { for (auto& w : g_window_list) { - if (w->classification == WC_MAIN_WINDOW) + if (w->classification == WindowClass::MainWindow) { return w.get(); } @@ -1707,21 +1707,21 @@ void window_resize_gui(int32_t width, int32_t height) if (gScreenFlags & SCREEN_FLAGS_EDITOR) return; - rct_window* titleWind = window_find_by_class(WC_TITLE_MENU); + rct_window* titleWind = window_find_by_class(WindowClass::TitleMenu); if (titleWind != nullptr) { titleWind->windowPos.x = (width - titleWind->width) / 2; titleWind->windowPos.y = height - 182; } - rct_window* exitWind = window_find_by_class(WC_TITLE_EXIT); + rct_window* exitWind = window_find_by_class(WindowClass::TitleExit); if (exitWind != nullptr) { exitWind->windowPos.x = width - 40; exitWind->windowPos.y = height - 64; } - rct_window* optionsWind = window_find_by_class(WC_TITLE_OPTIONS); + rct_window* optionsWind = window_find_by_class(WindowClass::TitleOptions); if (optionsWind != nullptr) { optionsWind->windowPos.x = width - 80; @@ -1752,13 +1752,13 @@ void window_resize_gui_scenario_editor(int32_t width, int32_t height) } } - rct_window* topWind = window_find_by_class(WC_TOP_TOOLBAR); + rct_window* topWind = window_find_by_class(WindowClass::TopToolbar); if (topWind != nullptr) { topWind->width = std::max(640, width); } - rct_window* bottomWind = window_find_by_class(WC_BOTTOM_TOOLBAR); + rct_window* bottomWind = window_find_by_class(WindowClass::BottomToolbar); if (bottomWind != nullptr) { bottomWind->windowPos.y = height - 32; @@ -1772,10 +1772,10 @@ void window_resize_gui_scenario_editor(int32_t width, int32_t height) */ void window_close_construction_windows() { - window_close_by_class(WC_RIDE_CONSTRUCTION); - window_close_by_class(WC_FOOTPATH); - window_close_by_class(WC_TRACK_DESIGN_LIST); - window_close_by_class(WC_TRACK_DESIGN_PLACE); + window_close_by_class(WindowClass::RideConstruction); + window_close_by_class(WindowClass::Footpath); + window_close_by_class(WindowClass::TrackDesignList); + window_close_by_class(WindowClass::TrackDesignPlace); } /** @@ -1964,7 +1964,7 @@ int32_t window_can_resize(const rct_window& w) */ void textinput_cancel() { - window_close_by_class(WC_TEXTINPUT); + window_close_by_class(WindowClass::Textinput); } void window_start_textbox( @@ -1981,7 +1981,7 @@ void window_start_textbox( gMaxTextBoxInputLength = maxLength; - window_close_by_class(WC_TEXTINPUT); + window_close_by_class(WindowClass::Textinput); // Clear the text input buffer std::fill_n(gTextBoxInput, maxLength, 0x00); @@ -2007,7 +2007,7 @@ void window_cancel_textbox() { window_event_textinput_call(w, gCurrentTextBox.widget_index, nullptr); } - gCurrentTextBox.window.classification = WC_NULL; + gCurrentTextBox.window.classification = WindowClass::Null; gCurrentTextBox.window.number = 0; context_stop_text_input(); gUsingWidgetTextBox = false; @@ -2047,7 +2047,7 @@ bool window_is_visible(rct_window& w) return false; // only consider viewports, consider the main window always visible - if (w.viewport == nullptr || w.classification == WC_MAIN_WINDOW) + if (w.viewport == nullptr || w.classification == WindowClass::MainWindow) { // default to previous behaviour w.visibility = VisibilityCache::Visible; @@ -2178,7 +2178,7 @@ rct_window* window_get_listening() return nullptr; } -rct_windowclass window_get_classification(const rct_window& window) +WindowClass window_get_classification(const rct_window& window) { return window.classification; } diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index a25a0c8600..b12bb1ae5f 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -15,6 +15,7 @@ #include "../ride/RideTypes.h" #include "../world/Location.hpp" #include "../world/ScenerySelection.h" +#include "WindowClasses.h" #include "ZoomLevel.h" #include @@ -50,13 +51,12 @@ extern struct TextInputSession* gTextInput; using wndproc = void(struct rct_window*, union rct_window_event*); -using rct_windowclass = uint8_t; using rct_windownumber = uint16_t; using rct_widgetindex = int16_t; struct window_identifier { - rct_windowclass classification; + WindowClass classification; rct_windownumber number; }; @@ -368,93 +368,6 @@ enum SCROLL_PART_VSCROLLBAR_THUMB = 10, }; -enum -{ - WC_MAIN_WINDOW = 0, - WC_TOP_TOOLBAR = 1, - WC_BOTTOM_TOOLBAR = 2, - WC_TOOLTIP = 5, - WC_DROPDOWN = 6, - WC_ABOUT = 8, - // WC_PUBLISHER_CREDITS = 9, - // WC_MUSIC_CREDITS = 10, - WC_ERROR = 11, - WC_RIDE = 12, - WC_RIDE_CONSTRUCTION = 13, - WC_SAVE_PROMPT = 14, - WC_RIDE_LIST = 15, - WC_CONSTRUCT_RIDE = 16, - WC_DEMOLISH_RIDE_PROMPT = 17, - WC_SCENERY = 18, - WC_OPTIONS = 19, - WC_FOOTPATH = 20, - WC_LAND = 21, - WC_WATER = 22, - WC_PEEP = 23, - WC_GUEST_LIST = 24, - WC_STAFF_LIST = 25, - WC_FIRE_PROMPT = 26, - WC_PARK_INFORMATION = 27, - WC_FINANCES = 28, - WC_TITLE_MENU = 29, - WC_TITLE_EXIT = 30, - WC_RECENT_NEWS = 31, - WC_SCENARIO_SELECT = 32, - WC_TRACK_DESIGN_LIST = 33, - WC_TRACK_DESIGN_PLACE = 34, - WC_NEW_CAMPAIGN = 35, - WC_KEYBOARD_SHORTCUT_LIST = 36, - WC_CHANGE_KEYBOARD_SHORTCUT = 37, - WC_MAP = 38, - WC_TITLE_LOGO = 39, - WC_BANNER = 40, - WC_MAP_TOOLTIP = 41, - WC_EDITOR_OBJECT_SELECTION = 42, - WC_EDITOR_INVENTION_LIST = 43, - WC_EDITOR_INVENTION_LIST_DRAG = 44, - WC_EDITOR_SCENARIO_OPTIONS = 45, - WC_EDITOR_OBJECTIVE_OPTIONS = 46, - WC_MANAGE_TRACK_DESIGN = 47, - WC_TRACK_DELETE_PROMPT = 48, - WC_INSTALL_TRACK = 49, - WC_CLEAR_SCENERY = 50, - WC_SCENERY_SCATTER = 51, - WC_NOTIFICATION_OPTIONS = 109, - WC_CHEATS = 110, - WC_RESEARCH = 111, - WC_VIEWPORT = 112, - WC_TEXTINPUT = 113, - WC_MAPGEN = 114, - WC_LOADSAVE = 115, - WC_LOADSAVE_OVERWRITE_PROMPT = 116, - WC_TITLE_OPTIONS = 117, - WC_LAND_RIGHTS = 118, - WC_THEMES = 119, - WC_TILE_INSPECTOR = 120, - WC_CHANGELOG = 121, - WC_MULTIPLAYER = 124, - WC_PLAYER = 125, - WC_NETWORK_STATUS = 126, - WC_SERVER_LIST = 127, - WC_SERVER_START = 128, - WC_CUSTOM_CURRENCY_CONFIG = 129, - WC_DEBUG_PAINT = 130, - WC_VIEW_CLIPPING = 131, - WC_OBJECT_LOAD_ERROR = 132, - WC_PATROL_AREA = 133, - WC_TRANSPARENCY = 134, - - // Only used for colour schemes - WC_STAFF = 220, - WC_EDITOR_TRACK_BOTTOM_TOOLBAR = 221, - WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR = 222, - WC_CHAT = 223, - WC_CONSOLE = 224, - WC_CUSTOM = 225, - - WC_NULL = 255, -}; - enum { WV_PARK_AWARDS, @@ -470,7 +383,7 @@ enum WV_NEW_VERSION_INFO, }; -enum +enum WindowDetail { WD_BANNER, WD_NEW_CAMPAIGN, @@ -483,6 +396,8 @@ enum WD_VEHICLE, WD_TRACK, + + WD_NULL = 255, }; #define validate_global_widx(wc, widx) \ @@ -646,24 +561,24 @@ void window_update_all(); void window_set_window_limit(int32_t value); rct_window* window_bring_to_front(rct_window& w); -rct_window* window_bring_to_front_by_class(rct_windowclass cls); -rct_window* window_bring_to_front_by_class_with_flags(rct_windowclass cls, uint16_t flags); -rct_window* window_bring_to_front_by_number(rct_windowclass cls, rct_windownumber number); +rct_window* window_bring_to_front_by_class(WindowClass cls); +rct_window* window_bring_to_front_by_class_with_flags(WindowClass cls, uint16_t flags); +rct_window* window_bring_to_front_by_number(WindowClass cls, rct_windownumber number); rct_window* WindowCreate( - std::unique_ptr&& w, rct_windowclass cls, ScreenCoordsXY pos, int32_t width, int32_t height, uint32_t flags); + std::unique_ptr&& w, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height, uint32_t flags); template::value>::type* = nullptr> -T* WindowCreate(rct_windowclass cls, const ScreenCoordsXY& pos = {}, int32_t width = 0, int32_t height = 0, uint32_t flags = 0) +T* WindowCreate(WindowClass cls, const ScreenCoordsXY& pos = {}, int32_t width = 0, int32_t height = 0, uint32_t flags = 0) { return static_cast(WindowCreate(std::make_unique(), cls, pos, width, height, flags)); } template::value>::type* = nullptr> -T* WindowCreate(rct_windowclass cls, int32_t width, int32_t height, uint32_t flags = 0) +T* WindowCreate(WindowClass cls, int32_t width, int32_t height, uint32_t flags = 0) { return static_cast(WindowCreate(std::make_unique(), cls, {}, width, height, flags | WF_AUTO_POSITION)); } template::value>::type* = nullptr> -T* WindowFocusOrCreate(rct_windowclass cls, const ScreenCoordsXY& pos, int32_t width, int32_t height, uint32_t flags = 0) +T* WindowFocusOrCreate(WindowClass cls, const ScreenCoordsXY& pos, int32_t width, int32_t height, uint32_t flags = 0) { auto* w = window_bring_to_front_by_class(cls); if (w == nullptr) @@ -673,7 +588,7 @@ T* WindowFocusOrCreate(rct_windowclass cls, const ScreenCoordsXY& pos, int32_t w return static_cast(w); } template::value>::type* = nullptr> -T* WindowFocusOrCreate(rct_windowclass cls, int32_t width, int32_t height, uint32_t flags = 0) +T* WindowFocusOrCreate(WindowClass cls, int32_t width, int32_t height, uint32_t flags = 0) { auto* w = window_bring_to_front_by_class(cls); if (w == nullptr) @@ -684,33 +599,33 @@ T* WindowFocusOrCreate(rct_windowclass cls, int32_t width, int32_t height, uint3 } rct_window* WindowCreate( - const ScreenCoordsXY& pos, int32_t width, int32_t height, rct_window_event_list* event_handlers, rct_windowclass cls, + const ScreenCoordsXY& pos, int32_t width, int32_t height, rct_window_event_list* event_handlers, WindowClass cls, uint32_t flags); rct_window* WindowCreateAutoPos( - int32_t width, int32_t height, rct_window_event_list* event_handlers, rct_windowclass cls, uint32_t flags); + int32_t width, int32_t height, rct_window_event_list* event_handlers, WindowClass cls, uint32_t flags); rct_window* WindowCreateCentred( - int32_t width, int32_t height, rct_window_event_list* event_handlers, rct_windowclass cls, uint32_t flags); + int32_t width, int32_t height, rct_window_event_list* event_handlers, WindowClass cls, uint32_t flags); void window_close(rct_window& window); -void window_close_by_class(rct_windowclass cls); -void window_close_by_number(rct_windowclass cls, rct_windownumber number); -void window_close_by_number(rct_windowclass cls, EntityId number); +void window_close_by_class(WindowClass cls); +void window_close_by_number(WindowClass cls, rct_windownumber number); +void window_close_by_number(WindowClass cls, EntityId number); void window_close_top(); void window_close_all(); -void window_close_all_except_class(rct_windowclass cls); +void window_close_all_except_class(WindowClass cls); void window_close_all_except_flags(uint16_t flags); -rct_window* window_find_by_class(rct_windowclass cls); -rct_window* window_find_by_number(rct_windowclass cls, rct_windownumber number); -rct_window* window_find_by_number(rct_windowclass cls, EntityId id); +rct_window* window_find_by_class(WindowClass cls); +rct_window* window_find_by_number(WindowClass cls, rct_windownumber number); +rct_window* window_find_by_number(WindowClass cls, EntityId id); rct_window* window_find_from_point(const ScreenCoordsXY& screenCoords); rct_widgetindex window_find_widget_from_point(rct_window& w, const ScreenCoordsXY& screenCoords); -void window_invalidate_by_class(rct_windowclass cls); -void window_invalidate_by_number(rct_windowclass cls, rct_windownumber number); -void window_invalidate_by_number(rct_windowclass cls, EntityId id); +void window_invalidate_by_class(WindowClass cls); +void window_invalidate_by_number(WindowClass cls, rct_windownumber number); +void window_invalidate_by_number(WindowClass cls, EntityId id); void window_invalidate_all(); void widget_invalidate(rct_window& w, rct_widgetindex widgetIndex); -void widget_invalidate_by_class(rct_windowclass cls, rct_widgetindex widgetIndex); -void widget_invalidate_by_number(rct_windowclass cls, rct_windownumber number, rct_widgetindex widgetIndex); +void widget_invalidate_by_class(WindowClass cls, rct_widgetindex widgetIndex); +void widget_invalidate_by_number(WindowClass cls, rct_windownumber number, rct_widgetindex widgetIndex); void WindowInitScrollWidgets(rct_window& w); void window_update_scroll_widgets(rct_window& w); int32_t window_get_scroll_data_index(const rct_window& w, rct_widgetindex widget_index); @@ -840,4 +755,4 @@ money32 place_provisional_track_piece( extern RideConstructionState _rideConstructionState2; rct_window* window_get_listening(); -rct_windowclass window_get_classification(const rct_window& window); +WindowClass window_get_classification(const rct_window& window); diff --git a/src/openrct2/interface/WindowClasses.h b/src/openrct2/interface/WindowClasses.h new file mode 100644 index 0000000000..d8b8019bf3 --- /dev/null +++ b/src/openrct2/interface/WindowClasses.h @@ -0,0 +1,99 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include + +enum class WindowClass : uint8_t +{ + MainWindow = 0, + TopToolbar = 1, + BottomToolbar = 2, + Tooltip = 5, + Dropdown = 6, + About = 8, + // WC_PUBLISHER_CREDITS = 9, + // WC_MUSIC_CREDITS = 10, + Error = 11, + Ride = 12, + RideConstruction = 13, + SavePrompt = 14, + RideList = 15, + ConstructRide = 16, + DemolishRidePrompt = 17, + Scenery = 18, + Options = 19, + Footpath = 20, + Land = 21, + Water = 22, + Peep = 23, + GuestList = 24, + StaffList = 25, + FirePrompt = 26, + ParkInformation = 27, + Finances = 28, + TitleMenu = 29, + TitleExit = 30, + RecentNews = 31, + ScenarioSelect = 32, + TrackDesignList = 33, + TrackDesignPlace = 34, + NewCampaign = 35, + KeyboardShortcutList = 36, + ChangeKeyboardShortcut = 37, + Map = 38, + TitleLogo = 39, + Banner = 40, + MapTooltip = 41, + EditorObjectSelection = 42, + EditorInventionList = 43, + EditorInventionListDrag = 44, + EditorScenarioOptions = 45, + EditorObjectiveOptions = 46, + ManageTrackDesign = 47, + TrackDeletePrompt = 48, + InstallTrack = 49, + ClearScenery = 50, + SceneryScatter = 51, + NotificationOptions = 109, + Cheats = 110, + Research = 111, + Viewport = 112, + Textinput = 113, + Mapgen = 114, + Loadsave = 115, + LoadsaveOverwritePrompt = 116, + TitleOptions = 117, + LandRights = 118, + Themes = 119, + TileInspector = 120, + Changelog = 121, + Multiplayer = 124, + Player = 125, + NetworkStatus = 126, + ServerList = 127, + ServerStart = 128, + CustomCurrencyConfig = 129, + DebugPaint = 130, + ViewClipping = 131, + ObjectLoadError = 132, + PatrolArea = 133, + Transparency = 134, + + // Only used for colour schemes + Staff = 220, + EditorTrackBottomToolbar = 221, + EditorScenarioBottomToolbar = 222, + Chat = 223, + Console = 224, + Custom = 225, + + Null = 255, +}; diff --git a/src/openrct2/interface/Window_internal.h b/src/openrct2/interface/Window_internal.h index 631a36c4ab..63b76006c7 100644 --- a/src/openrct2/interface/Window_internal.h +++ b/src/openrct2/interface/Window_internal.h @@ -91,7 +91,7 @@ struct rct_window int16_t var_4AE{}; EntityId viewport_target_sprite{ EntityId::GetNull() }; ScreenCoordsXY savedViewPos{}; - rct_windowclass classification{}; + WindowClass classification{}; colour_t colours[6]{}; VisibilityCache visibility{}; EntityId viewport_smart_follow_sprite{ EntityId::GetNull() }; // Handles setting viewport target sprite etc diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index 4918b99859..99c2bacb38 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -249,6 +249,7 @@ + @@ -996,4 +997,4 @@ - + \ No newline at end of file diff --git a/src/openrct2/management/Award.cpp b/src/openrct2/management/Award.cpp index f870e56429..22e5cdfe3e 100644 --- a/src/openrct2/management/Award.cpp +++ b/src/openrct2/management/Award.cpp @@ -635,7 +635,7 @@ void award_update_all() { News::AddItemToQueue(News::ItemType::Award, AwardNewsStrings[EnumValue(awardType)], 0, {}); } - window_invalidate_by_class(WC_PARK_INFORMATION); + window_invalidate_by_class(WindowClass::ParkInformation); } } } @@ -652,6 +652,6 @@ void award_update_all() if (res != std::end(_currentAwards)) { _currentAwards.erase(res, std::end(_currentAwards)); - window_invalidate_by_class(WC_PARK_INFORMATION); + window_invalidate_by_class(WindowClass::ParkInformation); } } diff --git a/src/openrct2/management/Finance.cpp b/src/openrct2/management/Finance.cpp index 41988f9425..eda249249e 100644 --- a/src/openrct2/management/Finance.cpp +++ b/src/openrct2/management/Finance.cpp @@ -280,7 +280,7 @@ void finance_update_daily_profit() gWeeklyProfitAverageDividend += gCurrentProfit; gWeeklyProfitAverageDivisor += 1; - window_invalidate_by_class(WC_FINANCES); + window_invalidate_by_class(WindowClass::Finances); } money64 finance_get_initial_cash() @@ -336,7 +336,7 @@ void finance_shift_expenditure_table() gExpenditureTable[0][i] = 0; } - window_invalidate_by_class(WC_FINANCES); + window_invalidate_by_class(WindowClass::Finances); } /** diff --git a/src/openrct2/management/Marketing.cpp b/src/openrct2/management/Marketing.cpp index 8bb235ae1f..42e3c0dfb6 100644 --- a/src/openrct2/management/Marketing.cpp +++ b/src/openrct2/management/Marketing.cpp @@ -128,7 +128,7 @@ void marketing_update() } } - window_invalidate_by_class(WC_FINANCES); + window_invalidate_by_class(WindowClass::Finances); } void marketing_set_guest_campaign(Guest* peep, int32_t campaignType) diff --git a/src/openrct2/management/NewsItem.cpp b/src/openrct2/management/NewsItem.cpp index c9ad1a7134..4a311baffe 100644 --- a/src/openrct2/management/NewsItem.cpp +++ b/src/openrct2/management/NewsItem.cpp @@ -189,7 +189,7 @@ void News::ItemQueues::ArchiveCurrent() Archived.push_back(Current()); // Invalidate the news window - window_invalidate_by_class(WC_RECENT_NEWS); + window_invalidate_by_class(WindowClass::RecentNews); // Dequeue the current news item, shift news up Recent.pop_front(); @@ -365,7 +365,7 @@ void News::OpenSubject(News::ItemType type, int32_t subject) { case News::ItemType::Ride: { - auto intent = Intent(WC_RIDE); + auto intent = Intent(WindowClass::Ride); intent.putExtra(INTENT_EXTRA_RIDE_ID, subject); context_open_intent(&intent); break; @@ -376,14 +376,14 @@ void News::OpenSubject(News::ItemType type, int32_t subject) auto peep = TryGetEntity(EntityId::FromUnderlying(subject)); if (peep != nullptr) { - auto intent = Intent(WC_PEEP); + auto intent = Intent(WindowClass::Peep); intent.putExtra(INTENT_EXTRA_PEEP, peep); context_open_intent(&intent); } break; } case News::ItemType::Money: - context_open_window(WC_FINANCES); + context_open_window(WindowClass::Finances); break; case News::ItemType::Research: { @@ -404,7 +404,7 @@ void News::OpenSubject(News::ItemType type, int32_t subject) } case News::ItemType::Peeps: { - auto intent = Intent(WC_GUEST_LIST); + auto intent = Intent(WindowClass::GuestList); intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsThinkingX)); intent.putExtra(INTENT_EXTRA_RIDE_ID, subject); context_open_intent(&intent); @@ -446,7 +446,7 @@ void News::DisableNewsItems(News::ItemType type, uint32_t assoc) if (type == newsItem.Type && assoc == newsItem.Assoc) { newsItem.SetFlags(News::ItemFlags::HasButton); - window_invalidate_by_class(WC_RECENT_NEWS); + window_invalidate_by_class(WindowClass::RecentNews); } }); } diff --git a/src/openrct2/management/Research.cpp b/src/openrct2/management/Research.cpp index e7450cbda0..433c891399 100644 --- a/src/openrct2/management/Research.cpp +++ b/src/openrct2/management/Research.cpp @@ -124,8 +124,8 @@ static void research_calculate_expected_date() static void research_invalidate_related_windows() { - window_invalidate_by_class(WC_CONSTRUCT_RIDE); - window_invalidate_by_class(WC_RESEARCH); + window_invalidate_by_class(WindowClass::ConstructRide); + window_invalidate_by_class(WindowClass::Research); } static void research_mark_as_fully_completed() diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index cba0f19f86..be3784cf4c 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -560,7 +560,7 @@ void NetworkBase::UpdateClient() char str_resolving[256]; format_string(str_resolving, 256, STR_MULTIPLAYER_RESOLVING, nullptr); - auto intent = Intent(WC_NETWORK_STATUS); + auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_resolving }); intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); context_open_intent(&intent); @@ -575,7 +575,7 @@ void NetworkBase::UpdateClient() char str_connecting[256]; format_string(str_connecting, 256, STR_MULTIPLAYER_CONNECTING, nullptr); - auto intent = Intent(WC_NETWORK_STATUS); + auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_connecting }); intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); context_open_intent(&intent); @@ -592,7 +592,7 @@ void NetworkBase::UpdateClient() char str_authenticating[256]; format_string(str_authenticating, 256, STR_MULTIPLAYER_AUTHENTICATING, nullptr); - auto intent = Intent(WC_NETWORK_STATUS); + auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_authenticating }); intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); context_open_intent(&intent); @@ -607,7 +607,7 @@ void NetworkBase::UpdateClient() } Close(); - context_force_close_window_by_class(WC_NETWORK_STATUS); + context_force_close_window_by_class(WindowClass::NetworkStatus); context_show_error(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_NONE, {}); break; } @@ -621,7 +621,7 @@ void NetworkBase::UpdateClient() // Do not show disconnect message window when password window closed/canceled if (_serverConnection->AuthStatus == NetworkAuth::RequirePassword) { - context_force_close_window_by_class(WC_NETWORK_STATUS); + context_force_close_window_by_class(WindowClass::NetworkStatus); } else { @@ -637,11 +637,11 @@ void NetworkBase::UpdateClient() format_string(str_disconnected, 256, STR_MULTIPLAYER_DISCONNECTED_NO_REASON, nullptr); } - auto intent = Intent(WC_NETWORK_STATUS); + auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_disconnected }); context_open_intent(&intent); } - window_close_by_class(WC_MULTIPLAYER); + window_close_by_class(WindowClass::Multiplayer); Close(); } else @@ -777,7 +777,7 @@ bool NetworkBase::CheckDesynchronizaton() char str_desync[256]; format_string(str_desync, 256, STR_MULTIPLAYER_DESYNC, nullptr); - auto intent = Intent(WC_NETWORK_STATUS); + auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_desync }); context_open_intent(&intent); @@ -2306,7 +2306,7 @@ void NetworkBase::Client_Handle_OBJECTS_LIST(NetworkConnection& connection, Netw }; format_string(objectListMsg, 256, STR_MULTIPLAYER_RECEIVING_OBJECTS_LIST, &args); - auto intent = Intent(WC_NETWORK_STATUS); + auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ objectListMsg }); intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); context_open_intent(&intent); @@ -2444,7 +2444,7 @@ void NetworkBase::Client_Handle_GAMESTATE(NetworkConnection& connection, Network char str_desync[1024]; format_string(str_desync, sizeof(str_desync), STR_DESYNC_REPORT, ft.Data()); - auto intent = Intent(WC_NETWORK_STATUS); + auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_desync }); context_open_intent(&intent); } @@ -2652,7 +2652,7 @@ void NetworkBase::Client_Handle_MAP([[maybe_unused]] NetworkConnection& connecti }; format_string(str_downloading_map, 256, STR_MULTIPLAYER_DOWNLOADING_MAP, downloading_map_args); - auto intent = Intent(WC_NETWORK_STATUS); + auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_downloading_map }); intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); context_open_intent(&intent); @@ -2663,7 +2663,7 @@ void NetworkBase::Client_Handle_MAP([[maybe_unused]] NetworkConnection& connecti // Allow queue processing of game actions again. GameActions::ResumeQueue(); - context_force_close_window_by_class(WC_NETWORK_STATUS); + context_force_close_window_by_class(WindowClass::NetworkStatus); game_unload_scripts(); game_notify_map_change(); @@ -3007,7 +3007,7 @@ void NetworkBase::Server_Handle_PING(NetworkConnection& connection, [[maybe_unus if (connection.Player != nullptr) { connection.Player->Ping = ping; - window_invalidate_by_number(WC_PLAYER, connection.Player->Id); + window_invalidate_by_number(WindowClass::Player, connection.Player->Id); } } @@ -3026,7 +3026,7 @@ void NetworkBase::Client_Handle_PINGLIST([[maybe_unused]] NetworkConnection& con player->Ping = ping; } } - window_invalidate_by_class(WC_PLAYER); + window_invalidate_by_class(WindowClass::Player); } void NetworkBase::Client_Handle_SETDISCONNECTMSG(NetworkConnection& connection, NetworkPacket& packet) @@ -3460,7 +3460,7 @@ GameActions::Result network_set_player_group( userManager.Save(); } - window_invalidate_by_number(WC_PLAYER, playerId); + window_invalidate_by_number(WindowClass::Player, playerId); // Log set player group event NetworkPlayer* game_command_player = network.GetPlayerByID(actionPlayerId); diff --git a/src/openrct2/network/NetworkPlayer.cpp b/src/openrct2/network/NetworkPlayer.cpp index 31fc9ebcb6..f2bd4c9190 100644 --- a/src/openrct2/network/NetworkPlayer.cpp +++ b/src/openrct2/network/NetworkPlayer.cpp @@ -40,7 +40,7 @@ void NetworkPlayer::AddMoneySpent(money32 cost) { MoneySpent += cost; CommandsRan++; - window_invalidate_by_number(WC_PLAYER, Id); + window_invalidate_by_number(WindowClass::Player, Id); } #endif diff --git a/src/openrct2/object/ObjectManager.cpp b/src/openrct2/object/ObjectManager.cpp index 02bbdc852c..8eba9445b1 100644 --- a/src/openrct2/object/ObjectManager.cpp +++ b/src/openrct2/object/ObjectManager.cpp @@ -490,7 +490,7 @@ private: // HACK Scenery window will lose its tabs after changing the scenery group indexing // for now just close it, but it will be better to later tell it to invalidate the tabs - window_close_by_class(WC_SCENERY); + window_close_by_class(WindowClass::Scenery); } ObjectEntryIndex GetPrimarySceneryGroupEntryIndex(Object* loadedObject) diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 30fb7bd5f8..08119d3134 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -353,7 +353,7 @@ void ride_update_favourited_stat() } } - window_invalidate_by_class(WC_RIDE_LIST); + window_invalidate_by_class(WindowClass::RideList); } /** @@ -742,7 +742,7 @@ int32_t ride_find_track_gap(const Ride* ride, CoordsXYE* input, CoordsXYE* outpu return 0; } - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && _currentRideIndex == ride->id) { ride_construction_invalidate_current_track(); @@ -2672,7 +2672,7 @@ static ResultWithMessage RideCheckBlockBrakes(const CoordsXYE& input, CoordsXYE* return { false }; RideId rideIndex = input.element->AsTrack()->GetRideIndex(); - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && _currentRideIndex == rideIndex) ride_construction_invalidate_current_track(); @@ -2732,7 +2732,7 @@ static bool ride_check_track_contains_inversions(CoordsXYE* input, CoordsXYE* ou if (ride != nullptr && ride->type == RIDE_TYPE_MAZE) return true; - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && rideIndex == _currentRideIndex) { ride_construction_invalidate_current_track(); @@ -2791,7 +2791,7 @@ static bool ride_check_track_contains_banked(CoordsXYE* input, CoordsXYE* output if (ride->type == RIDE_TYPE_MAZE) return true; - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && rideIndex == _currentRideIndex) { ride_construction_invalidate_current_track(); @@ -2832,7 +2832,7 @@ static bool ride_check_track_contains_banked(CoordsXYE* input, CoordsXYE* output */ static int32_t ride_check_station_length(CoordsXYE* input, CoordsXYE* output) { - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && _currentRideIndex == input->element->AsTrack()->GetRideIndex()) { @@ -2894,7 +2894,7 @@ static bool ride_check_start_and_end_is_station(CoordsXYE* input) if (ride == nullptr) return false; - auto w = window_find_by_class(WC_RIDE_CONSTRUCTION); + auto w = window_find_by_class(WindowClass::RideConstruction); if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && rideIndex == _currentRideIndex) { ride_construction_invalidate_current_track(); @@ -3826,7 +3826,7 @@ void Ride::ConstructMissingEntranceOrExit() const return; } - w = window_find_by_class(WC_RIDE_CONSTRUCTION); + w = window_find_by_class(WindowClass::RideConstruction); if (w != nullptr) window_event_mouse_up_call(w, entranceOrExit); } @@ -3888,7 +3888,7 @@ ResultWithMessage Ride::Test(RideStatus newStatus, bool isApplying) if (newStatus != RideStatus::Simulating) { - window_close_by_number(WC_RIDE_CONSTRUCTION, id.ToUnderlying()); + window_close_by_number(WindowClass::RideConstruction, id.ToUnderlying()); } auto stationIndexCheck = ride_mode_check_station_present(this); @@ -4018,10 +4018,10 @@ ResultWithMessage Ride::Open(bool isApplying) // 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 // with auto open on. - if (WC_RIDE_CONSTRUCTION == gCurrentToolWidget.window_classification + if (WindowClass::RideConstruction == gCurrentToolWidget.window_classification && id.ToUnderlying() == gCurrentToolWidget.window_number && (input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) { - window_close_by_number(WC_RIDE_CONSTRUCTION, id.ToUnderlying()); + window_close_by_number(WindowClass::RideConstruction, id.ToUnderlying()); } auto stationIndexCheck = ride_mode_check_station_present(this); @@ -4729,7 +4729,7 @@ void invalidate_test_results(Ride* ride) } } } - window_invalidate_by_number(WC_RIDE, ride->id.ToUnderlying()); + window_invalidate_by_number(WindowClass::Ride, ride->id.ToUnderlying()); } /** @@ -5059,7 +5059,7 @@ static int32_t ride_get_track_length(Ride* ride) RideId rideIndex = tileElement->AsTrack()->GetRideIndex(); - rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WindowClass::RideConstruction); if (w != nullptr && _rideConstructionState != RideConstructionState::State0 && _currentRideIndex == rideIndex) { ride_construction_invalidate_current_track(); @@ -5243,7 +5243,7 @@ void Ride::UpdateMaxVehicles() { num_cars_per_train = numCarsPerTrain; num_vehicles = numVehicles; - window_invalidate_by_number(WC_RIDE, id.ToUnderlying()); + window_invalidate_by_number(WindowClass::Ride, id.ToUnderlying()); } } diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index 382d70bc76..1b4749daf7 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -123,7 +123,7 @@ static rct_window* ride_create_or_find_construction_window(RideId rideIndex) auto intent = Intent(INTENT_ACTION_RIDE_CONSTRUCTION_FOCUS); intent.putExtra(INTENT_EXTRA_RIDE_ID, rideIndex.ToUnderlying()); windowManager->BroadcastIntent(intent); - return window_find_by_class(WC_RIDE_CONSTRUCTION); + return window_find_by_class(WindowClass::RideConstruction); } /** @@ -238,7 +238,7 @@ void ride_clear_for_construction(Ride* ride) ride->RemoveVehicles(); ride_clear_blocked_tiles(ride); - auto w = window_find_by_number(WC_RIDE, ride->id.ToUnderlying()); + auto w = window_find_by_number(WindowClass::Ride, ride->id.ToUnderlying()); if (w != nullptr) window_event_resize_call(w); } @@ -897,20 +897,20 @@ static bool ride_modify_entrance_or_exit(const CoordsXYE& tileElement) auto stationIndex = entranceElement->GetStationIndex(); // Get or create construction window for ride - auto constructionWindow = window_find_by_class(WC_RIDE_CONSTRUCTION); + auto constructionWindow = window_find_by_class(WindowClass::RideConstruction); if (constructionWindow == nullptr) { if (!ride_initialise_construction_window(ride)) return false; - constructionWindow = window_find_by_class(WC_RIDE_CONSTRUCTION); + constructionWindow = window_find_by_class(WindowClass::RideConstruction); if (constructionWindow == nullptr) return false; } ride_construction_invalidate_current_track(); if (_rideConstructionState != RideConstructionState::EntranceExit || !(input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) - || gCurrentToolWidget.window_classification != WC_RIDE_CONSTRUCTION) + || gCurrentToolWidget.window_classification != WindowClass::RideConstruction) { // Replace entrance / exit tool_set( @@ -940,13 +940,13 @@ static bool ride_modify_entrance_or_exit(const CoordsXYE& tileElement) gCurrentToolWidget.widget_index = entranceType == ENTRANCE_TYPE_RIDE_ENTRANCE ? WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE : WC_RIDE_CONSTRUCTION__WIDX_EXIT; gRideEntranceExitPlaceType = entranceType; - window_invalidate_by_class(WC_RIDE_CONSTRUCTION); + window_invalidate_by_class(WindowClass::RideConstruction); }); GameActions::Execute(&rideEntranceExitRemove); } - window_invalidate_by_class(WC_RIDE_CONSTRUCTION); + window_invalidate_by_class(WindowClass::RideConstruction); return true; } diff --git a/src/openrct2/ride/RideRatings.cpp b/src/openrct2/ride/RideRatings.cpp index f849fa1352..13019afb1d 100644 --- a/src/openrct2/ride/RideRatings.cpp +++ b/src/openrct2/ride/RideRatings.cpp @@ -285,7 +285,7 @@ static void ride_ratings_update_state_3(RideRatingUpdateState& state) ride_ratings_calculate(state, ride); ride_ratings_calculate_value(ride); - window_invalidate_by_number(WC_RIDE, state.CurrentRide.ToUnderlying()); + window_invalidate_by_number(WindowClass::Ride, state.CurrentRide.ToUnderlying()); state.State = RIDE_RATINGS_STATE_FIND_NEXT_RIDE; } diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 89121b4a8e..926cc4a8ae 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -804,7 +804,7 @@ bool Vehicle::SoundCanPlay() const auto left = g_music_tracking_viewport->viewPos.x; auto bottom = g_music_tracking_viewport->viewPos.y; - if (window_get_classification(*gWindowAudioExclusive) == WC_MAIN_WINDOW) + if (window_get_classification(*gWindowAudioExclusive) == WindowClass::MainWindow) { left -= quarter_w; bottom -= quarter_h; @@ -816,7 +816,7 @@ bool Vehicle::SoundCanPlay() const auto right = g_music_tracking_viewport->view_width + left; auto top = g_music_tracking_viewport->view_height + bottom; - if (window_get_classification(*gWindowAudioExclusive) == WC_MAIN_WINDOW) + if (window_get_classification(*gWindowAudioExclusive) == WindowClass::MainWindow) { right += quarter_w + quarter_w; top += quarter_h + quarter_h; @@ -1462,7 +1462,7 @@ void Vehicle::UpdateMeasurements() curRide->lifecycle_flags |= RIDE_LIFECYCLE_NO_RAW_STATS; curRide->lifecycle_flags &= ~RIDE_LIFECYCLE_TEST_IN_PROGRESS; ClearUpdateFlag(VEHICLE_UPDATE_FLAG_TESTING); - window_invalidate_by_number(WC_RIDE, ride.ToUnderlying()); + window_invalidate_by_number(WindowClass::Ride, ride.ToUnderlying()); return; } @@ -2956,7 +2956,7 @@ static void test_finish(Ride& ride) totalTime = std::max(totalTime, 1u); ride.average_speed = ride.average_speed / totalTime; - window_invalidate_by_number(WC_RIDE, ride.id.ToUnderlying()); + window_invalidate_by_number(WindowClass::Ride, ride.id.ToUnderlying()); } void Vehicle::UpdateTestFinish() @@ -3006,7 +3006,7 @@ static void test_reset(Ride& ride, StationIndex curStation) } ride.total_air_time = 0; ride.current_test_station = curStation; - window_invalidate_by_number(WC_RIDE, ride.id.ToUnderlying()); + window_invalidate_by_number(WindowClass::Ride, ride.id.ToUnderlying()); } void Vehicle::TestReset() diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index d3fd51673f..b1695ac680 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -189,7 +189,7 @@ void scenario_reset() static void scenario_end() { game_reset_speed(); - window_close_by_class(WC_DROPDOWN); + window_close_by_class(WindowClass::Dropdown); window_close_all_except_flags(WF_STICK_TO_BACK | WF_STICK_TO_FRONT); context_open_window_view(WV_PARK_OBJECTIVE); } diff --git a/src/openrct2/scripting/bindings/world/ScPark.cpp b/src/openrct2/scripting/bindings/world/ScPark.cpp index a5703e95f5..2d16bc2049 100644 --- a/src/openrct2/scripting/bindings/world/ScPark.cpp +++ b/src/openrct2/scripting/bindings/world/ScPark.cpp @@ -120,7 +120,7 @@ namespace OpenRCT2::Scripting if (gParkEntranceFee != value) { gParkEntranceFee = value; - window_invalidate_by_class(WC_PARK_INFORMATION); + window_invalidate_by_class(WindowClass::ParkInformation); } } @@ -207,7 +207,7 @@ namespace OpenRCT2::Scripting if (gTotalAdmissions != value) { gTotalAdmissions = value; - window_invalidate_by_class(WC_PARK_INFORMATION); + window_invalidate_by_class(WindowClass::ParkInformation); } } @@ -222,7 +222,7 @@ namespace OpenRCT2::Scripting if (gTotalIncomeFromAdmissions != value) { gTotalIncomeFromAdmissions = value; - window_invalidate_by_class(WC_PARK_INFORMATION); + window_invalidate_by_class(WindowClass::ParkInformation); } } diff --git a/src/openrct2/title/TitleScreen.cpp b/src/openrct2/title/TitleScreen.cpp index 9840b33d7e..21acd69cc0 100644 --- a/src/openrct2/title/TitleScreen.cpp +++ b/src/openrct2/title/TitleScreen.cpp @@ -131,7 +131,7 @@ void TitleScreen::Load() OpenRCT2::Audio::StopAll(); GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE); viewport_init_all(); - context_open_window(WC_MAIN_WINDOW); + context_open_window(WindowClass::MainWindow); CreateWindows(); TitleInitialise(); OpenRCT2::Audio::PlayTitleMusic(); @@ -139,7 +139,7 @@ void TitleScreen::Load() if (gOpenRCT2ShowChangelog) { gOpenRCT2ShowChangelog = false; - context_open_window(WC_CHANGELOG); + context_open_window(WindowClass::Changelog); } if (_sequencePlayer != nullptr) @@ -215,10 +215,10 @@ void TitleScreen::ChangePresetSequence(size_t preset) */ void TitleScreen::CreateWindows() { - context_open_window(WC_TITLE_MENU); - context_open_window(WC_TITLE_EXIT); - context_open_window(WC_TITLE_OPTIONS); - context_open_window(WC_TITLE_LOGO); + context_open_window(WindowClass::TitleMenu); + context_open_window(WindowClass::TitleExit); + context_open_window(WindowClass::TitleOptions); + context_open_window(WindowClass::TitleLogo); window_resize_gui(context_get_width(), context_get_height()); _hideVersionInfo = false; } diff --git a/src/openrct2/ui/DummyWindowManager.cpp b/src/openrct2/ui/DummyWindowManager.cpp index 61d98f0c82..be8a99a8d1 100644 --- a/src/openrct2/ui/DummyWindowManager.cpp +++ b/src/openrct2/ui/DummyWindowManager.cpp @@ -15,7 +15,7 @@ namespace OpenRCT2::Ui class DummyWindowManager final : public IWindowManager { void Init() override{}; - rct_window* OpenWindow(rct_windowclass /*wc*/) override + rct_window* OpenWindow(WindowClass /*wc*/) override { return nullptr; } @@ -42,7 +42,7 @@ namespace OpenRCT2::Ui void BroadcastIntent(const Intent& /*intent*/) override { } - void ForceClose(rct_windowclass /*windowClass*/) override + void ForceClose(WindowClass /*windowClass*/) override { } void UpdateMapTooltip() override diff --git a/src/openrct2/ui/WindowManager.h b/src/openrct2/ui/WindowManager.h index 1feda7bd03..11dfebe3ea 100644 --- a/src/openrct2/ui/WindowManager.h +++ b/src/openrct2/ui/WindowManager.h @@ -28,14 +28,14 @@ namespace OpenRCT2::Ui { virtual ~IWindowManager() = default; virtual void Init() abstract; - virtual rct_window* OpenWindow(rct_windowclass wc) abstract; + virtual rct_window* OpenWindow(WindowClass wc) abstract; virtual rct_window* OpenView(uint8_t view) abstract; virtual rct_window* OpenDetails(uint8_t type, int32_t id) abstract; virtual rct_window* OpenIntent(Intent* intent) abstract; virtual void BroadcastIntent(const Intent& intent) abstract; virtual rct_window* ShowError(StringId title, StringId message, const Formatter& formatter) abstract; virtual rct_window* ShowError(std::string_view title, std::string_view message) abstract; - virtual void ForceClose(rct_windowclass windowClass) abstract; + virtual void ForceClose(WindowClass windowClass) abstract; virtual void UpdateMapTooltip() abstract; virtual void HandleInput() abstract; virtual void HandleKeyboard(bool isTitle) abstract; diff --git a/src/openrct2/windows/Intent.cpp b/src/openrct2/windows/Intent.cpp index fe90115f1f..ab046e6601 100644 --- a/src/openrct2/windows/Intent.cpp +++ b/src/openrct2/windows/Intent.cpp @@ -13,9 +13,19 @@ #include -Intent::Intent(rct_windowclass windowclass) +Intent::Intent(WindowClass windowClass) + : _Class(windowClass) +{ +} + +Intent::Intent(WindowDetail windowDetail) + : _WindowDetail(windowDetail) +{ +} + +Intent::Intent(IntentAction intentAction) + : _Action(intentAction) { - this->_Class = windowclass; } Intent* Intent::putExtra(uint32_t key, uint32_t value) @@ -73,11 +83,21 @@ Intent* Intent::putExtra(uint32_t key, close_callback value) return this; } -rct_windowclass Intent::GetWindowClass() const +WindowClass Intent::GetWindowClass() const { return this->_Class; } +WindowDetail Intent::GetWindowDetail() const +{ + return this->_WindowDetail; +} + +IntentAction Intent::GetAction() const +{ + return this->_Action; +} + void* Intent::GetPointerExtra(uint32_t key) const { if (_Data.count(key) == 0) diff --git a/src/openrct2/windows/Intent.h b/src/openrct2/windows/Intent.h index 874867620a..5df7b29ecd 100644 --- a/src/openrct2/windows/Intent.h +++ b/src/openrct2/windows/Intent.h @@ -16,6 +16,41 @@ #include #include +enum IntentAction +{ + INTENT_ACTION_MAP, + INTENT_ACTION_NEW_RIDE_OF_TYPE, + INTENT_ACTION_REFRESH_CAMPAIGN_RIDE_LIST, + INTENT_ACTION_REFRESH_NEW_RIDES, + INTENT_ACTION_REFRESH_RIDE_LIST, + INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION, + INTENT_ACTION_RIDE_CONSTRUCTION_FOCUS, + INTENT_ACTION_RIDE_CONSTRUCTION_UPDATE_PIECES, + INTENT_ACTION_RIDE_CONSTRUCTION_UPDATE_ACTIVE_ELEMENTS, + INTENT_ACTION_INIT_SCENERY, + INTENT_ACTION_SET_DEFAULT_SCENERY_CONFIG, + INTENT_ACTION_REFRESH_SCENERY, + INTENT_ACTION_INVALIDATE_TICKER_NEWS, + INTENT_ACTION_REFRESH_GUEST_LIST, + INTENT_ACTION_CLEAR_TILE_INSPECTOR_CLIPBOARD, + INTENT_ACTION_REFRESH_STAFF_LIST, + INTENT_ACTION_INVALIDATE_VEHICLE_WINDOW, + INTENT_ACTION_RIDE_PAINT_RESET_VEHICLE, + INTENT_ACTION_UPDATE_CLIMATE, + INTENT_ACTION_UPDATE_GUEST_COUNT, + INTENT_ACTION_UPDATE_PARK_RATING, + INTENT_ACTION_UPDATE_DATE, + INTENT_ACTION_UPDATE_CASH, + INTENT_ACTION_UPDATE_BANNER, + INTENT_ACTION_UPDATE_RESEARCH, + INTENT_ACTION_TRACK_DESIGN_REMOVE_PROVISIONAL, + INTENT_ACTION_TRACK_DESIGN_RESTORE_PROVISIONAL, + INTENT_ACTION_SET_MAP_TOOLTIP, + INTENT_ACTION_NEW_SCENERY, + + INTENT_ACTION_NULL = 255, +}; + struct IntentData { enum class DataType @@ -39,12 +74,18 @@ struct IntentData class Intent { private: - rct_windowclass _Class; + WindowClass _Class{ WindowClass::Null }; + WindowDetail _WindowDetail{ WD_NULL }; + IntentAction _Action{ INTENT_ACTION_NULL }; std::map _Data; public: - explicit Intent(rct_windowclass windowclass); - rct_windowclass GetWindowClass() const; + explicit Intent(WindowClass windowClass); + explicit Intent(WindowDetail windowDetail); + explicit Intent(IntentAction windowclass); + WindowClass GetWindowClass() const; + WindowDetail GetWindowDetail() const; + IntentAction GetAction() const; void* GetPointerExtra(uint32_t key) const; std::string GetStringExtra(uint32_t key) const; uint32_t GetUIntExtra(uint32_t key) const; @@ -84,36 +125,3 @@ enum INTENT_EXTRA_FORMATTER, INTENT_EXTRA_SCENERY_GROUP_ENTRY_INDEX, }; - -enum -{ - INTENT_ACTION_MAP, - INTENT_ACTION_NEW_RIDE_OF_TYPE, - INTENT_ACTION_REFRESH_CAMPAIGN_RIDE_LIST, - INTENT_ACTION_REFRESH_NEW_RIDES, - INTENT_ACTION_REFRESH_RIDE_LIST, - INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION, - INTENT_ACTION_RIDE_CONSTRUCTION_FOCUS, - INTENT_ACTION_RIDE_CONSTRUCTION_UPDATE_PIECES, - INTENT_ACTION_RIDE_CONSTRUCTION_UPDATE_ACTIVE_ELEMENTS, - INTENT_ACTION_INIT_SCENERY, - INTENT_ACTION_SET_DEFAULT_SCENERY_CONFIG, - INTENT_ACTION_REFRESH_SCENERY, - INTENT_ACTION_INVALIDATE_TICKER_NEWS, - INTENT_ACTION_REFRESH_GUEST_LIST, - INTENT_ACTION_CLEAR_TILE_INSPECTOR_CLIPBOARD, - INTENT_ACTION_REFRESH_STAFF_LIST, - INTENT_ACTION_INVALIDATE_VEHICLE_WINDOW, - INTENT_ACTION_RIDE_PAINT_RESET_VEHICLE, - INTENT_ACTION_UPDATE_CLIMATE, - INTENT_ACTION_UPDATE_GUEST_COUNT, - INTENT_ACTION_UPDATE_PARK_RATING, - INTENT_ACTION_UPDATE_DATE, - INTENT_ACTION_UPDATE_CASH, - INTENT_ACTION_UPDATE_BANNER, - INTENT_ACTION_UPDATE_RESEARCH, - INTENT_ACTION_TRACK_DESIGN_REMOVE_PROVISIONAL, - INTENT_ACTION_TRACK_DESIGN_RESTORE_PROVISIONAL, - INTENT_ACTION_SET_MAP_TOOLTIP, - INTENT_ACTION_NEW_SCENERY, -}; diff --git a/src/openrct2/windows/_legacy.cpp b/src/openrct2/windows/_legacy.cpp index 3d6e9e54b2..6ed9da54f3 100644 --- a/src/openrct2/windows/_legacy.cpp +++ b/src/openrct2/windows/_legacy.cpp @@ -406,10 +406,10 @@ void window_ride_construction_update_active_elements() */ bool scenery_tool_is_active() { - int32_t toolWindowClassification = gCurrentToolWidget.window_classification; + auto toolWindowClassification = gCurrentToolWidget.window_classification; rct_widgetindex toolWidgetIndex = gCurrentToolWidget.widget_index; if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) - if (toolWindowClassification == WC_TOP_TOOLBAR && toolWidgetIndex == WC_TOP_TOOLBAR__WIDX_SCENERY) + if (toolWindowClassification == WindowClass::TopToolbar && toolWidgetIndex == WC_TOP_TOOLBAR__WIDX_SCENERY) return true; return false; diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 744e390cad..513db39901 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -1338,14 +1338,14 @@ void map_remove_provisional_elements() footpath_provisional_remove(); gProvisionalFootpath.Flags |= PROVISIONAL_PATH_FLAG_1; } - if (window_find_by_class(WC_RIDE_CONSTRUCTION) != nullptr) + if (window_find_by_class(WindowClass::RideConstruction) != nullptr) { ride_remove_provisional_track_piece(); ride_entrance_exit_remove_ghost(); } // This is in non performant so only make network games suffer for it // non networked games do not need this as its to prevent desyncs. - if ((network_get_mode() != NETWORK_MODE_NONE) && window_find_by_class(WC_TRACK_DESIGN_PLACE) != nullptr) + if ((network_get_mode() != NETWORK_MODE_NONE) && window_find_by_class(WindowClass::TrackDesignPlace) != nullptr) { auto intent = Intent(INTENT_ACTION_TRACK_DESIGN_REMOVE_PROVISIONAL); context_broadcast_intent(&intent); @@ -1363,14 +1363,14 @@ void map_restore_provisional_elements() gProvisionalFootpath.SurfaceIndex, gProvisionalFootpath.RailingsIndex, gProvisionalFootpath.Position, gProvisionalFootpath.Slope, gProvisionalFootpath.ConstructFlags); } - if (window_find_by_class(WC_RIDE_CONSTRUCTION) != nullptr) + if (window_find_by_class(WindowClass::RideConstruction) != nullptr) { ride_restore_provisional_track_piece(); ride_entrance_exit_place_provisional_ghost(); } // This is in non performant so only make network games suffer for it // non networked games do not need this as its to prevent desyncs. - if ((network_get_mode() != NETWORK_MODE_NONE) && window_find_by_class(WC_TRACK_DESIGN_PLACE) != nullptr) + if ((network_get_mode() != NETWORK_MODE_NONE) && window_find_by_class(WindowClass::TrackDesignPlace) != nullptr) { auto intent = Intent(INTENT_ACTION_TRACK_DESIGN_RESTORE_PROVISIONAL); context_broadcast_intent(&intent); diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index 1398f6bcd0..72fff9cc6f 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -322,7 +322,7 @@ void Park::Update(const Date& date) _suggestedGuestMaximum = CalculateSuggestedMaxGuests(); _guestGenerationProbability = CalculateGuestGenerationProbability(); - window_invalidate_by_class(WC_FINANCES); + window_invalidate_by_class(WindowClass::Finances); auto intent = Intent(INTENT_ACTION_UPDATE_PARK_RATING); context_broadcast_intent(&intent); } @@ -331,7 +331,7 @@ void Park::Update(const Date& date) if (gCurrentTicks % 4096 == 0) { gParkSize = CalculateParkSize(); - window_invalidate_by_class(WC_PARK_INFORMATION); + window_invalidate_by_class(WindowClass::ParkInformation); } GenerateGuests(); @@ -356,7 +356,7 @@ uint32_t Park::CalculateParkSize() const if (tiles != gParkSize) { gParkSize = tiles; - window_invalidate_by_class(WC_PARK_INFORMATION); + window_invalidate_by_class(WindowClass::ParkInformation); } return tiles; @@ -775,8 +775,8 @@ void Park::UpdateHistories() // Invalidate relevant windows auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT); context_broadcast_intent(&intent); - window_invalidate_by_class(WC_PARK_INFORMATION); - window_invalidate_by_class(WC_FINANCES); + window_invalidate_by_class(WindowClass::ParkInformation); + window_invalidate_by_class(WindowClass::Finances); } int32_t park_is_open() @@ -790,7 +790,7 @@ uint32_t park_calculate_size() if (tiles != gParkSize) { gParkSize = tiles; - window_invalidate_by_class(WC_PARK_INFORMATION); + window_invalidate_by_class(WindowClass::ParkInformation); } return tiles; } diff --git a/src/openrct2/world/TileElement.cpp b/src/openrct2/world/TileElement.cpp index 6b1db199ff..a61157f427 100644 --- a/src/openrct2/world/TileElement.cpp +++ b/src/openrct2/world/TileElement.cpp @@ -81,7 +81,7 @@ void TileElement::RemoveBannerEntry() auto banner = GetBanner(bannerIndex); if (banner != nullptr) { - window_close_by_number(WC_BANNER, bannerIndex.ToUnderlying()); + window_close_by_number(WindowClass::Banner, bannerIndex.ToUnderlying()); DeleteBanner(banner->id); } } diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index 9b91da1ca3..00f2f592db 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -78,7 +78,7 @@ namespace OpenRCT2::TileInspector static rct_window* GetTileInspectorWithPos(const CoordsXY& loc) { // Return the tile inspector window for everyone who has the tile selected - auto* window = window_find_by_class(WC_TILE_INSPECTOR); + auto* window = window_find_by_class(WindowClass::TileInspector); if (window != nullptr && loc == windowTileInspectorTile.ToCoordsXY()) { return window; @@ -313,7 +313,7 @@ namespace OpenRCT2::TileInspector map_invalidate_tile_full(loc); if (loc == windowTileInspectorTile.ToCoordsXY()) { - window_invalidate_by_class(WC_TILE_INSPECTOR); + window_invalidate_by_class(WindowClass::TileInspector); } return GameActions::Result();