]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/options.cxx
Automatic tower positioning
[flightgear.git] / src / Main / options.cxx
index bce7fdeb9c00180ee682fc4485dda7ae6322f5e8..99ecbf43b8dd20cc124dc0d44c06cdc064e7154a 100644 (file)
@@ -46,6 +46,7 @@
 #include <simgear/misc/sg_path.hxx>
 #include <simgear/scene/material/mat.hxx>
 #include <simgear/sound/soundmgr_openal.hxx>
+#include <simgear/misc/strutils.hxx>
 #include <Autopilot/route_mgr.hxx>
 #include <GUI/gui.h>
 
@@ -900,10 +901,16 @@ fgOptStartDateGmt( const char *arg )
 static int
 fgSetupProxy( const char *arg )
 {
-    string options = arg;
+    string options = simgear::strutils::strip( arg );
     string host, port, auth;
     string::size_type pos;
 
+    // this is NURLP - NURLP is not an url parser
+    if( simgear::strutils::starts_with( options, "http://" ) )
+        options = options.substr( 7 );
+    if( simgear::strutils::ends_with( options, "/" ) )
+        options = options.substr( 0, options.length() - 1 );
+
     host = port = auth = "";
     if ((pos = options.find("@")) != string::npos)
         auth = options.substr(0, pos++);
@@ -1143,12 +1150,22 @@ fgOptNAV2( const char * arg )
 }
 
 static int
-fgOptADF( const char * arg )
+fgOptADF1( const char * arg )
+{
+    double rot, freq;
+    if (parse_colon(arg, &rot, &freq))
+        fgSetDouble("/instrumentation/adf[0]/rotation-deg", rot);
+    fgSetDouble("/instrumentation/adf[0]/frequencies/selected-khz", freq);
+    return FG_OPTIONS_OK;
+}
+
+static int
+fgOptADF2( const char * arg )
 {
     double rot, freq;
     if (parse_colon(arg, &rot, &freq))
-        fgSetDouble("/instrumentation/adf/rotation-deg", rot);
-    fgSetDouble("/instrumentation/adf/frequencies/selected-khz", freq);
+        fgSetDouble("/instrumentation/adf[1]/rotation-deg", rot);
+    fgSetDouble("/instrumentation/adf[1]/frequencies/selected-khz", freq);
     return FG_OPTIONS_OK;
 }
 
@@ -1486,7 +1503,9 @@ struct OptionDesc {
     {"com2",                         true,  OPTION_DOUBLE, "/instrumentation/comm[1]/frequencies/selected-mhz", false, "", 0 },
     {"nav1",                         true,  OPTION_FUNC,   "", false, "", fgOptNAV1 },
     {"nav2",                         true,  OPTION_FUNC,   "", false, "", fgOptNAV2 },
-    {"adf",                          true,  OPTION_FUNC,   "", false, "", fgOptADF },
+    {"adf", /*legacy*/               true,  OPTION_FUNC,   "", false, "", fgOptADF1 },
+    {"adf1",                         true,  OPTION_FUNC,   "", false, "", fgOptADF1 },
+    {"adf2",                         true,  OPTION_FUNC,   "", false, "", fgOptADF2 },
     {"dme",                          true,  OPTION_FUNC,   "", false, "", fgOptDME },
     {"min-status",                   true,  OPTION_STRING,  "/sim/aircraft-min-status", false, "all", 0 },
     {"livery",                       true,  OPTION_FUNC,   "", false, "", fgOptLivery },