summaryrefslogtreecommitdiff
path: root/sdl.c
diff options
context:
space:
mode:
authordominik <dominik@openttd.org>2004-12-13 22:10:12 +0000
committerdominik <dominik@openttd.org>2004-12-13 22:10:12 +0000
commit77e882c3bd01976039b01c1c662f2e61fc10f132 (patch)
tree4a420e366039274cda5a356049fa055e5d97bcbe /sdl.c
parent2b13b2d239c6ee0708e8ab417397c54ed6a11b54 (diff)
downloadopenttd-77e882c3bd01976039b01c1c662f2e61fc10f132.tar.xz
(svn r1076) Feature: Patch setting to autosave the game on exit
If you set autosave_on_exit = true in openttd.cfg, your game will be saved as exit.sav in the autosave folder and you won't be asked if you want to quit the game any more.
Diffstat (limited to 'sdl.c')
-rw-r--r--sdl.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sdl.c b/sdl.c
index 7e41d9b52..88940d091 100644
--- a/sdl.c
+++ b/sdl.c
@@ -434,6 +434,8 @@ static uint32 ConvertSdlKeyIntoMy(SDL_keysym *sym)
return (key << 16) + sym->unicode;
}
+void DoExitSave();
+
static int PollEvent(void)
{
SDL_Event ev;
@@ -500,9 +502,13 @@ static int PollEvent(void)
case SDL_QUIT:
// do not ask to quit on the main screen
- if (_game_mode != GM_MENU)
- AskExitGame();
- else
+ if (_game_mode != GM_MENU) {
+ if(_patches.autosave_on_exit) {
+ DoExitSave();
+ return ML_QUIT;
+ } else
+ AskExitGame();
+ } else
return ML_QUIT;
break;