]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/tilemgr.cxx
Make various PUI widgets private.
[flightgear.git] / src / Scenery / tilemgr.cxx
index 51f24044bc831a27044a3a03fdebe1739db00728..22efc3da3cfdb7e1468fd55bc8f084c923b01a1d 100644 (file)
@@ -41,7 +41,6 @@
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
 #include <Viewer/renderer.hxx>
-#include <Viewer/viewer.hxx>
 #include <Viewer/splash.hxx>
 #include <Scripting/NasalSys.hxx>
 
@@ -105,6 +104,10 @@ void FGTileMgr::refresh_tile(void* tileMgr, long tileIndex)
 
 void FGTileMgr::reinit()
 {
+    _terra_sync = static_cast<simgear::SGTerraSync*> (globals->get_subsystem("terrasync"));
+    if (_terra_sync)
+        _terra_sync->setTileRefreshCb(&refresh_tile, this);
+
     // protect against multiple scenery reloads and properly reset flags,
     // otherwise aircraft fall through the ground while reloading scenery
     if (!fgGetBool("/sim/sceneryloaded",true))
@@ -133,10 +136,6 @@ void FGTileMgr::reinit()
     longitude = latitude = -1000.0;
     scheduled_visibility = 100.0;
 
-    _terra_sync = (simgear::SGTerraSync*) globals->get_subsystem("terrasync");
-    if (_terra_sync)
-        _terra_sync->setTileRefreshCb(&refresh_tile, this);
-
     // force an update now
     update(0.0);
 }
@@ -314,23 +313,28 @@ void FGTileMgr::update_queues()
 // disk.
 void FGTileMgr::update(double)
 {
-    SGVec3d viewPos = globals->get_current_view()->get_view_pos();
     double vis = _visibilityMeters->getDoubleValue();
-    schedule_tiles_at(SGGeod::fromCart(viewPos), vis);
+    schedule_tiles_at(globals->get_view_position(), vis);
 
     update_queues();
 
     // scenery loading check, triggers after each sim (tile manager) reinit
     if (!_scenery_loaded->getBoolValue())
     {
-        if (_scenery_override->getBoolValue() || isSceneryLoaded())
+        bool fdmInited = fgGetBool("sim/fdm-initialized");
+        bool positionFinalized = fgGetBool("sim/position-finalized");
+        bool sceneryOverride = _scenery_override->getBoolValue();
+        
+    // we are done if final position is set and the scenery & FDM are done.
+    // scenery-override can ignore the last two, but not position finalization.
+        if (positionFinalized && (sceneryOverride || (isSceneryLoaded() && fdmInited)))
         {
             _scenery_loaded->setBoolValue(true);
             fgSplashProgress("");
         }
         else
         {
-            fgSplashProgress("loading-scenery");
+            fgSplashProgress(positionFinalized ? "loading-scenery" : "finalize-position");
             // be nice to loader threads while waiting for initial scenery, reduce to 20fps
             SGTimeStamp::sleepForMSec(50);
         }