]> git.mxchange.org Git - flightgear.git/commitdiff
Minor main loop/init clean-up
authorThorstenB <brehmt@gmail.com>
Mon, 17 Sep 2012 11:41:42 +0000 (13:41 +0200)
committerThorstenB <brehmt@gmail.com>
Mon, 17 Sep 2012 11:45:31 +0000 (13:45 +0200)
src/Main/main.cxx
src/Main/main.hxx

index a16f77f1cd38b77a6f23602df31ef04f1493e286..8d65c1b690b03cee1e0ee31963ddb67d67f58d52 100644 (file)
@@ -75,11 +75,6 @@ using namespace flightgear;
 using std::cerr;
 using std::vector;
 
-// Specify our current idle function state.  This is used to run all
-// our initializations out of the idle callback so that we can get a
-// splash screen up and running right away.
-int idle_state = 0;
-
 // The atexit() function handler should know when the graphical subsystem
 // is initialized.
 extern int _bootstrap_OSInit;
@@ -124,7 +119,7 @@ static void fgMainLoop( void )
     // compute simulated time (allowing for pause, warp, etc) and
     // real elapsed time
     double sim_dt, real_dt;
-    TimeManager* timeMgr = (TimeManager*) globals->get_subsystem("time");
+    static TimeManager* timeMgr = (TimeManager*) globals->get_subsystem("time");
     timeMgr->computeTimeDeltas(sim_dt, real_dt);
 
     // update magvar model
@@ -184,6 +179,11 @@ struct GeneralInitOperation : public GraphicsContextOperation
 // then on.
 
 static void fgIdleFunction ( void ) {
+    // Specify our current idle function state.  This is used to run all
+    // our initializations out of the idle callback so that we can get a
+    // splash screen up and running right away.
+    static int idle_state = 0;
+
     static osg::ref_ptr<GeneralInitOperation> genOp;
     if ( idle_state == 0 ) {
         idle_state++;
@@ -224,7 +224,7 @@ static void fgIdleFunction ( void ) {
         fgSplashProgress("initializing scenery system");
 
     } else if ( idle_state == 4 ) {
-        idle_state++;
+        idle_state+=2;
         // based on the requested presets, calculate the true starting
         // lon, lat
         fgInitPosition();
@@ -265,11 +265,6 @@ static void fgIdleFunction ( void ) {
 
         fgSplashProgress("loading aircraft");
 
-    } else if ( idle_state == 5 ) {
-        idle_state++;
-
-        fgSplashProgress("initializing sky elements");
-
     } else if ( idle_state == 6 ) {
         idle_state++;
         
@@ -277,10 +272,8 @@ static void fgIdleFunction ( void ) {
         SGMagVar *magvar = new SGMagVar();
         globals->set_mag( magvar );
         
-        
         // kludge to initialize mag compass
-        // (should only be done for in-flight
-        // startup)
+        // (should only be done for in-flight startup)
         // update magvar model
         globals->get_mag()->update( fgGetDouble("/position/longitude-deg")
                                    * SGD_DEGREES_TO_RADIANS,
index 8ddea1a9ebf59c157a6c2b735a67ae1e01d5c9b2..145feacf1da0f3f8d1adde10998faf4b9fb09e10 100644 (file)
@@ -1,14 +1,28 @@
+// main.hxx -- top level sim routines
+//
+// Written by Curtis Olson, started May 1997.
+//
+// Copyright (C) 1997 - 2002  Curtis L. Olson  - http://www.flightgear.org/~curt
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 #ifndef __FG_MAIN_HXX
 #define __FG_MAIN_HXX 1
 
-void fgUpdateTimeDepCalcs();
-
 int fgMainInit( int argc, char **argv );
 
-
-extern int idle_state;
-
 extern std::string homedir;
 extern std::string hostname;