summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/tilesdl.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc
index 9db08291c6..b31ee1b9c0 100644
--- a/crawl-ref/source/tilesdl.cc
+++ b/crawl-ref/source/tilesdl.cc
@@ -847,8 +847,15 @@ int TilesFramework::getch_ck()
break;
case SDL_QUIT:
- save_game(true);
- ASSERT(!"Shouldn't get here");
+ if (crawl_state.need_save)
+ {
+ for (unsigned i = 0; i < crawl_state.exit_hooks.size(); ++i)
+ crawl_state.exit_hooks[i]->restore_state();
+
+ crawl_state.exit_hooks.clear();
+ save_game(true);
+ }
+ exit(0);
break;
case SDL_USEREVENT: