]> git.mxchange.org Git - flightgear.git/commitdiff
#803: apply hotfix to revive "--carrier" option.
authorThorstenB <brehmt@gmail.com>
Sat, 14 Jul 2012 08:00:52 +0000 (10:00 +0200)
committerThorstenB <brehmt@gmail.com>
Sat, 14 Jul 2012 08:01:29 +0000 (10:01 +0200)
src/Main/fg_init.cxx

index 78915e7254b5f94af51e8d6e34e9ef37125ba96d..8328f5e1985fe0dc9a1fa1b793bcbfff2fd0b8f8 100644 (file)
@@ -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.
     ////////////////////////////////////////////////////////////////////