+static int
+fgOptDME( const char *arg )
+{
+ string opt = arg;
+ if (opt == "nav1") {
+ fgSetInt("/instrumentation/dme/switch-position", 1);
+ fgSetString("/instrumentation/dme/frequencies/source",
+ "/instrumentation/nav[0]/frequencies/selected-mhz");
+ } else if (opt == "nav2") {
+ fgSetInt("/instrumentation/dme/switch-position", 3);
+ fgSetString("/instrumentation/dme/frequencies/source",
+ "/instrumentation/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-real-weather-fetch", false, OPTION_BOOL, "/environment/params/real-world-weather-fetch", false, "", 0 },
+ {"enable-real-weather-fetch", false, OPTION_BOOL, "/environment/params/real-world-weather-fetch", true, "", 0 },
+ {"disable-ai-models", false, OPTION_BOOL, "/sim/ai/enabled", false, "", 0 },
+ {"enable-ai-models", false, OPTION_BOOL, "/sim/ai/enabled", 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/pause", true, "", 0 },
+ {"enable-sound", false, OPTION_BOOL, "/sim/sound/pause", false, "", 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 },
+ {"carrier", true, OPTION_FUNC, "", false, "", fgOptCarrier },
+ {"parkpos", true, OPTION_FUNC, "", false, "", fgOptParkpos },
+ {"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-specular-highlight", false, OPTION_BOOL, "/sim/rendering/specular-highlight", false, "", 0 },
+ {"enable-specular-highlight", false, OPTION_BOOL, "/sim/rendering/specular-highlight", true, "", 0 },
+ {"disable-clouds", false, OPTION_BOOL, "/environment/clouds/status", false, "", 0 },
+ {"enable-clouds", false, OPTION_BOOL, "/environment/clouds/status", true, "", 0 },
+ {"disable-clouds3d", false, OPTION_BOOL, "/sim/rendering/clouds3d-enable", false, "", 0 },
+ {"enable-clouds3d", false, OPTION_BOOL, "/sim/rendering/clouds3d-enable", true, "", 0 },
+ {"fov", true, OPTION_FUNC, "", false, "", fgOptFov },
+ {"aspect-ratio-multiplier", true, OPTION_DOUBLE, "/sim/current-view/aspect-ratio-multiplier", false, "", 0 },
+ {"disable-fullscreen", false, OPTION_BOOL, "/sim/startup/fullscreen", false, "", 0 },
+ {"enable-fullscreen", false, OPTION_BOOL, "/sim/startup/fullscreen", true, "", 0 },
+ {"shading-flat", false, OPTION_BOOL, "/sim/rendering/shading", false, "", 0 },
+ {"shading-smooth", false, OPTION_BOOL, "/sim/rendering/shading", true, "", 0 },
+ {"disable-skyblend", false, OPTION_BOOL, "/sim/rendering/skyblend", false, "", 0 },
+ {"enable-skyblend", false, OPTION_BOOL, "/sim/rendering/skyblend", true, "", 0 },
+ {"disable-textures", false, OPTION_BOOL, "/sim/rendering/textures", false, "", 0 },
+ {"enable-textures", false, OPTION_BOOL, "/sim/rendering/textures", true, "", 0 },
+ {"disable-wireframe", false, OPTION_BOOL, "/sim/rendering/wireframe", false, "", 0 },
+ {"enable-wireframe", false, OPTION_BOOL, "/sim/rendering/wireframe", true, "", 0 },
+ {"geometry", true, OPTION_FUNC, "", false, "", fgOptGeometry },
+ {"bpp", true, OPTION_FUNC, "", false, "", fgOptBpp },
+ {"units-feet", false, OPTION_STRING, "/sim/startup/units", false, "feet", 0 },
+ {"units-meters", false, OPTION_STRING, "/sim/startup/units", false, "meters", 0 },
+ {"timeofday", true, OPTION_STRING, "/sim/startup/time-offset-type", false, "noon", 0 },
+ {"time-offset", true, OPTION_FUNC, "", false, "", fgOptTimeOffset },
+ {"time-match-real", false, OPTION_STRING, "/sim/startup/time-offset-type", false, "system-offset", 0 },
+ {"time-match-local", false, OPTION_STRING, "/sim/startup/time-offset-type", false, "latitude-offset", 0 },
+ {"start-date-sys", true, OPTION_FUNC, "", false, "", fgOptStartDateSys },
+ {"start-date-lat", true, OPTION_FUNC, "", false, "", fgOptStartDateLat },
+ {"start-date-gmt", true, OPTION_FUNC, "", false, "", fgOptStartDateGmt },
+ {"hud-tris", false, OPTION_STRING, "/sim/hud/frame-stat-type", false, "tris", 0 },
+ {"hud-culled", false, OPTION_STRING, "/sim/hud/frame-stat-type", false, "culled", 0 },
+ {"atcsim", true, OPTION_CHANNEL, "", false, "dummy", 0 },
+ {"atlas", true, OPTION_CHANNEL, "", false, "", 0 },
+ {"httpd", true, OPTION_CHANNEL, "", false, "", 0 },
+#ifdef FG_JPEG_SERVER
+ {"jpg-httpd", true, OPTION_CHANNEL, "", false, "", 0 },
+#endif
+ {"native", true, OPTION_CHANNEL, "", false, "", 0 },
+ {"native-ctrls", true, OPTION_CHANNEL, "", false, "", 0 },
+ {"native-fdm", true, OPTION_CHANNEL, "", false, "", 0 },
+ {"native-gui", true, OPTION_CHANNEL, "", false, "", 0 },
+ {"opengc", true, OPTION_CHANNEL, "", false, "", 0 },
+ {"garmin", true, OPTION_CHANNEL, "", false, "", 0 },
+ {"nmea", true, OPTION_CHANNEL, "", false, "", 0 },
+ {"generic", true, OPTION_CHANNEL, "", false, "", 0 },
+ {"props", true, OPTION_CHANNEL, "", false, "", 0 },
+ {"telnet", true, OPTION_CHANNEL, "", false, "", 0 },
+ {"pve", true, OPTION_CHANNEL, "", false, "", 0 },
+ {"ray", true, OPTION_CHANNEL, "", false, "", 0 },
+ {"rul", true, OPTION_CHANNEL, "", false, "", 0 },
+ {"joyclient", true, OPTION_CHANNEL, "", false, "", 0 },
+ {"jsclient", true, OPTION_CHANNEL, "", false, "", 0 },
+ {"proxy", true, OPTION_FUNC, "", false, "", fgSetupProxy },
+#ifdef FG_MPLAYER_AS
+ {"callsign", true, OPTION_STRING, "sim/multiplay/callsign", false, "", 0 },
+ {"multiplay", true, OPTION_CHANNEL, "", false, "", 0 },