]> git.mxchange.org Git - flightgear.git/commitdiff
Suppress framerate while splash screen active
authorThorstenB <brehmt@gmail.com>
Sun, 21 Nov 2010 12:58:10 +0000 (13:58 +0100)
committerThorstenB <brehmt@gmail.com>
Sun, 21 Nov 2010 12:58:10 +0000 (13:58 +0100)
Don't irritate the fps-geeks while the sim isn't ready yet.
And a minor pointer safety issue.

src/Time/TimeManager.cxx

index a511797b0f9240977637ed493220a479dea94700..f28deeaf9680fccdcfffda986aae40c23fa5720e 100644 (file)
@@ -84,7 +84,7 @@ void TimeManager::init()
     
 // frame/update-rate counters
   _frameRate = fgGetNode("/sim/frame-rate", true);
-  _lastFrameTime = _impl->get_cur_time();
+  _lastFrameTime = 0;
   _frameCount = 0;
 }
 
@@ -97,6 +97,7 @@ void TimeManager::reinit()
 {
   globals->set_time_params(NULL);
   delete _impl;
+  _impl = NULL;
   _inited = false;
   globals->get_event_mgr()->removeTask("updateLocalTime");
   
@@ -119,6 +120,12 @@ void TimeManager::computeTimeDeltas(double& simDt, double& realDt)
   if (!wait_for_scenery) {
     throttleUpdateRate();
   }
+  else
+  {
+      // suppress framerate while initial scenery isn't loaded yet (splash screen still active) 
+      _lastFrameTime=0;
+      _frameCount = 0;
+  }
   
   SGTimeStamp currentStamp;
   currentStamp.stamp();
@@ -205,7 +212,7 @@ void TimeManager::update(double dt)
 void TimeManager::computeFrameRate()
 {
   // Calculate frame rate average
-  if ((_impl->get_cur_time() != _lastFrameTime) && (_lastFrameTime > 0)) {
+  if ((_impl->get_cur_time() != _lastFrameTime)) {
     _frameRate->setIntValue(_frameCount);
     _frameCount = 0;
   }