]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_init.cxx
Add the AIModel based air traffic subsystem from Durk Talsma.
[flightgear.git] / src / Main / fg_init.cxx
index 4e6988afffb10b89cb0281bb5904531abd2e797c..15681791f561346fbe550acaaf0724a00d56f076 100644 (file)
 #include <Time/sunpos.hxx>
 #include <Time/sunsolver.hxx>
 #include <Time/tmp.hxx>
+#include <Traffic/TrafficMgr.hxx>
 
 #ifdef FG_MPLAYER_AS
 #include <MultiPlayer/multiplaytxmgr.hxx>
@@ -1062,6 +1063,17 @@ fgInitNav ()
                 "Problems loading one or more navigational database" );
     }
 
+    if ( fgGetBool("/sim/navdb/localizers/auto-align", true) ) {
+        // align all the localizers with their corresponding runways
+        // since data sources are good for cockpit navigation
+        // purposes, but not always to the error tolerances needed to
+        // exactly place these items.
+        double threshold
+            = fgGetDouble( "/sim/navdb/localizers/auto-align-threshold-deg",
+                           5.0 );
+        fgNavDBAlignLOCwithRunway( runways, loclist, threshold );
+    }
+
     SG_LOG(SG_GENERAL, SG_INFO, "  Fixes");
     SGPath p_fix( globals->get_fg_root() );
     p_fix.append( "Navaids/fix.dat" );
@@ -1673,14 +1685,26 @@ bool fgInitSubsystems() {
     ////////////////////////////////////////////////////////////////////
     // Initialise the AI Model Manager
     ////////////////////////////////////////////////////////////////////
-
     SG_LOG(SG_GENERAL, SG_INFO, "  AI Model Manager");
     globals->add_subsystem("ai_model", new FGAIManager);
 
 
+     // It's probably a good idea to initialize the top level traffic manager
+     // After the AI and ATC systems have been initialized properly.
+     // AI Traffic manager
+     globals->add_subsystem("Traffic Manager", new FGTrafficManager);
+            FGTrafficManager *dispatcher = 
+            (FGTrafficManager*) globals->get_subsystem("Traffic Manager");
+
+     readXML(string(globals->get_fg_root() + string("/Traffic/fgtraffic.xml")),
+            *dispatcher);
+     globals->get_subsystem("Traffic Manager")->init();
+
     globals->add_subsystem("instrumentation", new FGInstrumentMgr);
     globals->add_subsystem("systems", new FGSystemMgr);
 
+
+
     ////////////////////////////////////////////////////////////////////
     // Initialize the radio stack subsystem.
     ////////////////////////////////////////////////////////////////////