]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/options.cxx
Return to glider model ...
[flightgear.git] / src / Main / options.cxx
index 3701b495e4d14d7f71ee92432e1524d124c2a7ae..48bfe14ae076e3a1037a742c9713701c652a0781 100644 (file)
@@ -44,6 +44,9 @@ bool global_fullscreen = true;
 #include <Debug/logstream.hxx>
 #include <FDM/flight.hxx>
 #include <Misc/fgstream.hxx>
+#ifdef FG_NETWORK_OLK
+#  include <Network/network.h>
+#endif
 #include <Time/fg_time.hxx>
 
 #include "options.hxx"
@@ -135,6 +138,9 @@ fgOPTIONS::fgOPTIONS() :
     // if it is lower than the terrain
     altitude(-9999.0),
 
+    // Initialize current options velocities to 0.0
+    uBody(0.0), vBody(0.0), wBody(0.0),
+
     // Initial Orientation
     heading(270.0),      // heading (yaw) angle in degress (Psi)
     roll(0.0),           // roll angle in degrees (Phi)
@@ -200,7 +206,8 @@ fgOPTIONS::fgOPTIONS() :
 #endif
     }
 
-    airport_id = "";  // default airport id
+    airport_id = "";           // default airport id
+    net_id = "Johnney";                // default pilot's name
 
     // initialize port config string list
     port_options_list.erase ( port_options_list.begin(), 
@@ -588,6 +595,24 @@ int fgOPTIONS::parse_option( const string& arg ) {
        } else {
            altitude = atof( arg.substr(11) );
        }
+    } 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 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 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 if ( arg.find( "--heading=" ) != string::npos ) {
        heading = atof( arg.substr(10) );
     } else if ( arg.find( "--roll=" ) != string::npos ) {
@@ -660,6 +685,12 @@ int fgOPTIONS::parse_option( const string& arg ) {
        tris_or_culled = 1;
     } else if ( arg.find( "--serial=" ) != string::npos ) {
        parse_serial( arg.substr(9) );
+#ifdef FG_NETWORK_OLK
+    } else if ( arg == "--net-hud" ) {
+       net_hud_display = 1;    
+    } else if ( arg.find( "--net-id=") != string::npos ) {
+       net_id = arg.substr( 9 );
+#endif
     } else {
        FG_LOG( FG_GENERAL, FG_ALERT, "Unknown option '" << arg << "'" );
        return FG_OPTIONS_ERROR;
@@ -694,19 +725,13 @@ int fgOPTIONS::parse_command_line( int argc, char **argv ) {
 // Parse config file options
 int fgOPTIONS::parse_config_file( const string& path ) {
     fg_gzifstream in( path );
-    if ( !in.is_open() )
+    if ( !in )
        return(FG_OPTIONS_ERROR);
 
     FG_LOG( FG_GENERAL, FG_INFO, "Processing config file: " << path );
 
     in >> skipcomment;
-#ifndef __MWERKS__
-    while ( ! in.eof() ) {
-#else
-    char c = '\0';
-    while ( in.get(c) && c != '\0' ) {
-       in.putback(c);
-#endif
+    while ( !in.eof() ) {
        string line;
 
 #ifdef GETLINE_NEEDS_TERMINATOR
@@ -771,6 +796,10 @@ void fgOPTIONS::usage ( void ) {
     printf("\t--heading=degrees:  heading (yaw) angle in degress (Psi)\n");
     printf("\t--roll=degrees:  roll angle in degrees (Phi)\n");
     printf("\t--pitch=degrees:  pitch angle in degrees (Theta)\n");
+    printf("\t--uBody=feet per second:  velocity along the body X axis\n");
+    printf("\t--vBody=feet per second:  velocity along the body Y axis\n");
+    printf("\t--wBody=feet per second:  velocity along the body Z axis\n");
+    printf("\t\t(unless --units-meters specified\n");
     printf("\n");
 
     printf("Rendering Options:\n");
@@ -806,11 +835,16 @@ void fgOPTIONS::usage ( void ) {
     printf("\t--time-offset=[+-]hh:mm:ss:  offset local time by this amount\n");
     printf("\t--start-date-gmt=yyyy:mm:dd:hh:mm:ss: specify a starting date/time. Time is Greenwich Mean Time\n");
     printf("\t--start-date-lst=yyyy:mm:dd:hh:mm:ss: specify a starting date/time. Uses local sidereal time\n");
+#ifdef FG_NETWORK_OLK
+    printf("\n");
+
+    printf("Network Options:\n");
+    printf("\t--net-hud:  Hud displays network info\n");
+    printf("\t--net-id=name:  specify your own callsign\n");
+#endif
 }
 
 
 // Destructor
 fgOPTIONS::~fgOPTIONS( void ) {
 }
-
-