From: Miloš Klouček Date: Wed, 10 Jun 2009 19:50:04 +0000 (+0000) Subject: *possible* fix for bugs #453 and #373 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=2d1bc69993923150eb701d3cacb917ab4e23d5ef;p=supertux.git *possible* fix for bugs #453 and #373 Menu is updated in mainloop so it won't stay open (because noone updates it) SVN-Revision: 5892 --- diff --git a/src/game_session.cpp b/src/game_session.cpp index a5f00763e..09dcf5a3c 100644 --- a/src/game_session.cpp +++ b/src/game_session.cpp @@ -396,8 +396,6 @@ GameSession::process_menu() { Menu* menu = Menu::current(); if(menu) { - menu->update(); - if(menu == game_menu.get()) { switch (game_menu->check()) { case MNID_CONTINUE: diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index cc062a08a..e544e5f45 100644 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -603,8 +603,11 @@ Menu::update() int Menu::check() { - if (hit_item != -1) - return items[hit_item]->id; + if (hit_item != -1) { + int id = items[hit_item]->id; + hit_item = -1; //Clear event when checked out.. (we would end up in a loop when we try to leave "fake" submenu like Addons or Contrib) + return id; + } else return -1; } diff --git a/src/mainloop.cpp b/src/mainloop.cpp index 4b99735f9..e613666e7 100644 --- a/src/mainloop.cpp +++ b/src/mainloop.cpp @@ -167,6 +167,8 @@ MainLoop::update_gamelogic(float elapsed_time) Scripting::update_debugger(); Scripting::TimeScheduler::instance->update(game_time); current_screen->update(elapsed_time); + if (Menu::current() != NULL) + Menu::current()->update(); if(screen_fade.get() != NULL) screen_fade->update(elapsed_time); Console::instance->update(elapsed_time); diff --git a/src/title.cpp b/src/title.cpp index a187aeaad..2f0b7c07f 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -418,8 +418,6 @@ TitleScreen::update(float elapsed_time) Menu* menu = Menu::current(); if(menu) { - menu->update(); - if(menu == main_menu.get()) { switch (main_menu->check()) { case MNID_STARTGAME: diff --git a/src/worldmap/worldmap.cpp b/src/worldmap/worldmap.cpp index f01a0c196..94856d1a3 100644 --- a/src/worldmap/worldmap.cpp +++ b/src/worldmap/worldmap.cpp @@ -577,8 +577,6 @@ WorldMap::update(float delta) if(!in_level) { Menu* menu = Menu::current(); if(menu != NULL) { - menu->update(); - if(menu == worldmap_menu.get()) { switch (worldmap_menu->check()) {