]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/options.cxx
UIUC flight model contribution. This is based on LaRCsim, but can read
[flightgear.git] / src / Main / options.cxx
index 756d1935acd9bced1f384e267a1efc585cc57ace..11951ed088f5ec29153ece6df74af1a90af15734 100644 (file)
@@ -29,7 +29,7 @@
 bool global_fullscreen = true;
 #endif
 
-#include <Include/compiler.h>
+#include <simgear/compiler.h>
 
 #include <math.h>            // rint()
 #include <stdio.h>
@@ -38,17 +38,20 @@ bool global_fullscreen = true;
 
 #include STL_STRING
 
-#include <Debug/logstream.hxx>
-#include <Misc/fgstream.hxx>
-#include <Include/fg_constants.h>
+#include <simgear/constants.h>
+#include <simgear/debug/logstream.hxx>
+#include <simgear/misc/fgstream.hxx>
+
 #include <Include/general.hxx>
 #include <Cockpit/cockpit.hxx>
 #include <FDM/flight.hxx>
+#include <FDM/UIUCModel/uiuc_aircraftdir.h>
 #ifdef FG_NETWORK_OLK
-#  include <Network/network.h>
+#  include <NetworkOLK/network.h>
 #endif
 #include <Time/fg_time.hxx>
 
+#include "views.hxx"
 #include "options.hxx"
 
 FG_USING_STD(string);
@@ -80,6 +83,7 @@ atoi( const string& str )
 #endif
 }
 
+
 // Defined the shared options class here
 fgOPTIONS current_options;
 
@@ -161,6 +165,7 @@ fgOPTIONS::fgOPTIONS() :
 
     // Flight Model options
     flight_model( FGInterface::FG_LARCSIM ),
+    aircraft( "c172" ),
     model_hz( NEW_DEFAULT_MODEL_HZ ),
     speed_up( 1 ),
 
@@ -186,8 +191,12 @@ fgOPTIONS::fgOPTIONS() :
     tris_or_culled(0),
        
     // Time options
