Reset play_time when level is restarted
authorChristoph Sommer <mail@christoph-sommer.de>
Thu, 3 Jan 2008 16:41:36 +0000 (16:41 +0000)
committerChristoph Sommer <mail@christoph-sommer.de>
Thu, 3 Jan 2008 16:41:36 +0000 (16:41 +0000)
SVN-Revision: 5245

src/game_session.cpp

index ee036eb..a0e48c3 100644 (file)
@@ -135,7 +135,6 @@ GameSession::restart_level()
   level->stats.total_badguys = level->get_total_badguys();
   level->stats.total_secrets = level->get_total_count<SecretAreaTrigger>();
   level->stats.reset();
-  if(reset_sector != "")level->stats.declare_invalid();
 
   if(reset_sector != "") {
     currentsector = level->get_sector(reset_sector);
@@ -144,11 +143,13 @@ GameSession::restart_level()
       msg << "Couldn't find sector '" << reset_sector << "' for resetting tux.";
       throw std::runtime_error(msg.str());
     }
+    level->stats.declare_invalid();
     currentsector->activate(reset_pos);
   } else {
     currentsector = level->get_sector("main");
     if(!currentsector)
       throw std::runtime_error("Couldn't find main sector");
+    play_time = 0;
     currentsector->activate("main");
   }