]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_init.cxx
Bug #99 - change viewer damping calculation, to work correctly regardless of set...
[flightgear.git] / src / Main / fg_init.cxx
index 10bded7bb6b9970fb9dba081d8c6fc3112ed33c6..27a0311c37ebb0a5b906299a01e5d92d216c825b 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>
@@ -57,6 +60,7 @@
 #include <simgear/misc/interpolator.hxx>
 #include <simgear/scene/material/matlib.hxx>
 #include <simgear/scene/model/particles.hxx>
+#include <simgear/sound/soundmgr_openal.hxx>
 #include <simgear/timing/sg_time.hxx>
 #include <simgear/timing/lowleveltime.h>
 
@@ -73,6 +77,8 @@
 #include <ATCDCL/AIMgr.hxx>
 #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>
 #include <Scenery/scenery.hxx>
 #include <Scenery/tilemgr.hxx>
 #include <Scripting/NasalSys.hxx>
-#include <Sound/fg_fx.hxx>
-#include <Sound/beacon.hxx>
-#include <Sound/morse.hxx>
 #include <Sound/voice.hxx>
 #include <Systems/system_mgr.hxx>
 #include <Time/light.hxx>
 #endif
 
 using std::string;
+using namespace boost::algorithm;
 
-class Sound;
-class SGSoundMgr;
 extern const char *default_root;
-float init_volume;
 
 
 // Scan the command line options for the specified option and return
@@ -268,9 +269,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 
@@ -555,7 +556,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;
             }
@@ -584,7 +585,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 );
@@ -638,7 +639,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);
@@ -801,6 +802,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());
@@ -1443,6 +1445,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, "========== ==========");
 
@@ -1535,7 +1538,8 @@ bool fgInitSubsystems() {
 
     globals->add_subsystem( "xml-autopilot", new FGXMLAutopilot );
     globals->add_subsystem( "route-manager", new FGRouteMgr );
-
+    globals->add_subsystem( "autobrake", new FGAutoBrake );
+    
     ////////////////////////////////////////////////////////////////////
     // Initialize the view manager subsystem.
     ////////////////////////////////////////////////////////////////////
@@ -1668,18 +1672,6 @@ bool fgInitSubsystems() {
     globals->add_subsystem("replay", new FGReplay);
 
 
-    ////////////////////////////////////////////////////////////////////
-    // Add Sound Manager.
-    // Put the sound manager last so it can use the CPU while the GPU
-    // is processing the scenery (doubled the frame-rate for me) -EMH-
-    ////////////////////////////////////////////////////////////////////
-#ifdef ENABLE_AUDIO_SUPPORT
-    init_volume = fgGetFloat("/sim/sound/volume");
-    fgSetFloat("/sim/sound/volume", 0.0f);
-
-    globals->add_subsystem("soundmgr", new SGSoundMgr);
-#endif
-
     ////////////////////////////////////////////////////////////////////
     // Bind and initialize subsystems.
     ////////////////////////////////////////////////////////////////////