From: Ryan Flegel Date: Thu, 19 Jun 2008 04:42:16 +0000 (+0000) Subject: Esc in menu now goes back to previous menu instead of going straight back to the... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=9e02b1270eb88da634dcaa7674d9ca04e66ddc6c;p=supertux.git Esc in menu now goes back to previous menu instead of going straight back to the game SVN-Revision: 5588 --- 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?