]> 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 847fcf9d5f896745deba526bcc6fcbee98064610..fb20adbb85ab96f50b6b5acd206a6a5435203507 100644 (file)
@@ -63,6 +63,7 @@
 #include <simgear/math/polar3d.hxx>
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/misc/sg_path.hxx>
+#include <simgear/scene/material/matlib.hxx>
 #ifdef FG_USE_CLOUDS_3D
 #  include <simgear/sky/clouds3d/SkySceneLoader.hpp>
 #  include <simgear/sky/clouds3d/SkyUtil.hpp>
@@ -88,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>
@@ -97,8 +98,6 @@
 #include <Include/general.hxx>
 #include <Input/input.hxx>
 #include <Instrumentation/instrument_mgr.hxx>
-// #include <Joystick/joystick.hxx>
-#include <Objects/matlib.hxx>
 #include <Model/acmodel.hxx>
 #include <Navaids/fixlist.hxx>
 #include <Navaids/ilslist.hxx>
@@ -981,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.
@@ -1046,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;
         }
     }
@@ -1327,7 +1314,7 @@ bool fgInitSubsystems() {
 
     SGPath mpath( globals->get_fg_root() );
     mpath.append( "materials.xml" );
-    if ( ! material_lib.load( 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);
     }