1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-30 02:05:13 +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

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