diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 78915e725..8328f5e19 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -1269,6 +1269,29 @@ bool fgInitSubsystems() { // initialize methods that depend on other subsystems. globals->get_subsystem_mgr()->postinit(); + //////////////////////////////////////////////////////////////////// + // TODO FIXME! UGLY KLUDGE! + //////////////////////////////////////////////////////////////////// + { + /* Scenarios require Nasal, so FGAIManager loads the scenarios, + * including its models such as a/c carriers, in its 'postinit', + * which is the very last thing we do. + * fgInitPosition is called very early in main.cxx/fgIdleFunction, + * one of the first things we do, long before scenarios/carriers are + * loaded. => When requested "initial preset position" relates to a + * carrier, recalculate the 'initial' position here (how have things + * ever worked before this hack - this init sequence has always been + * this way...?)*/ + std::string carrier = fgGetString("/sim/presets/carrier",""); + if (carrier != "") + { + // clear preset location and re-trigger position setup + fgSetDouble("/sim/presets/longitude-deg", 9999); + fgSetDouble("/sim/presets/latitude-deg", 9999); + fgInitPosition(); + } + } + //////////////////////////////////////////////////////////////////////// // End of subsystem initialization. ////////////////////////////////////////////////////////////////////