summaryrefslogtreecommitdiff
path: root/openttd.c
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2006-09-04 17:30:30 +0000
committerrubidium <rubidium@openttd.org>2006-09-04 17:30:30 +0000
commita7cfb80c40d9a4c544ece10872fd3808f9f59f8d (patch)
tree6cd5046c6a647012a61f5f97b8c5794446df92c5 /openttd.c
parent56d06ba0a75b7157fdd236327cd08f9b0538551e (diff)
downloadopenttd-a7cfb80c40d9a4c544ece10872fd3808f9f59f8d.tar.xz
(svn r6380) -Codechange: unify all ways to quit OTTD.
This means that in the intro menu the 'Quit' button immediatelly quits and the 'Quit' in the menu of the normal game and scenario editor immediatelly quits when the 'autosave_on_exit' patch is turned on. This is the same way as the OS/window manager initiated quits, like alt-F4 and the 'x' in the (OS/window manager drawn) title bar of OTTD.
Diffstat (limited to 'openttd.c')
-rw-r--r--openttd.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/openttd.c b/openttd.c
index d4414fdf3..447c5ce89 100644
--- a/openttd.c
+++ b/openttd.c
@@ -537,6 +537,19 @@ int ttd_main(int argc, char *argv[])
return 0;
}
+void HandleExitGameRequest(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();
+ }
+}
+
+
/** Mutex so that only one thread can communicate with the main program
* at any given time */
static ThreadMsg _message = MSG_OTTD_NO_MESSAGE;