+static int
+fgOptDME( const char *arg )
+{
+ string opt = arg;
+ if (opt == "nav1") {
+ fgSetInt("/instrumentation/dme/switch-position", 1);
+ fgSetString("/instrumentation/dme/frequencies/source",
+ "/radios/nav[0]/frequencies/selected-mhz");
+ } else if (opt == "nav2") {
+ fgSetInt("/instrumentation/dme/switch-position", 3);
+ fgSetString("/instrumentation/dme/frequencies/source",
+ "/radios/nav[1]/frequencies/selected-mhz");
+ } else {
+ fgSetInt("/instrumentation/dme/switch-position", 2);
+ fgSetString("/instrumentation/dme/frequencies/source",
+ "/instrumentation/dme/frequencies/selected-mhz");
+ fgSetString("/instrumentation/dme/frequencies/selected-mhz", arg);
+ }
+ return FG_OPTIONS_OK;
+}
+
+static map<string,size_t> fgOptionMap;
+
+/*
+ option has_param type property b_param s_param func
+
+where:
+ option : name of the option
+ has_param : option is --name=value if true or --name if false
+ type : OPTION_BOOL - property is a boolean
+ OPTION_STRING - property is a string
+ OPTION_DOUBLE - property is a double
+ OPTION_INT - property is an integer
+ OPTION_CHANNEL - name of option is the name of a channel
+ OPTION_FUNC - the option trigger a function
+ b_param : if type==OPTION_BOOL,
+ value set to the property (has_param is false for boolean)
+ s_param : if type==OPTION_STRING,
+ value set to the property if has_param is false
+ func : function called if type==OPTION_FUNC. if has_param is true,
+ the value is passed to the function as a string, otherwise,
+ 0 is passed.
+
+ For OPTION_DOUBLE and OPTION_INT, the parameter value is converted into a
+ double or an integer and set to the property.
+
+ For OPTION_CHANNEL, add_channel is called with the parameter value as the
+ argument.
+*/
+
+enum OptionType { OPTION_BOOL, OPTION_STRING, OPTION_DOUBLE, OPTION_INT, OPTION_CHANNEL, OPTION_FUNC };
+struct OptionDesc {
+ char *option;
+ bool has_param;
+ enum OptionType type;
+ char *property;
+ bool b_param;
+ char *s_param;
+ int (*func)( const char * );
+ } fgOptionArray[] = {
+
+ {"language", true, OPTION_FUNC, "", false, "", fgOptLanguage },
+ {"disable-game-mode", false, OPTION_BOOL, "/sim/startup/game-mode", false, "", 0 },
+ {"enable-game-mode", false, OPTION_BOOL, "/sim/startup/game-mode", true, "", 0 },
+ {"disable-splash-screen", false, OPTION_BOOL, "/sim/startup/splash-screen", false, "", 0 },
+ {"enable-splash-screen", false, OPTION_BOOL, "/sim/startup/splash-screen", true, "", 0 },
+ {"disable-intro-music", false, OPTION_BOOL, "/sim/startup/intro-music", false, "", 0 },
+ {"enable-intro-music", false, OPTION_BOOL, "/sim/startup/intro-music", true, "", 0 },
+ {"disable-mouse-pointer", false, OPTION_STRING, "/sim/startup/mouse-pointer", false, "disabled", 0 },
+ {"enable-mouse-pointer", false, OPTION_STRING, "/sim/startup/mouse-pointer", false, "enabled", 0 },
+ {"disable-random-objects", false, OPTION_BOOL, "/sim/rendering/random-objects", false, "", 0 },
+ {"enable-random-objects", false, OPTION_BOOL, "/sim/rendering/random-objects", true, "", 0 },
+ {"disable-freeze", false, OPTION_BOOL, "/sim/freeze/master", false, "", 0 },
+ {"enable-freeze", false, OPTION_BOOL, "/sim/freeze/master", true, "", 0 },
+ {"disable-fuel-freeze", false, OPTION_BOOL, "/sim/freeze/fuel", false, "", 0 },
+ {"enable-fuel-freeze", false, OPTION_BOOL, "/sim/freeze/fuel", true, "", 0 },
+ {"disable-clock-freeze", false, OPTION_BOOL, "/sim/freeze/clock", false, "", 0 },
+ {"enable-clock-freeze", false, OPTION_BOOL, "/sim/freeze/clock", true, "", 0 },
+ {"disable-hud-3d", false, OPTION_BOOL, "/sim/hud/enable3d", false, "", 0 },
+ {"enable-hud-3d", false, OPTION_BOOL, "/sim/hud/enable3d", true, "", 0 },
+ {"disable-anti-alias-hud", false, OPTION_BOOL, "/sim/hud/antialiased", false, "", 0 },
+ {"enable-anti-alias-hud", false, OPTION_BOOL, "/sim/hud/antialiased", true, "", 0 },
+ {"control", true, OPTION_STRING, "/sim/control-mode", false, "", 0 },
+ {"disable-auto-coordination", false, OPTION_BOOL, "/sim/auto-coordination", false, "", 0 },
+ {"enable-auto-coordination", false, OPTION_BOOL, "/sim/auto-coordination", true, "", 0 },
+ {"browser-app", true, OPTION_STRING, "/sim/startup/browser-app", false, "", 0 },
+ {"disable-hud", false, OPTION_BOOL, "/sim/hud/visibility", false, "", 0 },
+ {"enable-hud", false, OPTION_BOOL, "/sim/hud/visibility", true, "", 0 },
+ {"disable-panel", false, OPTION_BOOL, "/sim/panel/visibility", false, "", 0 },
+ {"enable-panel", false, OPTION_BOOL, "/sim/panel/visibility", true, "", 0 },
+ {"disable-sound", false, OPTION_BOOL, "/sim/sound/audible", false, "", 0 },
+ {"enable-sound", false, OPTION_BOOL, "/sim/sound/audible", true, "", 0 },
+ {"airport", true, OPTION_STRING, "/sim/presets/airport-id", false, "", 0 },
+ {"airport-id", true, OPTION_STRING, "/sim/presets/airport-id", false, "", 0 },
+ {"runway", true, OPTION_STRING, "/sim/presets/runway", false, "", 0 },
+ {"vor", true, OPTION_FUNC, "", false, "", fgOptVOR },
+ {"ndb", true, OPTION_FUNC, "", false, "", fgOptNDB },
+ {"fix", true, OPTION_FUNC, "", false, "", fgOptFIX },
+ {"offset-distance", true, OPTION_DOUBLE, "/sim/presets/offset-distance", false, "", 0 },
+ {"offset-azimuth", true, OPTION_DOUBLE, "/sim/presets/offset-azimuth", false, "", 0 },
+ {"lon", true, OPTION_FUNC, "", false, "", fgOptLon },
+ {"lat", true, OPTION_FUNC, "", false, "", fgOptLat },
+ {"altitude", true, OPTION_FUNC, "", false, "", fgOptAltitude },
+ {"uBody", true, OPTION_FUNC, "", false, "", fgOptUBody },
+ {"vBody", true, OPTION_FUNC, "", false, "", fgOptVBody },
+ {"wBody", true, OPTION_FUNC, "", false, "", fgOptWBody },
+ {"vNorth", true, OPTION_FUNC, "", false, "", fgOptVNorth },
+ {"vEast", true, OPTION_FUNC, "", false, "", fgOptVEast },
+ {"vDown", true, OPTION_FUNC, "", false, "", fgOptVDown },
+ {"vc", true, OPTION_FUNC, "", false, "", fgOptVc },
+ {"mach", true, OPTION_FUNC, "", false, "", fgOptMach },
+ {"heading", true, OPTION_DOUBLE, "/sim/presets/heading-deg", false, "", 0 },
+ {"roll", true, OPTION_DOUBLE, "/sim/presets/roll-deg", false, "", 0 },
+ {"pitch", true, OPTION_DOUBLE, "/sim/presets/pitch-deg", false, "", 0 },
+ {"glideslope", true, OPTION_DOUBLE, "/sim/presets/glideslope-deg", false, "", 0 },
+ {"roc", true, OPTION_FUNC, "", false, "", fgOptRoc },
+ {"fg-root", true, OPTION_FUNC, "", false, "", fgOptFgRoot },
+ {"fg-scenery", true, OPTION_FUNC, "", false, "", fgOptFgScenery },
+ {"fdm", true, OPTION_STRING, "/sim/flight-model", false, "", 0 },
+ {"aero", true, OPTION_STRING, "/sim/aero", false, "", 0 },
+ {"aircraft-dir", true, OPTION_STRING, "/sim/aircraft-dir", false, "", 0 },
+ {"model-hz", true, OPTION_INT, "/sim/model-hz", false, "", 0 },
+ {"speed", true, OPTION_INT, "/sim/speed-up", false, "", 0 },
+ {"trim", false, OPTION_BOOL, "/sim/presets/trim", true, "", 0 },
+ {"notrim", false, OPTION_BOOL, "/sim/presets/trim", false, "", 0 },
+ {"on-ground", false, OPTION_BOOL, "/sim/presets/onground", true, "", 0 },
+ {"in-air", false, OPTION_BOOL, "/sim/presets/onground", false, "", 0 },
+ {"fog-disable", false, OPTION_STRING, "/sim/rendering/fog", false, "disabled", 0 },
+ {"fog-fastest", false, OPTION_STRING, "/sim/rendering/fog", false, "fastest", 0 },
+ {"fog-nicest", false, OPTION_STRING, "/sim/rendering/fog", false, "nicest", 0 },
+ {"disable-horizon-effect", false, OPTION_BOOL, "/sim/rendering/horizon-effect", false, "", 0 },
+ {"enable-horizon-effect", false, OPTION_BOOL, "/sim/rendering/horizon-effect", true, "", 0 },
+ {"disable-enhanced-lighting", false, OPTION_BOOL, "/sim/rendering/enhanced-lighting", false, "", 0 },
+ {"enable-enhanced-lighting", false, OPTION_BOOL, "/sim/rendering/enhanced-lighting", true, "", 0 },
+ {"disable-distance-attenuation", false, OPTION_BOOL, "/sim/rendering/distance-attenuation", false, "", 0 },
+ {"enable-distance-attenuation", false, OPTION_BOOL, "/sim/rendering/distance-attenuation", true, "", 0 },
+ {"disable-clouds", false, OPTION_BOOL, "/environment/clouds/status", false, "", 0 },
+ {"enable-clouds", false, OPTION_BOOL, "/environment/clouds/status", true, "", 0 },
+#ifdef FG_USE_CLOUDS_3D
+ {"disable-clouds3d", false, OPTION_BOOL, "/sim/rendering/clouds3d", false, "", 0 },
+ {"enable-clouds3d", false, OPTION_BOOL, "/sim/rendering/clouds3d", true, "", 0 },