-    time_offset(0)
+    time_offset(0),
+
+    network_olk(false)
 {
+    aircraft_dir=""; // Initialize the Aircraft directory to "" (UIUC)
+
     // set initial values/defaults
     time_offset_type=FG_TIME_SYS_OFFSET;
     char* envp = ::getenv( "FG_ROOT" );
@@ -495,7 +504,7 @@ fgOPTIONS::parse_tile_radius( const string& arg ) {
 // Parse --fdm=abcdefg type option 
 int
 fgOPTIONS::parse_fdm( const string& fm ) {
-    // printf("fdm = %s\n", fm);
+    // cout << "fdm = " << fm << endl;
 
     if ( fm == "balloon" ) {
        return FGInterface::FG_BALLOONSIM;
@@ -535,7 +544,7 @@ fgOPTIONS::parse_fov( const string& arg ) {
 //
 // Format is "--protocol=medium,direction,hz,medium_options,..."
 //
-//   protocol = { nmea, garmin, fgfs, rul, pve, etc. }
+//   protocol = { native, nmea, garmin, fgfs, rul, pve, etc. }
 //   medium = { serial, socket, file, etc. }
 //   direction = { in, out, bi }
 //   hz = number of times to process channel per second (floating
@@ -546,7 +555,7 @@ fgOPTIONS::parse_fov( const string& arg ) {
 //  device = OS device name of serial line to be open()'ed
 //  baud = {300, 1200, 2400, ..., 230400}
 //
-// Socket exacmple "--fgfs=socket,dir,hz,machine,port" where
+// Socket exacmple "--native=socket,dir,hz,machine,port" where
 // 
 //  machine = machine name or ip address if client (leave empty if server)
 //  port = port, leave empty to let system choose
@@ -624,21 +633,21 @@ int fgOPTIONS::parse_option( const string& arg ) {
        }
     } else if ( arg.find( "--uBody=" ) != string::npos ) {
        if ( units == FG_UNITS_FEET ) {
-           uBody = atof( arg.substr(8) ) * FEET_TO_METER;
-       } else {
            uBody = atof( arg.substr(8) );
+       } else {
+           uBody = atof( arg.substr(8) ) * FEET_TO_METER;
        }
     } else if ( arg.find( "--vBody=" ) != string::npos ) {
        if ( units == FG_UNITS_FEET ) {
-           vBody = atof( arg.substr(8) ) * FEET_TO_METER;
-       } else {
            vBody = atof( arg.substr(8) );
+       } else {
+           vBody = atof( arg.substr(8) ) * FEET_TO_METER;
        }
     } else if ( arg.find( "--wBody=" ) != string::npos ) {
        if ( units == FG_UNITS_FEET ) {
-           wBody = atof( arg.substr(8) ) * FEET_TO_METER;
-       } else {
            wBody = atof( arg.substr(8) );
+       } else {
+           wBody = atof( arg.substr(8) ) * FEET_TO_METER;
        }
     } else if ( arg.find( "--heading=" ) != string::npos ) {
        heading = atof( arg.substr(10) );
@@ -650,6 +659,10 @@ int fgOPTIONS::parse_option( const string& arg ) {
        fg_root = arg.substr( 10 );
     } else if ( arg.find( "--fdm=" ) != string::npos ) {
        flight_model = parse_fdm( arg.substr(6) );
+    } else if ( arg.find( "--aircraft=" ) != string::npos ) {
+       aircraft = arg.substr(11);
+    } else if ( arg.find( "--aircraft-dir=" ) != string::npos ) {
+       aircraft_dir =  arg.substr(15); //  (UIUC)
     } else if ( arg.find( "--model-hz=" ) != string::npos ) {
        model_hz = atoi( arg.substr(11) );
     } else if ( arg.find( "--speed=" ) != string::npos ) {
@@ -746,8 +759,8 @@ int fgOPTIONS::parse_option( const string& arg ) {
        tris_or_culled = 0;     
     } else if ( arg == "--hud-culled" ) {
        tris_or_culled = 1;
-    } else if ( arg.find( "--fgfs=" ) != string::npos ) {
-       parse_channel( "fgfs", arg.substr(7) );
+    } else if ( arg.find( "--native=" ) != string::npos ) {
+       parse_channel( "native", arg.substr(9) );
     } else if ( arg.find( "--garmin=" ) != string::npos ) {
        parse_channel( "garmin", arg.substr(9) );
     } else if ( arg.find( "--nmea=" ) != string::npos ) {
@@ -757,6 +770,10 @@ int fgOPTIONS::parse_option( const string& arg ) {
     } else if ( arg.find( "--rul=" ) != string::npos ) {
        parse_channel( "rul", arg.substr(6) );
 #ifdef FG_NETWORK_OLK
+    } else if ( arg == "--disable-network-olk" ) {
+       network_olk = false;    
+    } else if ( arg== "--enable-network-olk") {
+       network_olk = true;     
     } else if ( arg == "--net-hud" ) {
        net_hud_display = 1;    
     } else if ( arg.find( "--net-id=") != string::npos ) {
@@ -812,9 +829,11 @@ int fgOPTIONS::parse_config_file( const string& path ) {
        string line;
 
 #ifdef GETLINE_NEEDS_TERMINATOR
-       getline( in, line, '\n' );
+        getline( in, line, '\n' );
+#elif defined (MACOS)
+       getline( in, line, '\r' );
 #else
-       getline( in, line );
+        getline( in, line );
 #endif
 
        if ( parse_option( line ) == FG_OPTIONS_ERROR ) {
@@ -865,11 +884,17 @@ void fgOPTIONS::usage ( void ) {
     cout << endl;
  
     cout << "Flight Model:" << endl;
-    cout << "\t--fdm=abcd:  one of slew, jsb, larcsim, or external" << endl;
+    cout << "\t--fdm=abcd:  selects the core flight model code." << endl;
+    cout << "\t\tcan be one of jsb, larcsim, magic, or external" << endl;
+    cout << "\t--aircraft=abcd:  aircraft model to load" << endl;
     cout << "\t--model-hz=n:  run the FDM this rate (iterations per second)" 
         << endl;
     cout << "\t--speed=n:  run the FDM this much faster than real time" << endl;
     cout << endl;
+    //(UIUC)
+    cout <<"Aircraft model directory" << endl;
+    cout <<"\t--aircraft-dir=<path> path is relative to the path of the executable" << endl;
+    cout << endl;
 
     cout << "Initial Position and Orientation:" << endl;
     cout << "\t--airport-id=ABCD:  specify starting postion by airport id"