mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-18 12:33:17 +01:00
Move rct2_quit to Context
This commit is contained in:
@@ -281,7 +281,7 @@ public:
|
||||
{
|
||||
switch (e.type) {
|
||||
case SDL_QUIT:
|
||||
rct2_quit();
|
||||
context_quit();
|
||||
break;
|
||||
case SDL_WINDOWEVENT:
|
||||
// HACK: Fix #2158, OpenRCT2 does not draw if it does not think that the window is
|
||||
|
||||
@@ -167,6 +167,12 @@ namespace OpenRCT2
|
||||
_finished = true;
|
||||
}
|
||||
|
||||
void Quit() override
|
||||
{
|
||||
gSavePromptMode = PM_QUIT;
|
||||
window_save_prompt_open();
|
||||
}
|
||||
|
||||
bool Initialise() final override
|
||||
{
|
||||
if (_initialised)
|
||||
@@ -856,6 +862,11 @@ extern "C"
|
||||
return GetContext()->GetUiContext()->ReadBMP(outPixels, outWidth, outHeight, std::string(path));
|
||||
}
|
||||
|
||||
void context_quit()
|
||||
{
|
||||
GetContext()->Quit();
|
||||
}
|
||||
|
||||
bool platform_open_common_file_dialog(utf8 * outFilename, file_dialog_desc * desc, size_t outSize)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -98,6 +98,7 @@ namespace OpenRCT2
|
||||
virtual bool Initialise() abstract;
|
||||
virtual void Open(const std::string &path) abstract;
|
||||
virtual void Finish() abstract;
|
||||
virtual void Quit() abstract;
|
||||
};
|
||||
|
||||
IContext * CreateContext();
|
||||
@@ -147,6 +148,7 @@ extern "C"
|
||||
rct_window * context_open_window(rct_windowclass wc);
|
||||
void context_input_handle_keyboard(bool isTitle);
|
||||
bool context_read_bmp(void * * outPixels, uint32 * outWidth, uint32 * outHeight, const utf8 * path);
|
||||
void context_quit();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -87,12 +87,6 @@ uint8 gSavePromptMode;
|
||||
|
||||
char gRCT2AddressAppPath[MAX_PATH];
|
||||
|
||||
void rct2_quit()
|
||||
{
|
||||
gSavePromptMode = PM_QUIT;
|
||||
window_save_prompt_open();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00683499
|
||||
|
||||
@@ -157,7 +157,6 @@ extern char gRCT2AddressAppPath[];
|
||||
|
||||
sint32 rct2_init_directories();
|
||||
const char *get_file_path(sint32 pathId);
|
||||
void rct2_quit();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ static void window_title_exit_mouseup(rct_window *w, rct_widgetindex widgetIndex
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_EXIT:
|
||||
rct2_quit();
|
||||
context_quit();
|
||||
//game_do_command(0, 1, 0, 0, 5, 3, 0);
|
||||
break;
|
||||
};
|
||||
|
||||
@@ -585,7 +585,7 @@ static void window_top_toolbar_dropdown(rct_window *w, rct_widgetindex widgetInd
|
||||
game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 1, 0);
|
||||
break;
|
||||
case DDIDX_EXIT_OPENRCT2:
|
||||
rct2_quit();
|
||||
context_quit();
|
||||
break;
|
||||
#ifndef DISABLE_TWITCH
|
||||
case DDIDX_ENABLE_TWITCH:
|
||||
|
||||
Reference in New Issue
Block a user