[Orxonox-commit 1443] r6161 - code/branches/presentation2/src/libraries/core

rgrieder at orxonox.net rgrieder at orxonox.net
Thu Nov 26 14:15:28 CET 2009


Author: rgrieder
Date: 2009-11-26 14:15:28 +0100 (Thu, 26 Nov 2009)
New Revision: 6161

Modified:
   code/branches/presentation2/src/libraries/core/Game.cc
Log:
Fixed uninitialised value problem with the statistics (at least for the first few calls to getAvgFPS() before Game::run()).

Modified: code/branches/presentation2/src/libraries/core/Game.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/Game.cc	2009-11-26 13:11:48 UTC (rev 6160)
+++ code/branches/presentation2/src/libraries/core/Game.cc	2009-11-26 13:15:28 UTC (rev 6161)
@@ -91,6 +91,15 @@
         minimumSleepTime_ = 0/*us*/;
 #endif
 
+        // reset statistics
+        this->statisticsStartTime_ = 0;
+        this->statisticsTickTimes_.clear();
+        this->periodTickTime_ = 0;
+        this->periodTime_ = 0;
+        this->avgFPS_ = 0.0f;
+        this->avgTickTime_ = 0.0f;
+        this->excessSleepTime_ = 0;
+
         // Create an empty root state
         this->declareGameState<GameState>("GameState", "emptyRootGameState", true, false);
 
@@ -152,15 +161,6 @@
         if (this->requestedStateNodes_.empty())
             COUT(0) << "Warning: Starting game without requesting GameState. This automatically terminates the program." << std::endl;
 
-        // reset statistics
-        this->statisticsStartTime_ = 0;
-        this->statisticsTickTimes_.clear();
-        this->periodTickTime_ = 0;
-        this->periodTime_ = 0;
-        this->avgFPS_ = 0.0f;
-        this->avgTickTime_ = 0.0f;
-        this->excessSleepTime_ = 0;
-
         // START GAME
         // first delta time should be about 0 seconds
         this->gameClock_->capture();




More information about the Orxonox-commit mailing list