1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-27 00:34:46 +01:00

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
145 changed files with 1331 additions and 1235 deletions

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: