Fixed levels on contribs menu.
[supertux.git] / src / gameloop.cpp
index aa5e1c7..a6c3a5f 100644 (file)
@@ -129,6 +129,11 @@ GameSession::restart_level()
   if(flip_level)
     level->do_vertical_flip();
 
+  global_stats.reset();
+  global_stats.set_total_points(COINS_COLLECTED_STAT, level->get_total_coins());
+  global_stats.set_total_points(BADGUYS_KILLED_STAT, level->get_total_badguys());
+  global_stats.set_total_points(TIME_NEEDED_STAT, level->time_left);
+
   currentsector = level->get_sector("main");
   if(!currentsector)
     Termination::abort("Level has no main sector.", "");
@@ -152,8 +157,6 @@ GameSession::restart_level()
         levelintro();
     }
 
-  global_stats.reset();
-
   time_left.init(true);
   start_timers();
   currentsector->play_music(LEVEL_MUSIC);
@@ -436,7 +439,8 @@ GameSession::process_events()
                           last_keys.clear();
                           }
                         if(compare_last(last_keys, "kill"))
-                          {    // kill Tux
+                          {    // kill Tux, but without losing a life
+                          player_status.lives++;
                           tux.kill(tux.KILL);
                           last_keys.clear();
                           }