mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-28 09:14:58 +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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user