From: curt Date: Mon, 10 Nov 2003 22:00:22 +0000 (+0000) Subject: A couple fixes to the air/ground trim (initial position) setup code. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ea16fdbee79cb031c28e2b2c8dce02d3c7129882;p=flightgear.git A couple fixes to the air/ground trim (initial position) setup code. --- diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 6035a54ce..818015a46 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -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; }