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.
This commit is contained in:
Hielke Morsink 2022-08-21 18:38:25 +02:00 committed by GitHub
parent ebe38a91ce
commit 7f29e4e39c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
145 changed files with 1331 additions and 1235 deletions

View File

@ -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);
}

View File

@ -18,6 +18,7 @@
#include <openrct2/Input.h>
#include <openrct2/config/Config.h>
#include <openrct2/core/Console.hpp>
#include <openrct2/core/Guard.hpp>
#include <openrct2/entity/EntityRegistry.h>
#include <openrct2/interface/Viewport.h>
#include <openrct2/localisation/Formatter.h>
@ -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<Peep*>(intent->GetPointerExtra(INTENT_EXTRA_PEEP)));
case WC_FIRE_PROMPT:
case WindowClass::FirePrompt:
return WindowStaffFirePromptOpen(static_cast<Peep*>(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<GuestListFilterType>(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<TrackDesignFileRef*>(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<const ObjectEntryDescriptor*>(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<TrackDesignFileRef*>(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<scenarioselect_callback>(intent->GetPointerExtra(INTENT_EXTRA_CALLBACK)), false);
case WD_VEHICLE:
return WindowRideOpenVehicle(static_cast<Vehicle*>(intent->GetPointerExtra(INTENT_EXTRA_VEHICLE)));
case WD_TRACK:
return WindowRideOpenTrack(static_cast<TileElement*>(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<Vehicle*>(intent->GetPointerExtra(INTENT_EXTRA_VEHICLE)));
case WD_TRACK:
return WindowRideOpenTrack(static_cast<TileElement*>(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<Vehicle*>(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<uint8_t>(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;

View File

@ -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;

View File

@ -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);
}
}
}

View File

@ -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();
}
}

View File

@ -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);
}
}
});

View File

@ -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,

View File

@ -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<UIThemeWindowEntry*>(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);

View File

@ -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);

View File

@ -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();

View File

@ -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)
{

View File

@ -201,7 +201,7 @@ static ScreenCoordsXY GetCentrePositionForNewWindow(int32_t width, int32_t heigh
}
rct_window* WindowCreate(
std::unique_ptr<rct_window>&& wp, rct_windowclass cls, ScreenCoordsXY pos, int32_t width, int32_t height, uint32_t flags)
std::unique_ptr<rct_window>&& 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<rct_window>();
@ -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;

View File

@ -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

View File

@ -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<CustomWindow>(WC_CUSTOM, { *desc.X, *desc.Y }, desc.Width, desc.Height, windowFlags);
window = WindowCreate<CustomWindow>(
WindowClass::Custom, { *desc.X, *desc.Y }, desc.Width, desc.Height, windowFlags);
}
else
{
window = WindowCreate<CustomWindow>(WC_CUSTOM, desc.Width, desc.Height, windowFlags);
window = WindowCreate<CustomWindow>(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<std::shared_ptr<rct_window>> customWindows;
for (const auto& window : g_window_list)
{
if (window->classification == WC_CUSTOM)
if (window->classification == WindowClass::Custom)
{
auto customWindow = reinterpret_cast<CustomWindow*>(window.get());
auto customInfo = reinterpret_cast<CustomWindowInfo*>(customWindow->custom_info);

View File

@ -133,7 +133,7 @@ namespace OpenRCT2::Scripting
std::shared_ptr<ScViewport> mainViewport_get() const
{
return std::make_shared<ScViewport>(WC_MAIN_WINDOW);
return std::make_shared<ScViewport>(WindowClass::MainWindow);
}
std::shared_ptr<ScTileSelection> 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)

View File

@ -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);

View File

@ -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)
{
}

View File

@ -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;
}

View File

@ -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()

View File

@ -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<AboutWindow>(WC_ABOUT, WW, WH, WF_CENTRE_SCREEN);
return WindowFocusOrCreate<AboutWindow>(WindowClass::About, WW, WH, WF_CENTRE_SCREEN);
}

View File

