]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_init.cxx
Sync with latest JSBSim CVS
[flightgear.git] / src / Main / fg_init.cxx
index 8ef3e2c589eece5d241b276554af62317b530eb0..4632eb3133ec3372f5a3686b7022c776bebc3b2a 100644 (file)
@@ -68,6 +68,7 @@
 #include <FDM/UIUCModel/uiuc_aircraftdir.h>
 #include <Airports/runways.hxx>
 #include <Airports/simple.hxx>
+#include <ATC/ATCdisplay.hxx>
 #include <Autopilot/auto_gui.hxx>
 #include <Autopilot/newauto.hxx>
 #include <Cockpit/cockpit.hxx>
@@ -80,6 +81,7 @@
 #include <FDM/JSBSim.hxx>
 #include <FDM/LaRCsim.hxx>
 #include <FDM/MagicCarpet.hxx>
+#include <FDM/NullFDM.hxx>
 #include <Include/general.hxx>
 #include <Input/input.hxx>
 // #include <Joystick/joystick.hxx>
@@ -487,6 +489,13 @@ bool fgInitGeneral( void ) {
 // gear, its initialization call should located in this routine.
 // Returns non-zero if a problem encountered.
 bool fgInitSubsystems( void ) {
+    static const SGPropertyNode *longitude
+       = fgGetNode("/position/longitude-deg");
+    static const SGPropertyNode *latitude
+       = fgGetNode("/position/latitude-deg");
+    static const SGPropertyNode *altitude
+       = fgGetNode("/position/altitude-ft");
+
     fgLIGHT *l = &cur_light_params;
 
     SG_LOG( SG_GENERAL, SG_INFO, "Initialize Subsystems");
@@ -549,6 +558,8 @@ bool fgInitSubsystems( void ) {
            cur_fdm_state = new FGMagicCarpet( dt );
        } else if (model == "external") {
            cur_fdm_state = new FGExternal( dt );
+       } else if (model == "null") {
+           cur_fdm_state = new FGNullFDM( dt );
        } else {
            SG_LOG(SG_GENERAL, SG_ALERT,
                   "Unrecognized flight model '" << model
@@ -600,12 +611,12 @@ bool fgInitSubsystems( void ) {
     FGViewerRPH *pilot_view =
        (FGViewerRPH *)globals->get_viewmgr()->get_view( 0 );
 
-    pilot_view->set_geod_view_pos( cur_fdm_state->get_Longitude(), 
-                                  cur_fdm_state->get_Lat_geocentric()
-                                  cur_fdm_state->get_Altitude() *
-                                  SG_FEET_TO_METER );
-    pilot_view->set_sea_level_radius( cur_fdm_state->get_Sea_level_radius() *
-                                     SG_FEET_TO_METER ); 
+    pilot_view->set_geod_view_pos( longitude->getDoubleValue()
+                                    * SGD_DEGREES_TO_RADIANS
+                                  latitude->getDoubleValue()
+                                    * SGD_DEGREES_TO_RADIANS,
+                                  altitude->getDoubleValue()
+                                    * SG_FEET_TO_METER );
     pilot_view->set_rph( cur_fdm_state->get_Phi(),
                         cur_fdm_state->get_Theta(),
                         cur_fdm_state->get_Psi() );
@@ -725,6 +736,25 @@ bool fgInitSubsystems( void ) {
     p_fix.append( "Navaids/default.fix" );
     current_fixlist->init( p_fix );
 
+    ////////////////////////////////////////////////////////////////////
+    // Initialize ATC list management and query systems
+    ////////////////////////////////////////////////////////////////////
+
+    //DCL
+    SG_LOG(SG_GENERAL, SG_INFO, "  ATIS");
+    current_atislist = new FGATISList;
+    SGPath p_atis( globals->get_fg_root() );
+    p_atis.append( "ATC/default.atis" );
+    current_atislist->init( p_atis );
+
+    ////////////////////////////////////////////////////////////////////
+    // Initialise ATC display system
+    ////////////////////////////////////////////////////////////////////
+
+    //DCL
+    SG_LOG(SG_GENERAL, SG_INFO, "  ATC Display");
+    current_atcdisplay = new FGATCDisplay;
+    current_atcdisplay->init();   
 
     ////////////////////////////////////////////////////////////////////
     // Initialize the built-in commands.
@@ -902,6 +932,8 @@ void fgReInitSubsystems( void )
            cur_fdm_state = new FGMagicCarpet( dt );
        } else if (model == "external") {
            cur_fdm_state = new FGExternal( dt );
+       } else if (model == "null") {
+           cur_fdm_state = new FGNullFDM( dt );
        } else {
            SG_LOG(SG_GENERAL, SG_ALERT,
                   "Unrecognized flight model '" << model