1
0
Fork 0

Fix --heading for --ndb position option.

Previously setting an offset for an NDB start position
resuled in any --heading setting being ignored.  This fixes it.
This commit is contained in:
Stuart Buchanan 2020-04-12 21:45:20 +01:00
parent bf85a2d542
commit 6ab7c08aa5

View file

@ -362,7 +362,7 @@ static void fgSetDistOrAltFromGlideSlope()
} }
// Set current_options lon/lat given an airport id and heading (degrees) // Set current_options lon/lat given a Nav ID or GUID
static bool fgSetPosFromNAV( const string& id, static bool fgSetPosFromNAV( const string& id,
const double& freq, const double& freq,
FGPositioned::Type type, FGPositioned::Type type,
@ -516,6 +516,7 @@ static InitPosResult setFinalPosFromCarrierFLOLS(const string& carrier, bool abe
auto res = checkCarrierSceneryLoaded(carrierRef); auto res = checkCarrierSceneryLoaded(carrierRef);
if (res != VicinityPosition) { if (res != VicinityPosition) {
SG_LOG(SG_GENERAL, SG_DEBUG, "carrier scenery not yet loaded");
return res; // either failure or keep waiting for scenery load return res; // either failure or keep waiting for scenery load
} }
@ -637,6 +638,7 @@ bool initPosition()
SGPropertyNode *hdg_preset = fgGetNode("/sim/presets/heading-deg", true); SGPropertyNode *hdg_preset = fgGetNode("/sim/presets/heading-deg", true);
double hdg = hdg_preset->getDoubleValue(); double hdg = hdg_preset->getDoubleValue();
double original_hdg = hdg_preset->getDoubleValue();
// save some start parameters, so that we can later say what the // save some start parameters, so that we can later say what the
// user really requested. TODO generalize that and move it to options.cxx // user really requested. TODO generalize that and move it to options.cxx
@ -708,8 +710,11 @@ bool initPosition()
} }
} }
if (hdg_preset->getDoubleValue() > 9990.0) if (original_hdg < 9990.0) {
hdg_preset->setDoubleValue(hdg); // The user-set heading may be overridden by the setPosFromAirportID above.
SG_LOG(SG_GENERAL, SG_ALERT, "Setting heading preset to : " << original_hdg);
hdg_preset->setDoubleValue(original_hdg);
}
if ( !set_pos && !vor.empty() ) { if ( !set_pos && !vor.empty() ) {
// a VOR is requested // a VOR is requested