Further filename untangling in World class
[supertux.git] / src / supertux / game_session.cpp
index 11f1f36..50e235d 100644 (file)
 
 GameSession::GameSession(const std::string& levelfile_, PlayerStatus* player_status, Statistics* statistics) :
   level(),
-  statistics_backdrop(),
+  statistics_backdrop(Surface::create("images/engine/menu/score-backdrop.png")),
   scripts(),
-  currentsector(0),
+  currentsector(nullptr),
   levelnb(),
   pause_menu_frame(),
   end_sequence(0),
-  game_pause(),
-  speed_before_pause(),
+  game_pause(false),
+  speed_before_pause(g_screen_manager->get_speed()),
   levelfile(levelfile_), 
   reset_sector(),
   reset_pos(),
@@ -67,15 +67,12 @@ GameSession::GameSession(const std::string& levelfile_, PlayerStatus* player_sta
   demo_controller(0),
   play_time(0), 
   edit_mode(false), 
-  levelintro_shown(false)
+  levelintro_shown(false),
+  coins_at_start(),
+  bonus_at_start(),
+  max_fire_bullets_at_start(),
+  max_ice_bullets_at_start()
 {
-  currentsector = NULL;
-
-  game_pause = false;
-  speed_before_pause = g_screen_manager->get_speed();
-
-  statistics_backdrop = Surface::create("images/engine/menu/score-backdrop.png");
-
   if (restart_level() != 0)
     throw std::runtime_error ("Initializing the level failed.");
 }
@@ -244,7 +241,7 @@ GameSession::toggle_pause()
   if(!game_pause) {
     speed_before_pause = g_screen_manager->get_speed();
     g_screen_manager->set_speed(0);
-    MenuManager::instance().set_current(MenuStorage::GAME_MENU);
+    MenuManager::instance().set_menu(MenuStorage::GAME_MENU);
     game_pause = true;
   }
 
@@ -254,7 +251,7 @@ GameSession::toggle_pause()
 void
 GameSession::abort_level()
 {
-  MenuManager::instance().set_current(MenuStorage::NO_MENU);
+  MenuManager::instance().clear_menu_stack();
   g_screen_manager->exit_screen();
   currentsector->player->set_bonus(bonus_at_start);
   PlayerStatus *currentStatus = get_player_status();
@@ -322,16 +319,6 @@ GameSession::run_script(std::istream& in, const std::string& sourcename)
 void
 GameSession::process_events()
 {
-  // end of pause mode?
-  // XXX this looks like a fail-safe to unpause the game if there's no menu
-  // XXX having it enabled causes some unexpected problems
-  // XXX hopefully disabling it won't...
-  /*
-    if(!Menu::current() && game_pause) {
-    game_pause = false;
-    }
-  */
-
   // playback a demo?
   if(playback_demo_stream != 0) {
     demo_controller->update();