@ -300,12 +300,12 @@ public:
*/
rct_window* WindowBannerOpen(rct_windownumber number)
{
auto w = static_cast<BannerWindow*>(window_bring_to_front_by_number(WC_BANNER, number));
auto w = static_cast<BannerWindow*>(window_bring_to_front_by_number(WindowClass::Banner, number));
if (w != nullptr)
return w;
w = WindowCreate<BannerWindow>(WC_BANNER, WW, WH, 0);
w = WindowCreate<BannerWindow>(WindowClass::Banner, WW, WH, 0);
if (w != nullptr)
w->Initialise(number);

View File

@ -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<ChangelogWindow>(WC_CHANGELOG, pos, width, height, WF_RESIZABLE);
auto* newWindow = WindowCreate<ChangelogWindow>(WindowClass::Changelog, pos, width, height, WF_RESIZABLE);
newWindow->SetPersonality(personality);
return newWindow;
}

View File

@ -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<CheatsWindow>(WC_CHEATS, ScreenCoordsXY(32, 32), WW, WH);
window = WindowCreate<CheatsWindow>(WindowClass::Cheats, ScreenCoordsXY(32, 32), WW, WH);
}
return window;
}

View File

@ -199,12 +199,12 @@ public:
rct_window* WindowClearSceneryOpen()
{
auto* w = static_cast<CleanSceneryWindow*>(window_bring_to_front_by_class(WC_CLEAR_SCENERY));
auto* w = static_cast<CleanSceneryWindow*>(window_bring_to_front_by_class(WindowClass::ClearScenery));
if (w != nullptr)
return w;
w = WindowCreate<CleanSceneryWindow>(WC_CLEAR_SCENERY, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0);
w = WindowCreate<CleanSceneryWindow>(WindowClass::ClearScenery, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0);
if (w != nullptr)
return w;

View File

@ -225,5 +225,5 @@ public:
rct_window* CustomCurrencyWindowOpen()
{
return WindowFocusOrCreate<CustomCurrencyWindow>(WC_CUSTOM_CURRENCY_CONFIG, WW, WH, WF_CENTRE_SCREEN);
return WindowFocusOrCreate<CustomCurrencyWindow>(WindowClass::CustomCurrencyConfig, WW, WH, WF_CENTRE_SCREEN);
}

View File

@ -146,7 +146,7 @@ public:
rct_window* WindowDebugPaintOpen()
{
auto* window = WindowFocusOrCreate<DebugPaintWindow>(
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;

View File

@ -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<DemolishRidePromptWindow>(WC_DEMOLISH_RIDE_PROMPT, windowPos, WW, WH, WF_TRANSPARENT);
newWindow = WindowCreate<DemolishRidePromptWindow>(WindowClass::DemolishRidePrompt, windowPos, WW, WH, WF_TRANSPARENT);
}
else
{
newWindow = WindowCreate<DemolishRidePromptWindow>(WC_DEMOLISH_RIDE_PROMPT, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT);
newWindow = WindowCreate<DemolishRidePromptWindow>(
WindowClass::DemolishRidePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT);
}
newWindow->SetRide(ride);

View File

@ -384,7 +384,7 @@ void WindowDropdownShowTextCustomWidth(
WindowDropdownClose();
// Create the window (width/height position are set later)
auto* w = WindowCreate<DropdownWindow>(WC_DROPDOWN, width, custom_height, WF_STICK_TO_FRONT);
auto* w = WindowCreate<DropdownWindow>(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<DropdownWindow>(WC_DROPDOWN, itemWidth, itemHeight, WF_STICK_TO_FRONT);
auto* w = WindowCreate<DropdownWindow>(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<DropdownWindow*>(w);
return ddWnd->GetIndexFromPoint(loc);

View File

@ -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<EditorBottomToolbarWindow>(
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;

View File

@ -577,7 +577,7 @@ private:
rct_window* WindowEditorInventionsListOpen()
{
return WindowFocusOrCreate<InventionListWindow>(
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<InventionListWindow*>(window_find_by_class(WC_EDITOR_INVENTION_LIST));
auto* inventionListWindow = static_cast<InventionListWindow*>(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<InventionListWindow*>(window_find_by_class(WC_EDITOR_INVENTION_LIST));
auto* inventionListWindow = static_cast<InventionListWindow*>(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<InventionDragWindow>(
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<InventionDragWindow*>(window_find_by_class(WC_EDITOR_INVENTION_LIST_DRAG));
auto* wnd = static_cast<InventionDragWindow*>(window_find_by_class(WindowClass::EditorInventionListDrag));
if (wnd == nullptr)
{
return nullptr;

View File

@ -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<EditorObjectSelectionWindow>(
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)

View File

@ -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];

View File

@ -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);
}
}

View File

@ -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)

View File

@ -1014,12 +1014,12 @@ public:
rct_window* WindowFinancesOpen()
{
return WindowFocusOrCreate<FinancesWindow>(WC_FINANCES, WW_OTHER_TABS, WH_SUMMARY, WF_10);
return WindowFocusOrCreate<FinancesWindow>(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10);
}
rct_window* WindowFinancesResearchOpen()
{
auto* window = WindowFocusOrCreate<FinancesWindow>(WC_FINANCES, WW_OTHER_TABS, WH_SUMMARY, WF_10);
auto* window = WindowFocusOrCreate<FinancesWindow>(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10);
if (window != nullptr)
window->SetPage(WINDOW_FINANCES_PAGE_RESEARCH);

View File

@ -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;

View File

@ -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];

View File

@ -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<GuestWindow*>(window_bring_to_front_by_number(WC_PEEP, peep->sprite_index.ToUnderlying()));
auto* window = static_cast<GuestWindow*>(
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<GuestWindow>(WC_PEEP, windowWidth, 157, WF_RESIZABLE);
window = WindowCreate<GuestWindow>(WindowClass::Peep, windowWidth, 157, WF_RESIZABLE);
if (window == nullptr)
{
return nullptr;

View File

@ -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<GuestListWindow>(WC_GUEST_LIST, 350, 330, WF_10 | WF_RESIZABLE);
window = WindowCreate<GuestListWindow>(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<GuestListWindow*>(w)->RefreshList();

View File

@ -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;

View File

@ -340,5 +340,5 @@ private:
rct_window* WindowLandOpen()
{
return WindowFocusOrCreate<LandWindow>(WC_LAND, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0);
return WindowFocusOrCreate<LandWindow>(WindowClass::Land, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0);
}

View File

@ -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<LandRightsWindow>(WC_LAND_RIGHTS, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0);
return WindowFocusOrCreate<LandRightsWindow>(
WindowClass::LandRights, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0);
}

View File

@ -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:

View File

@ -73,5 +73,6 @@ private:
*/
rct_window* WindowMainOpen()
{
return WindowCreate<MainWindow>(WC_MAIN_WINDOW, { 0, 0 }, context_get_width(), context_get_height(), WF_STICK_TO_BACK);
return WindowCreate<MainWindow>(
WindowClass::MainWindow, { 0, 0 }, context_get_width(), context_get_height(), WF_STICK_TO_BACK);
}

View File

@ -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<MapWindow>(WC_MAP, 245, 259, WF_10);
rct_window* w = WindowFocusOrCreate<MapWindow>(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;

View File

@ -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<void*>(WindowMapgenHeightmapLoadsaveCallback));
context_open_intent(&intent);

View File

@ -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>(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;
}

View File

@ -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<MazeConstructionWindow>(WC_RIDE_CONSTRUCTION, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE);
return WindowFocusOrCreate<MazeConstructionWindow>(
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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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<NewCampaignWindow*>(window_bring_to_front_by_class(WC_NEW_CAMPAIGN));
auto w = static_cast<NewCampaignWindow*>(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<NewCampaignWindow>(WC_NEW_CAMPAIGN, WW, WH, 0);
w = WindowCreate<NewCampaignWindow>(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<NewCampaignWindow*>(window_find_by_class(WC_NEW_CAMPAIGN));
auto w = static_cast<NewCampaignWindow*>(window_find_by_class(WindowClass::NewCampaign));
if (w != nullptr)
{
w->RefreshRides();

View File

@ -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<NewRideWindow>(WC_CONSTRUCT_RIDE, WindowWidth, WindowHeight, WF_10 | WF_AUTO_POSITION);
window = WindowCreate<NewRideWindow>(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<NewRideWindow*>(window_find_by_class(WC_CONSTRUCT_RIDE));
auto w = static_cast<NewRideWindow*>(window_find_by_class(WindowClass::ConstructRide));
if (!w)
{
return;

View File

@ -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<NewsWindow>(WC_RECENT_NEWS, WW, WH, 0);
return WindowFocusOrCreate<NewsWindow>(WindowClass::RecentNews, WW, WH, 0);
}

View File

@ -273,5 +273,5 @@ private:
rct_window* WindowNewsOptionsOpen()
{
return WindowFocusOrCreate<NewsOptionsWindow>(WC_NOTIFICATION_OPTIONS, WW, WH, WF_CENTRE_SCREEN);
return WindowFocusOrCreate<NewsOptionsWindow>(WindowClass::NotificationOptions, WW, WH, WF_CENTRE_SCREEN);
}

View File

@ -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<ObjectLoadErrorWindow>(WC_OBJECT_LOAD_ERROR, WW, WH, 0);
window = WindowCreate<ObjectLoadErrorWindow>(WindowClass::ObjectLoadError, WW, WH, 0);
}
static_cast<ObjectLoadErrorWindow*>(window)->Initialise(path, numMissingObjects, missingObjects);

View File

@ -1189,7 +1189,7 @@ private:
if (dropdownIndex == EnumValue(CurrencyType::Custom) + 1)
{ // Add 1 because the separator occupies a position
gConfigGeneral.currency_format = static_cast<CurrencyType>(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<OptionsWindow>(WC_OPTIONS, WW, WH, WF_CENTRE_SCREEN);
return WindowFocusOrCreate<OptionsWindow>(WindowClass::Options, WW, WH, WF_CENTRE_SCREEN);
}

View File

@ -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<ParkWindow>(WC_PARK_INFORMATION, 230, 174 + 9, WF_10);
auto* wnd = WindowFocusOrCreate<ParkWindow>(WindowClass::ParkInformation, 230, 174 + 9, WF_10);
if (wnd != nullptr && page != WINDOW_PARK_PAGE_ENTRANCE)
{
wnd->OnMouseUp(WIDX_TAB_1 + page);

View File

@ -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<PatrolAreaWindow>(WC_PATROL_AREA, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0);
auto w = WindowFocusOrCreate<PatrolAreaWindow>(
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<PatrolAreaWindow*>(window_find_by_class(WC_PATROL_AREA));
auto current = reinterpret_cast<PatrolAreaWindow*>(window_find_by_class(WindowClass::PatrolArea));
return current != nullptr ? current->GetStaffId() : EntityId::GetNull();
}

View File

@ -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;

View File

@ -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<RefurbishRidePromptWindow>(WC_DEMOLISH_RIDE_PROMPT, windowPos, WW, WH, WF_TRANSPARENT);
newWindow = WindowCreate<RefurbishRidePromptWindow>(WindowClass::DemolishRidePrompt, windowPos, WW, WH, WF_TRANSPARENT);
}
else
{
newWindow = WindowCreate<RefurbishRidePromptWindow>(WC_DEMOLISH_RIDE_PROMPT, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT);
newWindow = WindowCreate<RefurbishRidePromptWindow>(
WindowClass::DemolishRidePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT);
}
newWindow->SetRide(ride);

View File

@ -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;

View File

@ -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<int32_t>(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<int32_t>(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<int32_t>(GuestListFilterType::GuestsInQueue));
intent.putExtra(INTENT_EXTRA_RIDE_ID, w->number);
context_open_intent(&intent);

View File

@ -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<RideConstructionWindow>(
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<RideConstructionWindow>(WC_RIDE_CONSTRUCTION, ScreenCoordsXY(0, 29), 166, 394, WF_NO_AUTO_CLOSE);
return WindowCreate<RideConstructionWindow>(
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<RideConstructionWindow*>(window_find_by_class(WC_RIDE_CONSTRUCTION));
auto window = static_cast<RideConstructionWindow*>(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<RideConstructionWindow*>(window_find_by_class(WC_RIDE_CONSTRUCTION));
auto window = static_cast<RideConstructionWindow*>(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;

View File

@ -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<RideListWindow>(WC_RIDE_LIST, ScreenCoordsXY(32, 32), WW, WH, WF_10 | WF_RESIZABLE);
window = WindowCreate<RideListWindow>(WindowClass::RideList, ScreenCoordsXY(32, 32), WW, WH, WF_10 | WF_RESIZABLE);
}
return window;
}

View File

@ -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<Intent>(WC_LOADSAVE);
intent = std::make_unique<Intent>(WindowClass::Loadsave);
intent->putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE);
intent->putExtra(INTENT_EXTRA_PATH, gScenarioName);
}

View File

@ -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<void(std::string_view)> 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;

View File

@ -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<SceneryWindow*>(window_bring_to_front_by_class(WC_SCENERY));
auto* w = static_cast<SceneryWindow*>(window_bring_to_front_by_class(WindowClass::Scenery));
if (w == nullptr)
{
w = WindowCreate<SceneryWindow>(WC_SCENERY);
w = WindowCreate<SceneryWindow>(WindowClass::Scenery);
}
return w;
}
@ -1366,7 +1366,7 @@ void WindowScenerySetSelectedItem(
const ScenerySelection& scenery, const std::optional<colour_t> primary, const std::optional<colour_t> secondary,
const std::optional<colour_t> tertiary, const std::optional<colour_t> rotation)
{
auto* w = static_cast<SceneryWindow*>(window_bring_to_front_by_class(WC_SCENERY));
auto* w = static_cast<SceneryWindow*>(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<SceneryWindow*>(window_find_by_class(WC_SCENERY));
auto* w = static_cast<SceneryWindow*>(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<SceneryWindow*>(window_find_by_class(WC_SCENERY));
auto* w = static_cast<SceneryWindow*>(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<SceneryWindow*>(window_find_by_class(WC_SCENERY));
auto* w = static_cast<SceneryWindow*>(window_find_by_class(WindowClass::Scenery));
if (w != nullptr)
{
w->Init();

View File

@ -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<SceneryScatterWindow>(WC_SCENERY_SCATTER, 86, 100);
window = WindowCreate<SceneryScatterWindow>(WindowClass::SceneryScatter, 86, 100);
}
return window;

View File

@ -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;
}
}

View File

@ -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<void*>(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<ServerStartWindow>(WC_SERVER_START, WW, WH, WF_CENTRE_SCREEN);
return WindowFocusOrCreate<ServerStartWindow>(WindowClass::ServerStart, WW, WH, WF_CENTRE_SCREEN);
}
#endif

View File

@ -78,8 +78,9 @@ public:
auto registeredShortcut = shortcutManager.GetShortcut(shortcutId);
if (registeredShortcut != nullptr)
{
window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
auto w = WindowCreate<ChangeShortcutWindow>(WC_CHANGE_KEYBOARD_SHORTCUT, CHANGE_WW, CHANGE_WH, WF_CENTRE_SCREEN);
window_close_by_class(WindowClass::ChangeKeyboardShortcut);
auto w = WindowCreate<ChangeShortcutWindow>(
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<ShortcutKeysWindow*>(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<ShortcutKeysWindow>(WC_KEYBOARD_SHORTCUT_LIST, WW, WH, WF_RESIZABLE);
w = WindowCreate<ShortcutKeysWindow>(WindowClass::KeyboardShortcutList, WW, WH, WF_RESIZABLE);
}
return w;
}

View File

@ -318,12 +318,12 @@ public:
*/
rct_window* WindowSignOpen(rct_windownumber number)
{
auto* w = static_cast<SignWindow*>(window_bring_to_front_by_number(WC_BANNER, number));
auto* w = static_cast<SignWindow*>(window_bring_to_front_by_number(WindowClass::Banner, number));
if (w != nullptr)
return w;
w = WindowCreate<SignWindow>(WC_BANNER, WW, WH, 0);
w = WindowCreate<SignWindow>(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<SignWindow*>(window_bring_to_front_by_number(WC_BANNER, number));
auto* w = static_cast<SignWindow*>(window_bring_to_front_by_number(WindowClass::Banner, number));
if (w != nullptr)
return w;
w = WindowCreate<SignWindow>(WC_BANNER, WW, WH, 0);
w = WindowCreate<SignWindow>(WindowClass::Banner, WW, WH, 0);
if (w == nullptr)
return nullptr;

View File

@ -320,7 +320,7 @@ private:
void CommonPrepareDrawBefore()
{
ColourSchemeUpdateByClass(this, static_cast<rct_windowclass>(WC_STAFF));
ColourSchemeUpdateByClass(this, static_cast<WindowClass>(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<StaffWindow*>(window_bring_to_front_by_number(WC_PEEP, peep->sprite_index.ToUnderlying()));
auto w = static_cast<StaffWindow*>(window_bring_to_front_by_number(WindowClass::Peep, peep->sprite_index.ToUnderlying()));
if (w != nullptr)
return w;
w = WindowCreate<StaffWindow>(WC_PEEP, WW, WH, WF_10 | WF_RESIZABLE);
w = WindowCreate<StaffWindow>(WindowClass::Peep, WW, WH, WF_10 | WF_RESIZABLE);
if (w == nullptr)
return nullptr;

View File

@ -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);

View File

@ -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<Staff>())
@ -355,7 +355,7 @@ public:
auto peep = GetEntity<Staff>(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<StaffHireNewActionResult>();
// Open window for new staff.
auto* staff = GetEntity<Staff>(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<StaffListWindow>(WC_STAFF_LIST, WW, WH, WF_10 | WF_RESIZABLE);
return WindowFocusOrCreate<StaffListWindow>(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<StaffListWindow*>(window)->RefreshList();

View File

@ -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<TextInputWindow>(WC_TEXTINPUT, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
auto w = WindowCreate<TextInputWindow>(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<void(std::string_view)> callback, std::function<void()> cancelCallback)
{
auto height = TextInputWindow::CalculateWindowHeight(initialValue);
auto w = WindowCreate<TextInputWindow>(WC_TEXTINPUT, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
auto w = WindowCreate<TextInputWindow>(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<TextInputWindow*>(w);
textInputWindow->OnReturnPressed();

View File

@ -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++)
{

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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:

View File

@ -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;
}
}

View File

@ -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;
}
/**

View File

@ -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<void*>(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;

View File

@ -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;

View File

@ -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<TrackDesignPlaceWindow>(WC_TRACK_DESIGN_PLACE, WW, WH, 0);
auto* window = WindowFocusOrCreate<TrackDesignPlaceWindow>(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<TrackDesignPlaceWindow*>(window_find_by_class(WC_TRACK_DESIGN_PLACE));
auto* trackPlaceWnd = static_cast<TrackDesignPlaceWindow*>(window_find_by_class(WindowClass::TrackDesignPlace));
if (trackPlaceWnd != nullptr)
{
trackPlaceWnd->ClearProvisionalTemporarily();
@ -641,7 +641,7 @@ void TrackPlaceClearProvisionalTemporarily()
void TrackPlaceRestoreProvisional()
{
auto* trackPlaceWnd = static_cast<TrackDesignPlaceWindow*>(window_find_by_class(WC_TRACK_DESIGN_PLACE));
auto* trackPlaceWnd = static_cast<TrackDesignPlaceWindow*>(window_find_by_class(WindowClass::TrackDesignPlace));
if (trackPlaceWnd != nullptr)
{
trackPlaceWnd->RestoreProvisional();

View File

@ -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<TrackListWindow>(WC_TRACK_DESIGN_LIST, WW, WH, 0);
auto* w = WindowCreate<TrackListWindow>(WindowClass::TrackDesignList, WW, WH, 0);
w->SetRideSelection(item);
return w;
}

View File

@ -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<TransparencyWindow>(WC_TRANSPARENCY, ScreenCoordsXY(32, 32), WW, WH);
window = WindowCreate<TransparencyWindow>(WindowClass::Transparency, ScreenCoordsXY(32, 32), WW, WH);
return window;
}

View File

@ -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<ViewClippingWindow>(WC_VIEW_CLIPPING, ScreenCoordsXY(32, 32), WW, WH);
window = WindowCreate<ViewClippingWindow>(WindowClass::ViewClipping, ScreenCoordsXY(32, 32), WW, WH);
}
return window;
}

View File

@ -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<ViewportWindow>(WC_VIEWPORT, std::max(WW, width), std::max(WH, height), WF_RESIZABLE);
auto* w = WindowCreate<ViewportWindow>(WindowClass::Viewport, std::max(WW, width), std::max(WH, height), WF_RESIZABLE);
if (w != nullptr)
return w;

View File

@ -187,5 +187,5 @@ private:
rct_window* WindowWaterOpen()
{
return WindowFocusOrCreate<WaterWindow>(WC_WATER, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0);
return WindowFocusOrCreate<WaterWindow>(WindowClass::Water, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0);
}

View File

@ -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<ObjectEntryDescriptor*>(e.MissingObjects.data()));
intent.putExtra(INTENT_EXTRA_LIST_COUNT, static_cast<uint32_t>(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);

View File

@ -11,6 +11,7 @@
#include "common.h"
#include "core/String.hpp"
#include "interface/WindowClasses.h"
#include "world/Location.hpp"
#include <memory>
@ -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);

View File

@ -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<void*>(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:

View File

@ -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<Intent> create_save_game_as_intent()
{
auto name = Path::GetFileNameWithoutExtension(gScenarioSavePath);
auto intent = std::make_unique<Intent>(WC_LOADSAVE);
auto intent = std::make_unique<Intent>(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<void*>(game_load_or_quit_no_save_prompt_callback));
context_open_intent(&intent);

View File

@ -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;
};

View File

@ -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();

View File

@ -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);

View File

@ -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 });

View File

@ -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;
}

Some files were not shown because too many files have changed in this diff Show More