]> git.mxchange.org Git - flightgear.git/commitdiff
Jim Wilson: This patch prevents FDM execution until intial scenery load completes...
authorehofman <ehofman>
Thu, 22 Jul 2004 16:42:14 +0000 (16:42 +0000)
committerehofman <ehofman>
Thu, 22 Jul 2004 16:42:14 +0000 (16:42 +0000)
midair starts in the KSFO area possible again.

src/Main/fg_init.cxx
src/Main/main.cxx
src/Scenery/tilemgr.cxx
src/Scenery/tilemgr.hxx

index a24b725c89725e5cfff11b8a574f5fba9092cce5..99a1496a6d6a571097fd0fa3f7b8ddd44dee6383 100644 (file)
@@ -1875,5 +1875,6 @@ void fgReInitSubsystems()
         fgSetBool("/sim/freeze/master", false);
     }
     fgSetBool("/sim/initialised", true);
+    fgSetBool("/sim/sceneryloaded",false);
 }
 
index c9fabb06181c0e01126b0f1d1bc25d5962609896..9588df0f483a10594cfd1ffe5e0871fb230fd53c 100644 (file)
@@ -84,6 +84,7 @@
 #include <Time/tmp.hxx>
 #include <Time/fg_timer.hxx>
 #include <Environment/environment_mgr.hxx>
+#include <GUI/new_gui.hxx>
 
 #ifdef FG_MPLAYER_AS
 #include <MultiPlayer/multiplaytxmgr.hxx>
@@ -1205,8 +1206,16 @@ static void fgMainLoop( void ) {
     }
 
     // flight model
-    if ( global_multi_loop > 0 ) {
-        fgUpdateTimeDepCalcs();
+    if ( global_multi_loop > 0) {
+        // first run the flight model each frame until it is intialized
+        // then continue running each frame only after initial scenery load is complete.
+        if (!cur_fdm_state->get_inited() or fgGetBool("sim/sceneryloaded")) {
+            fgUpdateTimeDepCalcs();
+        } else {
+            // only during scenery load
+            NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
+            gui->showDialog("scenery_loading");
+        }
     } else {
         SG_LOG( SG_ALL, SG_DEBUG, 
             "Elapsed time is zero ... we're zinging" );
@@ -1330,6 +1339,13 @@ static void fgMainLoop( void ) {
 
     // END Tile Manager udpates
 
+    if (!fgGetBool("sim/sceneryloaded") and globals->get_tile_mgr()->all_queues_empty() and cur_fdm_state->get_inited()) {
+        fgSetBool("sim/sceneryloaded",true);
+        // probably not efficient way to popup msg,  but is done only during scenery load
+        NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
+        gui->closeDialog("scenery_loading");
+    }
+
     if (fgGetBool("/sim/rendering/specular-highlight")) {
         glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
        // glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
@@ -1441,6 +1457,7 @@ static void fgIdleFunction ( void ) {
         // We've finished all our initialization steps, from now on we
         // run the main loop.
         fgSetBool("sim/initialised",true);
+        fgSetBool("sim/sceneryloaded",false);
 
         fgRegisterIdleHandler(fgMainLoop);
     } else {
index bd90454b849fe655428857bc7ddc91d019d8db2d..3cfe0471e52ed90a0155796ec91670be11b6f149 100644 (file)
@@ -261,6 +261,15 @@ void FGTileMgr::initialize_queue()
 #endif
 }
 
+/**
+ * return current status of queues
+ *
+ */
+
+bool FGTileMgr::all_queues_empty() {
+       return attach_queue.empty() && model_queue.empty();
+}
+
 
 /**
  * Update the various queues maintained by the tilemagr (private
index fb37a5c0fee38efb8350a13a171babffcd8d18d4..1d0426485de6a225618476d516240364cca63c49 100644 (file)
@@ -159,6 +159,9 @@ public:
     // internal function, do not call directly.)
     void update_queues();
 
+    // get state of all the scenery loading queues
+    bool all_queues_empty();
+
     // given the current lon/lat (in degrees), fill in the array of
     // local chunks.  If the chunk isn't already in the cache, then
     // read it from disk.