]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_init.cxx
- implement progress information (enabled by default; can be turned off via
[flightgear.git] / src / Main / fg_init.cxx
index 8dcefe3d11296b6796423667569fa6a496538f98..59f54da0247c8517eed22a40da4863c5106d21e5 100644 (file)
@@ -340,6 +340,12 @@ bool fgInitFGAircraft ( int argc, char **argv ) {
         }
     }
 
+    if ( aircraft.empty() ) {
+        // Check for $fg_root/system.fgfsrc
+        SGPath sysconf( globals->get_fg_root() );
+        sysconf.append( "system.fgfsrc" );
+        aircraft = fgScanForOption( "--aircraft=", sysconf.str() );
+    }
     // if an aircraft was specified, set the property name
     if ( !aircraft.empty() ) {
         SG_LOG(SG_INPUT, SG_INFO, "aircraft = " << aircraft );
@@ -630,7 +636,7 @@ bool fgFindAirportID( const string& id, FGAirport *a ) {
 
         result = globals->get_airports()->search( id );
 
-        if ( result._id.empty() ) {
+        if ( result.getId().empty() ) {
             SG_LOG( SG_GENERAL, SG_ALERT,
                     "Failed to find " << id << " in basic.dat.gz" );
             return false;
@@ -643,8 +649,8 @@ bool fgFindAirportID( const string& id, FGAirport *a ) {
 
     SG_LOG( SG_GENERAL, SG_INFO,
             "Position for " << id << " is ("
-            << a->_longitude << ", "
-            << a->_latitude << ")" );
+            << a->getLongitude() << ", "
+            << a->getLatitude() << ")" );
 
     return true;
 }
@@ -659,7 +665,7 @@ static double fgGetAirportElev( const string& id ) {
             "Finding elevation for airport: " << id );
 
     if ( fgFindAirportID( id, &a ) ) {
-        return a._elevation;
+        return a.getElevation();
     } else {
         return -9999.0;
     }
@@ -712,9 +718,9 @@ static bool fgSetTowerPosFromAirportID( const string& id, double hdg ) {
     float fudge_lat = .003f - fudge_lon;
 
     if ( fgFindAirportID( id, &a ) ) {
-        fgSetDouble("/sim/tower/longitude-deg",  a._longitude + fudge_lon);
-        fgSetDouble("/sim/tower/latitude-deg",  a._latitude + fudge_lat);
-        fgSetDouble("/sim/tower/altitude-ft", a._elevation + towerheight);
+        fgSetDouble("/sim/tower/longitude-deg",  a.getLongitude() + fudge_lon);
+        fgSetDouble("/sim/tower/latitude-deg",  a.getLatitude() + fudge_lat);
+        fgSetDouble("/sim/tower/altitude-ft", a.getElevation() + towerheight);
         return true;
     } else {
         return false;
@@ -1309,8 +1315,22 @@ void fgInitFDM() {
             }
             cur_fdm_state = new FGExternalNet( dt, host, port1, port2, port3 );
         } else if ( model.find("pipe") == 0 ) {
-            string pipe_path = model.substr(5);
-            cur_fdm_state = new FGExternalPipe( dt, pipe_path );
+            // /* old */ string pipe_path = model.substr(5);
+            // /* old */ cur_fdm_state = new FGExternalPipe( dt, pipe_path );
+            string pipe_path = "";
+            string pipe_protocol = "";
+            string pipe_options = model.substr(5);
+            string::size_type begin, end;
+            begin = 0;
+            // pipe file path
+            end = pipe_options.find( ",", begin );
+            if ( end != string::npos ) {
+                pipe_path = pipe_options.substr(begin, end - begin);
+                begin = end + 1;
+            }
+            // protocol (last option)
+            pipe_protocol = pipe_options.substr(begin);
+            cur_fdm_state = new FGExternalPipe( dt, pipe_path, pipe_protocol );
         } else if ( model == "null" ) {
             cur_fdm_state = new FGNullFDM( dt );
         } else if ( model == "yasim" ) {
@@ -1596,6 +1616,7 @@ bool fgInitSubsystems() {
     // update the current timezone each 30 minutes
     globals->get_event_mgr()->addTask( "fgUpdateLocalTime()",
                                        &fgUpdateLocalTime, 30*60 );
+    fgInitTimeOffset();                // the environment subsystem needs this
 
 
     ////////////////////////////////////////////////////////////////////
@@ -1709,11 +1730,11 @@ bool fgInitSubsystems() {
      globals->add_subsystem("Traffic Manager", new FGTrafficManager);
             FGTrafficManager *dispatcher = 
             (FGTrafficManager*) globals->get_subsystem("Traffic Manager");
-            SGPath path =globals->get_fg_root();
-            path.append("Traffic/fgtraffic.xml");
+            SGPath path = globals->get_fg_root();
+            path.append("/Traffic/fgtraffic.xml");
      readXML(path.str(),
-            *dispatcher);
-     globals->get_subsystem("Traffic Manager")->init();
+       *dispatcher);
+            //globals->get_subsystem("Traffic Manager")->init();
 
     globals->add_subsystem("instrumentation", new FGInstrumentMgr);
     globals->add_subsystem("systems", new FGSystemMgr);