]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_init.cxx
Merge branch 'curt/make' into next
[flightgear.git] / src / Main / fg_init.cxx
index 6e99a68bc61d26554029258e77a57098d9269add..bddcc69f1d00c2c3f8410336a057d577a1a9e5f2 100644 (file)
 #if defined( unix ) || defined( __CYGWIN__ )
 #  include <unistd.h>           // for gethostname()
 #endif
-#if defined( _MSC_VER) || defined(__MINGW32__)
+#ifdef _WIN32
 #  include <direct.h>           // for getcwd()
 #  define getcwd _getcwd
 #  include <io.h>               // isatty()
 #  define isatty _isatty
+#  include "winsock2.h"                // for gethostname()
 #endif
 
 // work around a stdc++ lib bug in some versions of linux, but doesn't
@@ -48,6 +49,8 @@
 #include <simgear/compiler.h>
 
 #include <string>
+#include <boost/algorithm/string/compare.hpp>
+#include <boost/algorithm/string/predicate.hpp>
 
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
 #include <Airports/dynamics.hxx>
 
 #include <AIModel/AIManager.hxx>
-#include <ATCDCL/ATCmgr.hxx>
-#include <ATCDCL/AIMgr.hxx>
+
+#if ENABLE_ATCDCL
+#   include <ATCDCL/ATCmgr.hxx>
+#   include <ATCDCL/AIMgr.hxx>
+#   include "ATCDCL/commlist.hxx"
+#else
+#   include "ATC/atcutils.hxx"
+#endif
+
 #include <Autopilot/route_mgr.hxx>
 #include <Autopilot/xmlauto.hxx>
+#include <Autopilot/autobrake.hxx>
+
 #include <Cockpit/cockpit.hxx>
 #include <Cockpit/panel.hxx>
 #include <Cockpit/panel_io.hxx>
-#ifdef ENABLE_SP_FDM
+
+#if ENABLE_SP_FDM
 #include <FDM/SP/ADA.hxx>
 #include <FDM/SP/ACMS.hxx>
 #include <FDM/SP/MagicCarpet.hxx>
 #include "renderer.hxx"
 #include "viewmgr.hxx"
 #include "main.hxx"
-#include "ATCDCL/commlist.hxx"
+
 
 #ifdef __APPLE__
 #  include <CoreFoundation/CoreFoundation.h>
 #endif
 
 using std::string;
+using namespace boost::algorithm;
 
 extern const char *default_root;
 
