summaryrefslogtreecommitdiff
path: root/video
diff options
context:
space:
mode:
Diffstat (limited to 'video')
-rw-r--r--video/cocoa_v.m18
-rw-r--r--video/sdl_v.c20
-rw-r--r--video/win32_v.c11
3 files changed, 4 insertions, 45 deletions
diff --git a/video/cocoa_v.m b/video/cocoa_v.m
index d2b88b5f2..2db610282 100644
--- a/video/cocoa_v.m
+++ b/video/cocoa_v.m
@@ -197,22 +197,6 @@ static void QZ_CheckPaletteAnim(void)
-extern void DoExitSave(void);
-
-static void QZ_AskQuit(void)
-{
- if (_game_mode == GM_MENU) { // do not ask to quit on the main screen
- _exit_game = true;
- } else if (_patches.autosave_on_exit) {
- DoExitSave();
- _exit_game = true;
- } else {
- AskExitGame();
- }
-}
-
-
-
typedef struct VkMapping {
unsigned short vk_from;
byte map_to;
@@ -921,7 +905,7 @@ static void QZ_SetPortAlphaOpaque(void)
@implementation OTTD_QuartzWindowDelegate
- (BOOL)windowShouldClose:(id)sender
{
- QZ_AskQuit();
+ HandleExitGameRequest();
return NO;
}
diff --git a/video/sdl_v.c b/video/sdl_v.c
index 57c81c556..b8b79b86b 100644
--- a/video/sdl_v.c
+++ b/video/sdl_v.c
@@ -303,8 +303,6 @@ static uint32 ConvertSdlKeyIntoMy(SDL_keysym *sym)
return (key << 16) + sym->unicode;
}
-extern void DoExitSave(void);
-
static int PollEvent(void)
{
SDL_Event ev;
@@ -376,21 +374,9 @@ static int PollEvent(void)
}
break;
- case SDL_QUIT:
- // do not ask to quit on the main screen
- if (_game_mode != GM_MENU) {
- if (_patches.autosave_on_exit) {
- DoExitSave();
- return 0;
- } else {
- AskExitGame();
- }
- } else {
- return 0;
- }
- break;
+ case SDL_QUIT: HandleExitGameRequest(); break;
- case SDL_KEYDOWN: /* Toggle full-screen on ALT + ENTER/F */
+ case SDL_KEYDOWN: /* Toggle full-screen on ALT + ENTER/F */
if ((ev.key.keysym.mod & (KMOD_ALT | KMOD_META)) &&
(ev.key.keysym.sym == SDLK_RETURN || ev.key.keysym.sym == SDLK_f)) {
ToggleFullScreen(!_fullscreen);
@@ -448,8 +434,6 @@ static void SdlVideoMainLoop(void)
InteractiveRandom(); // randomness
while ((i = PollEvent()) == -1) {}
- if (i >= 0) return;
-
if (_exit_game) return;
mod = SDL_CALL SDL_GetModState();
diff --git a/video/win32_v.c b/video/win32_v.c
index 207683db4..05bc4d7a6 100644
--- a/video/win32_v.c
+++ b/video/win32_v.c
@@ -151,8 +151,6 @@ static void ClientSizeChanged(int w, int h)
}
}
-extern void DoExitSave(void);
-
#ifdef _DEBUG
// Keep this function here..
// It allows you to redraw the screen from within the MSVC debugger
@@ -256,14 +254,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
}
case WM_CLOSE:
- if (_game_mode == GM_MENU) { // do not ask to quit on the main screen
- _exit_game = true;
- } else if (_patches.autosave_on_exit) {
- DoExitSave();
- _exit_game = true;
- } else {
- AskExitGame();
- }
+ HandleExitGameRequest();
_window_maximize = IsZoomed(_wnd.main_wnd);
return 0;