]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_init.cxx
apt.dat parser: clearer log and exception messages
[flightgear.git] / src / Main / fg_init.cxx
index 3febb590ce2d98f00e3ba0695b15ccb8dc6b8479..118dd1c12a0f5a448e92f3e5f6e269e081c1f03c 100644 (file)
@@ -68,6 +68,7 @@
 #include <simgear/scene/material/Effect.hxx>
 #include <simgear/scene/model/particles.hxx>
 #include <simgear/scene/tsync/terrasync.hxx>
+#include <simgear/scene/tgdb/userdata.hxx>
 
 #include <simgear/package/Root.hxx>
 #include <simgear/package/Package.hxx>
@@ -658,6 +659,9 @@ bool fgInitGeneral() {
 
     fgSetBool("/sim/startup/stdout-to-terminal", isatty(1) != 0 );
     fgSetBool("/sim/startup/stderr-to-terminal", isatty(2) != 0 );
+
+    sgUserDataInit( globals->get_props() );
+
     return true;
 }
 
@@ -738,8 +742,8 @@ void fgCreateSubsystems(bool duringReset) {
     }
 
     // may exist already due to GUI startup
-    if (!globals->get_subsystem("http")) {
-        globals->add_subsystem( "http", new FGHTTPClient );
+    if (!globals->get_subsystem<FGHTTPClient>()) {
+        globals->add_new_subsystem<FGHTTPClient>();
     }
 
     ////////////////////////////////////////////////////////////////////
@@ -1054,7 +1058,9 @@ void fgStartNewReset()
     render->getViewer()->getDatabasePager()->clear();
     
     osgDB::Registry::instance()->clearObjectCache();
-    
+    // Pager requests depend on this, so don't clear it until now
+    sgUserDataInit( NULL );
+
     // preserve the event handler; re-creating it would entail fixing the
     // idle handler
     osg::ref_ptr<flightgear::FGEventHandler> eventHandler = render->getEventHandler();
@@ -1095,6 +1101,8 @@ void fgStartNewReset()
     render->init();
     render->setViewer(viewer.get());
 
+    sgUserDataInit( globals->get_props() );
+
     viewer->getDatabasePager()->setUpThreads(1, 1);
     
     // must do this before splashinit for Rembrandt
@@ -1126,10 +1134,17 @@ void fgInitPackageRoot()
     if (globals->packageRoot()) {
         return;
     }
-    
-    SGPath packageAircraftDir = flightgear::defaultDownloadDir();
+
+    SGPath packageAircraftDir = flightgear::Options::sharedInstance()->valueForOption("download-dir");
+    if (packageAircraftDir.isNull()) {
+        packageAircraftDir = flightgear::defaultDownloadDir();
+    }
+
     packageAircraftDir.append("Aircraft");
 
+    SG_LOG(SG_GENERAL, SG_INFO, "init package root at:" << packageAircraftDir.str());
+
+
     SGSharedPtr<Root> pkgRoot(new Root(packageAircraftDir, FLIGHTGEAR_VERSION));
     // set the http client later (too early in startup right now)
     globals->setPackageRoot(pkgRoot);