summaryrefslogtreecommitdiff
path: root/win32.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
commit0a1e697a292e7ffaafc7e19226adf2383889a4fc (patch)
tree4a420e366039274cda5a356049fa055e5d97bcbe /win32.c
parent5a2c5fed091e9264bdafc68325fc1ba3b9ff186f (diff)
downloadopenttd-0a1e697a292e7ffaafc7e19226adf2383889a4fc.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 'win32.c')
-rw-r--r--win32.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/win32.c b/win32.c
index 7442764ca..0cbb38b5a 100644
--- a/win32.c
+++ b/win32.c
@@ -181,6 +181,8 @@ static void ClientSizeChanged(int w, int h)
}
}
+void DoExitSave();
+
static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
@@ -224,7 +226,15 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
}
case WM_CLOSE:
- AskExitGame();
+ // do not ask to quit on the main screen
+ if (_game_mode != GM_MENU) {
+ if(_patches.autosave_on_exit) {
+ DoExitSave();
+ _exit_game = true;
+ } else
+ AskExitGame();
+ } else
+ return ML_QUIT;
return 0;
case WM_LBUTTONDOWN: