Patchs by Matt McCutche to fix Treeboss related Bugs 469 and 504.
[supertux.git] / src / title.cpp
index dfa805e..724d1af 100644 (file)
@@ -44,6 +44,7 @@
 #include "video/drawing_context.hpp"
 #include "world.hpp"
 
+#include <algorithm>
 #include <physfs.h>
 
 enum MainMenuIDs {
@@ -421,6 +422,7 @@ TitleScreen::update(float elapsed_time)
           break;
 
         case MNID_CREDITS:
+          Menu::set_current(NULL);
           main_loop->push_screen(new TextScroller("credits.txt"),
                                  new FadeOut(0.5));
           break;
@@ -439,9 +441,9 @@ TitleScreen::update(float elapsed_time)
     }
   }
 
-  // reopen menu of user closed it (so that the app doesn't close when user
+  // reopen menu if user closed it (so that the app doesn't close when user
   // accidently hit ESC)
-  if(Menu::current() == 0) {
+  if(Menu::current() == 0 && main_loop->has_no_pending_fadeout()) {
     generate_main_menu();
     Menu::set_current(main_menu.get());
   }
@@ -450,6 +452,7 @@ TitleScreen::update(float elapsed_time)
 void
 TitleScreen::start_game()
 {
+  Menu::set_current(NULL);
   std::string basename = current_world->get_basedir();
   basename = basename.substr(0, basename.length()-1);
   std::string worlddirname = FileSystem::basename(basename);