]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_init.cxx
Moved random ground cover object management code (userdata.[ch]xx) over
[flightgear.git] / src / Main / fg_init.cxx
index f71573cffada0c0a89773ecebfaf5e597ee08380..fb20adbb85ab96f50b6b5acd206a6a5435203507 100644 (file)
@@ -89,7 +89,7 @@
 #include <FDM/ExternalNet/ExternalNet.hxx>
 #include <FDM/ExternalPipe/ExternalPipe.hxx>
 #include <FDM/JSBSim/JSBSim.hxx>
-#include <FDM/LaRCsim.hxx>
+#include <FDM/LaRCsim/LaRCsim.hxx>
 #include <FDM/MagicCarpet.hxx>
 #include <FDM/UFO.hxx>
 #include <FDM/NullFDM.hxx>
@@ -980,19 +980,22 @@ fgInitNav ()
 bool fgInitPosition() {
     bool set_pos = false;
 
-    // Do a first guess if we should be on the ground or in the air
-    // (to be refined later based on other input.
+    // If glideslope is specified, then calculate offset-distance or
+    // altitude relative to glide slope if either of those was not
+    // specified.
+    if ( fgGetDouble("/sim/presets/glideslope-deg") > 0.1 ) {
+        fgSetDistOrAltFromGlideSlope();
+    }
+
+    // Select ground or air start depending on if an altitude is
+    // specified (this choice can be refined later based on other
+    // input.)
     if ( fgGetDouble("/sim/presets/altitude-ft") > -9990.0 ) {
         fgSetBool("/sim/presets/onground", false);
     } else {
         fgSetBool("/sim/presets/onground", true);
     }
 
-    // If glideslope is specified, then calculate offset-distance or
-    // altitude relative to glide slope if either of those was not
-    // specified.
-    fgSetDistOrAltFromGlideSlope();
-
     // If we have an explicit, in-range lon/lat, don't change it, just use it.
     // If not, check for an airport-id and use that.
     // If not, default to the middle of the KSFO field.
@@ -1045,33 +1048,18 @@ bool fgInitPosition() {
     if ( !set_pos && !vor.empty() ) {
         // a VOR is requested
         if ( fgSetPosFromNAV( vor, vor_freq ) ) {
-            if ( fgGetDouble("/sim/presets/altitude-ft") > -9990.0 ) {
-                fgSetBool("/sim/presets/onground", false);
-            } else {
-                fgSetBool("/sim/presets/onground", true);
-            }
             set_pos = true;
         }
     }
     if ( !set_pos && !ndb.empty() ) {
         // an NDB is requested
         if ( fgSetPosFromNAV( ndb, ndb_freq ) ) {
-            if ( fgGetDouble("/sim/presets/altitude-ft") > -9990.0 ) {
-                fgSetBool("/sim/presets/onground", false);
-            } else {
-                fgSetBool("/sim/presets/onground", true);
-            }
             set_pos = true;
         }
     }
     if ( !set_pos && !fix.empty() ) {
         // a Fix is requested
         if ( fgSetPosFromFix( fix ) ) {
-            if ( fgGetDouble("/sim/presets/altitude-ft") > -9990.0 ) {
-                fgSetBool("/sim/presets/onground", false);
-            } else {
-                fgSetBool("/sim/presets/onground", true);
-            }
             set_pos = true;
         }
     }
@@ -1326,7 +1314,7 @@ bool fgInitSubsystems() {
 
     SGPath mpath( globals->get_fg_root() );
     mpath.append( "materials.xml" );
-    if ( ! material_lib.load( globals->get_fg_root(), mpath.str() ) ) {
+    if ( ! globals->get_matlib()->load(globals->get_fg_root(), mpath.str()) ) {
         SG_LOG( SG_GENERAL, SG_ALERT, "Error loading material lib!" );
         exit(-1);
     }