From 9e02b1270eb88da634dcaa7674d9ca04e66ddc6c Mon Sep 17 00:00:00 2001 From: Ryan Flegel Date: Thu, 19 Jun 2008 04:42:16 +0000 Subject: [PATCH] Esc in menu now goes back to previous menu instead of going straight back to the game SVN-Revision: 5588 --- src/game_session.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/game_session.cpp b/src/game_session.cpp index 84893569f..6673c6258 100644 --- a/src/game_session.cpp +++ b/src/game_session.cpp @@ -305,17 +305,16 @@ GameSession::on_escape_press() void GameSession::toggle_pause() { + // pause if(!game_pause) { speed_before_pause = main_loop->get_speed(); main_loop->set_speed(0); Menu::set_current(game_menu.get()); game_menu->set_active_item(MNID_CONTINUE); game_pause = true; - } else { - main_loop->set_speed(speed_before_pause); - Menu::set_current(NULL); - game_pause = false; } + + // unpause is done in menu() after the menu is processed } void @@ -501,6 +500,12 @@ GameSession::update(float elapsed_time) process_events(); process_menu(); + // Unpause the game if the menu has been closed + if (game_pause && !Menu::current()) { + main_loop->set_speed(speed_before_pause); + game_pause = false; + } + check_end_conditions(); // respawning in new sector? -- 2.11.0