statistics_backdrop.reset(new Surface("images/engine/menu/score-backdrop.png"));
- restart_level(true);
+ restart_level();
game_menu.reset(new Menu());
game_menu->add_label(_("Pause"));
}
void
-GameSession::restart_level(bool fromBeginning)
+GameSession::restart_level()
{
game_pause = false;
end_sequence = 0;
level->stats.total_badguys = level->get_total_badguys();
level->stats.total_secrets = level->get_total_count<SecretAreaTrigger>();
level->stats.reset();
- if (!fromBeginning && (reset_sector != "")) level->stats.declare_invalid();
+ if(reset_sector != "")level->stats.declare_invalid();
- if (fromBeginning) reset_sector="";
if(reset_sector != "") {
currentsector = level->get_sector(reset_sector);
if(!currentsector) {
}
currentsector->activate(reset_pos);
} else {
- player_status->coins += 25;
currentsector = level->get_sector("main");
if(!currentsector)
throw std::runtime_error("Couldn't find main sector");
/* End of level? */
if(end_sequence && end_sequence->is_done()) {
finish(true);
- return;
} else if (!end_sequence && tux->is_dead()) {
- if (player_status->coins < 0) {
- // No more coins: restart level from beginning
- restart_level(true);
- } else {
- // Still has coins: restart level from last reset point
- restart_level(false);
- }
-
- return;
+ restart_level();
}
}