statistics_backdrop = Surface::create("images/engine/menu/score-backdrop.png");
- restart_level();
+ if (restart_level() != 0)
+ throw std::runtime_error ("Initializing the level failed.");
game_menu.reset(new GameMenu(*level));
}
-void
+int
GameSession::restart_level()
{
if (edit_mode) {
force_ghost_mode();
- return;
+ return (-1);
}
game_pause = false;
} catch(std::exception& e) {
log_fatal << "Couldn't start level: " << e.what() << std::endl;
g_screen_manager->exit_screen();
+ return (-1);
}
sound_manager->stop_music();
log_info << "Next run uses random seed " << g_config->random_seed <<std::endl;
record_demo(capture_file);
}
+
+ return (0);
}
GameSession::~GameSession()
void
GameSession::setup()
{
+ if (currentsector == NULL)
+ return;
+
if(currentsector != Sector::current()) {
currentsector->activate(currentsector->player->get_pos());
}