]> git.mxchange.org Git - flightgear.git/commitdiff
A couple fixes to the air/ground trim (initial position) setup code.
authorcurt <curt>
Mon, 10 Nov 2003 22:00:22 +0000 (22:00 +0000)
committercurt <curt>
Mon, 10 Nov 2003 22:00:22 +0000 (22:00 +0000)
src/Main/fg_init.cxx

index 6035a54ce930259daba9925fe16e9670c29afd1a..818015a46ca6d5a3db71bdb28e0979763feddddf 100644 (file)
@@ -856,6 +856,7 @@ static bool fgSetPosFromAirportIDandRwy( const string& id, const string& rwy ) {
 
 
 static void fgSetDistOrAltFromGlideSlope() {
+  cout << "fgSetDistOrAltFromGlideSlope()" << endl;
     string apt_id = fgGetString("/sim/presets/airport-id");
     double gs = fgGetDouble("/sim/presets/glideslope-deg")
         * SG_DEGREES_TO_RADIANS ;
@@ -1043,12 +1044,18 @@ fgInitNav ()
 
 // Set the initial position based on presets (or defaults)
 bool fgInitPosition() {
+  cout << "fgInitPosition()" << endl;
+    double gs = fgGetDouble("/sim/presets/glideslope-deg")
+        * SG_DEGREES_TO_RADIANS ;
+    double od = fgGetDouble("/sim/presets/offset-distance");
+    double alt = fgGetDouble("/sim/presets/altitude-ft");
+
     bool set_pos = false;
 
     // 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 ) {
+    if ( fabs( gs ) > 0.01 ) {
         fgSetDistOrAltFromGlideSlope();
     }
 
@@ -1131,6 +1138,13 @@ bool fgInitPosition() {
     fgSetDouble( "/orientation/heading-deg",
                  fgGetDouble("/sim/presets/heading-deg") );
 
+    // determine if this should be an on-ground or in-air start
+    if ( fabs(gs) > 0.01 || fabs(od) > 0.1 || alt > 0.1 ) {
+        fgSetBool("/sim/presets/onground", false);
+    } else {
+        fgSetBool("/sim/presets/onground", true);
+    }                              
+
     return true;
 }