@@ -263,9 +277,9 @@ bool fgInitFGRoot ( int argc, char **argv ) {
     // find fg-root any other way.
     if ( root.empty() ) {
 #if defined( __CYGWIN__ )
-        root = "/FlightGear";
-#elif defined( WIN32 )
-        root = "\\FlightGear";
+        root = "../data";
+#elif defined( _WIN32 )
+        root = "..\\data";
 #elif defined(__APPLE__) 
         /*
         The following code looks for the base package inside the application 
@@ -550,7 +564,7 @@ static string fgFindAircraftPath( const SGPath &path, const string &aircraft,
             n->setStringValue(path.str().c_str());
             n->setAttribute(SGPropertyNode::USERARCHIVE, true);
 
-            if ( !strcmp(dire->d_name, aircraft.c_str()) ) {
+            if ( boost::equals(dire->d_name, aircraft.c_str(), is_iequal()) ) {
                 result = path.str();
                 break;
             }
@@ -579,7 +593,7 @@ bool fgInitConfig ( int argc, char **argv ) {
     }
 
     SGPropertyNode autosave;
-#if defined( _MSC_VER ) || defined( __MINGW32__ )
+#ifdef _WIN32
     char *envp = ::getenv( "APPDATA" );
     if (envp != NULL ) {
         SGPath config( envp );
@@ -633,7 +647,7 @@ bool fgInitConfig ( int argc, char **argv ) {
             vector<SGPropertyNode_ptr> cache = cache_root->getChildren("aircraft");
             for (unsigned int i = 0; i < cache.size(); i++) {
                 const char *name = cache[i]->getStringValue("file", "");
-                if (aircraft_set == name) {
+                if (boost::equals(aircraft_set, name, is_iequal())) {
                     const char *path = cache[i]->getStringValue("path", "");
                     SGPath xml(path);
                     xml.append(name);
@@ -796,6 +810,7 @@ static bool fgSetPosFromAirportIDandParkpos( const string& id, const string& par
         return false;
     }
     FGParking* parking = dcs->getParking(park_index);
+    parking->setAvailable(false);
     fgApplyStartOffset(
       SGGeod::fromDeg(parking->getLongitude(), parking->getLatitude()),
       parking->getHeading());
@@ -967,6 +982,9 @@ fgInitNav ()
 
 // Initialise the frequency search map BEFORE reading
 // the airport database:
+
+
+
     current_commlist = new FGCommList;
     current_commlist->init( globals->get_fg_root() );
     fgAirportDBLoad( aptdb.str(), current_commlist, p_metar.str() );
@@ -1438,6 +1456,7 @@ bool fgInitSubsystems() {
     //     = fgGetNode("/sim/presets/latitude-deg");
     // static const SGPropertyNode *altitude
     //     = fgGetNode("/sim/presets/altitude-ft");
+
     SG_LOG( SG_GENERAL, SG_INFO, "Initialize Subsystems");
     SG_LOG( SG_GENERAL, SG_INFO, "========== ==========");
 
@@ -1448,21 +1467,6 @@ bool fgInitSubsystems() {
     globals->get_event_mgr()->init();
     globals->get_event_mgr()->setRealtimeProperty(fgGetNode("/sim/time/delta-realtime-sec", true));
 
-    ////////////////////////////////////////////////////////////////////
-    // Initialize the sound manager subsystem.
-    ////////////////////////////////////////////////////////////////////
-
-    globals->get_soundmgr()->bind();
-    globals->get_soundmgr()->init(fgGetString("/sim/sound/device-name", NULL));
-
-    vector <const char*>devices =
-                        globals->get_soundmgr()->get_available_devices();
-    for (int i=0; i<devices.size(); i++) {
-        SGPropertyNode *p = fgGetNode("/sim/sound/devices/device", i, true);
-        p->setStringValue(devices[i]);
-    }
-    devices.clear();
-
     ////////////////////////////////////////////////////////////////////
     // Initialize the property interpolator subsystem. Put into the INIT
     // group because the "nasal" subsystem may need it at GENERAL take-down.
@@ -1543,9 +1547,10 @@ bool fgInitSubsystems() {
     // Initialize the XML Autopilot subsystem.
     ////////////////////////////////////////////////////////////////////
 
-    globals->add_subsystem( "xml-autopilot", new FGXMLAutopilot );
+    globals->add_subsystem( "xml-autopilot", new FGXMLAutopilotGroup );
     globals->add_subsystem( "route-manager", new FGRouteMgr );
-
+    globals->add_subsystem( "autobrake", new FGAutoBrake );
+    
     ////////////////////////////////////////////////////////////////////
     // Initialize the view manager subsystem.
     ////////////////////////////////////////////////////////////////////
@@ -1602,10 +1607,11 @@ bool fgInitSubsystems() {
     // Initialise the ATC Manager 
     ////////////////////////////////////////////////////////////////////
 
+#if ENABLE_ATCDCL
     SG_LOG(SG_GENERAL, SG_INFO, "  ATC Manager");
     globals->set_ATC_mgr(new FGATCMgr);
     globals->get_ATC_mgr()->init(); 
-    
+
     ////////////////////////////////////////////////////////////////////
     // Initialise the AI Manager 
     ////////////////////////////////////////////////////////////////////
@@ -1613,7 +1619,7 @@ bool fgInitSubsystems() {
     SG_LOG(SG_GENERAL, SG_INFO, "  AI Manager");
     globals->set_AI_mgr(new FGAIMgr);
     globals->get_AI_mgr()->init();
-
+#endif
     ////////////////////////////////////////////////////////////////////
     // Initialise the AI Model Manager
     ////////////////////////////////////////////////////////////////////