1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 14:24:33 +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

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