]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_init.cxx
- /sim/model/h-rotation renamed to /sim/model/heading-offset-deg
[flightgear.git] / src / Main / fg_init.cxx
index 7866a35f358bddd1602e29c02b509716d299d3a2..1550b111b97138d8cdc32fff45baf3af416bfac1 100644 (file)
 #  include <math.h>
 #endif
 
+#ifdef HAVE_WINDOWS_H
+#  include <windows.h>
+#endif
+
 #include <GL/glut.h>
-#include <simgear/xgl/xgl.h>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -77,7 +80,8 @@
 #include <FDM/LaRCsim.hxx>
 #include <FDM/MagicCarpet.hxx>
 #include <Include/general.hxx>
-#include <Joystick/joystick.hxx>
+#include <Input/input.hxx>
+// #include <Joystick/joystick.hxx>
 #include <Objects/matlib.hxx>
 #include <Navaids/fixlist.hxx>
 #include <Navaids/ilslist.hxx>
 
 #include "fg_init.hxx"
 #include "fg_io.hxx"
+#include "fg_commands.hxx"
+#include "fg_props.hxx"
 #include "options.hxx"
 #include "globals.hxx"
-#include "bfi.hxx"
 
 #if defined(FX) && defined(XMESA)
 #include <GL/xmesa.h>
@@ -158,7 +163,9 @@ bool fgInitFGRoot ( int argc, char **argv ) {
     // Otherwise, default to a random compiled-in location if we can't
     // find fg-root any other way.
     if ( root == "" ) {
-#if defined( WIN32 )
+#if defined( __CYGWIN__ )
+        root = "/FlightGear";
+#elif defined( WIN32 )
        root = "\\FlightGear";
 #elif defined( macintosh )
        root = "";
@@ -269,8 +276,8 @@ bool fgSetPosFromAirportID( const string& id ) {
            "Attempting to set starting position from airport code " << id );
 
     if ( fgFindAirportID( id, &a ) ) {
-       fgSetDouble("/position/longitude",  a.longitude );
-       fgSetDouble("/position/latitude",  a.latitude );
+       fgSetDouble("/position/longitude-deg",  a.longitude );
+       fgSetDouble("/position/latitude-deg",  a.latitude );
        SG_LOG( SG_GENERAL, SG_INFO,
                "Position for " << id << " is ("
                << a.longitude << ", "
@@ -390,9 +397,9 @@ bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg ) {
        lat2=olat;
        lon2=olon;
     }
-    fgSetDouble("/position/longitude",  lon2 );
-    fgSetDouble("/position/latitude",  lat2 );
-    fgSetDouble("/orientation/heading", heading );
+    fgSetDouble("/position/longitude-deg",  lon2 );
+    fgSetDouble("/position/latitude-deg",  lat2 );
+    fgSetDouble("/orientation/heading-deg", heading );
 
     SG_LOG( SG_GENERAL, SG_INFO,
            "Position for " << id << " is ("
@@ -481,8 +488,8 @@ bool fgInitSubsystems( void ) {
 
     if ( global_tile_mgr.init() ) {
        // Load the local scenery data
-       global_tile_mgr.update( fgGetDouble("/position/longitude"),
-                               fgGetDouble("/position/latitude") );
+       global_tile_mgr.update( fgGetDouble("/position/longitude-deg"),
+                               fgGetDouble("/position/latitude-deg") );
     } else {
        SG_LOG( SG_GENERAL, SG_ALERT, "Error in Tile Manager initialization!" );
        exit(-1);
@@ -627,7 +634,7 @@ bool fgInitSubsystems( void ) {
 
     WeatherDatabase = FGLocalWeatherDatabase::theFGLocalWeatherDatabase;
     
-    double init_vis = fgGetDouble("/environment/visibility");
+    double init_vis = fgGetDouble("/environment/visibility-m");
     if ( init_vis > 0 ) {
        WeatherDatabase->setWeatherVisibility( init_vis );
     }
@@ -666,6 +673,12 @@ bool fgInitSubsystems( void ) {
     current_fixlist->init( p_fix );
 
 
+    ////////////////////////////////////////////////////////////////////
+    // Initialize the built-in commands.
+    ////////////////////////////////////////////////////////////////////
+    fgInitCommands();
+
+
     ////////////////////////////////////////////////////////////////////
     // Initialize the radio stack subsystem.
     ////////////////////////////////////////////////////////////////////
@@ -693,9 +706,9 @@ bool fgInitSubsystems( void ) {
     // Initialize the joystick subsystem.
     ////////////////////////////////////////////////////////////////////
 
-    if ( ! fgJoystickInit() ) {
-       SG_LOG( SG_GENERAL, SG_ALERT, "Error in Joystick initialization!" );
-    }
+    // if ( ! fgJoystickInit() ) {
+    //   SG_LOG( SG_GENERAL, SG_ALERT, "Error in Joystick initialization!" );
+    // }
 
 
     ////////////////////////////////////////////////////////////////////
@@ -735,10 +748,10 @@ bool fgInitSubsystems( void ) {
 
     
     ////////////////////////////////////////////////////////////////////
-    // Initialize the BFI.
+    // Initialize the default (kludged) properties.
     ////////////////////////////////////////////////////////////////////
 
-    FGBFI::init();
+    fgInitProps();
 
 
     ////////////////////////////////////////////////////////////////////
@@ -749,6 +762,14 @@ bool fgInitSubsystems( void ) {
     controls.bind();
 
 
+    ////////////////////////////////////////////////////////////////////
+    // Initialize the input subsystem.
+    ////////////////////////////////////////////////////////////////////
+
+    current_input.init();
+    current_input.bind();
+
+
     ////////////////////////////////////////////////////////////////////////
     // End of subsystem initialization.
     ////////////////////////////////////////////////////////////////////
@@ -766,7 +787,7 @@ bool fgInitSubsystems( void ) {
 void fgReInitSubsystems( void )
 {
     SG_LOG( SG_GENERAL, SG_INFO,
-           "/position/altitude = " << fgGetDouble("/position/altitude") );
+           "/position/altitude = " << fgGetDouble("/position/altitude-ft") );
 
     bool freeze = globals->get_freeze();
     if( !freeze )
@@ -780,8 +801,8 @@ void fgReInitSubsystems( void )
 
     if( global_tile_mgr.init() ) {
        // Load the local scenery data
-       global_tile_mgr.update( fgGetDouble("/position/longitude"),
-                               fgGetDouble("/position/latitude") );
+       global_tile_mgr.update( fgGetDouble("/position/longitude-deg"),
+                               fgGetDouble("/position/latitude-deg") );
     } else {
        SG_LOG( SG_GENERAL, SG_ALERT, "Error in Tile Manager initialization!" );
                exit(-1);
@@ -815,6 +836,11 @@ void fgReInitSubsystems( void )
     controls.reset_all();
     current_autopilot->reset();
 
+    fgUpdateSunPos();
+    fgUpdateMoonPos();
+    cur_light_params.Update();
+    fgUpdateLocalTime();
+
     if( !freeze )
         globals->set_freeze( false );
 }