fgSetBool("/environment/clouds/status", true);
fgSetBool("/sim/startup/fullscreen", false);
fgSetBool("/sim/rendering/shading", true);
- fgSetBool("/sim/rendering/textures", true);
fgTie( "/sim/rendering/filtering", SGGetTextureFilter, SGSetTextureFilter, false);
fgSetInt("/sim/rendering/filtering", 1);
fgSetBool("/sim/rendering/wireframe", false);
{"restore-defaults", false, OPTION_BOOL, "/sim/startup/restore-defaults", true, "", 0 },
{"shading-flat", false, OPTION_BOOL, "/sim/rendering/shading", false, "", 0 },
{"shading-smooth", false, OPTION_BOOL, "/sim/rendering/shading", true, "", 0 },
- {"disable-textures", false, OPTION_BOOL, "/sim/rendering/textures", false, "", 0 },
- {"enable-textures", false, OPTION_BOOL, "/sim/rendering/textures", true, "", 0 },
{"texture-filtering", false, OPTION_INT, "/sim/rendering/filtering", 1, "", 0 },
{"disable-wireframe", false, OPTION_BOOL, "/sim/rendering/wireframe", false, "", 0 },
{"enable-wireframe", false, OPTION_BOOL, "/sim/rendering/wireframe", true, "", 0 },
{"atcsim", true, OPTION_CHANNEL, "", false, "dummy", 0 },
{"atlas", true, OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 },
{"httpd", true, OPTION_CHANNEL, "", false, "", 0 },
-#ifdef FG_JPEG_SERVER
{"jpg-httpd", true, OPTION_CHANNEL, "", false, "", 0 },
-#endif
{"native", true, OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 },
{"native-ctrls", true, OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 },
{"native-fdm", true, OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 },
return addOption(key, value);
} else {
- SG_LOG(SG_GENERAL, SG_ALERT, "unknown option:" << s);
+ flightgear::modalMessageBox("Unknown option", "Unknown command-line option: " + s);
return FG_OPTIONS_ERROR;
}
}
{
OptionDesc* desc = p->findOption(key);
if (!desc) {
- SG_LOG(SG_GENERAL, SG_ALERT, "unknown option:" << key);
+ flightgear::modalMessageBox("Unknown option", "Unknown command-line option: " + key);
return FG_OPTIONS_ERROR;
}
if (!(desc->type & OPTION_MULTI)) {
OptionValueVec::const_iterator it = p->findValue(key);
if (it != p->values.end()) {
- SG_LOG(SG_GENERAL, SG_INFO, "multiple values forbidden for option:" << key << ", ignoring:" << value);
+ SG_LOG(SG_GENERAL, SG_WARN, "multiple values forbidden for option:" << key << ", ignoring:" << value);
return FG_OPTIONS_OK;
}
}
return result;
}
+
+static string defaultTerrasyncDir()
+{
+#if defined(SG_WINDOWS)
+ SGPath p(SGPath::documents());
+ p.append("FlightGear");
+#else
+ SGPath p(globals->get_fg_home());
+#endif
+ p.append("TerraSync");
+ return p.str();
+}
+
+
OptionResult Options::processOptions()
{
// establish locale before showing help (this selects the default locale,
}
// terrasync directory fixup
- if (fgGetBool("/sim/terrasync/enabled")) {
- string terrasyncDir = fgGetString("/sim/terrasync/scenery-dir");
- if (terrasyncDir.empty()) {
- SGPath p(globals->get_fg_home());
- p.append("TerraSync");
- terrasyncDir = p.str();
- SG_LOG(SG_GENERAL, SG_INFO,
- "Using default TerraSync dir: " << terrasyncDir);
+ string terrasyncDir = fgGetString("/sim/terrasync/scenery-dir");
+ if (terrasyncDir.empty()) {
+ terrasyncDir = defaultTerrasyncDir();
+ // auto-save it for next time
+
+ SG_LOG(SG_GENERAL, SG_INFO,
+ "Using default TerraSync: " << terrasyncDir);
fgSetString("/sim/terrasync/scenery-dir", terrasyncDir);
- }
-
- SGPath p(terrasyncDir);
- // following is necessary to ensure NavDataCache sees stable scenery paths from
- // terrasync. Ensure the Terrain and Objects subdirs exist immediately, rather
- // than waiting for the first tiles to be scheduled.
- simgear::Dir terrainDir(SGPath(p, "Terrain")),
- objectsDir(SGPath(p, "Objects"));
- if (!terrainDir.exists()) {
- terrainDir.create(0755);
- }
-
- if (!objectsDir.exists()) {
- objectsDir.create(0755);
- }
-
+ }
+
+ SGPath p(terrasyncDir);
+
+ // following is necessary to ensure NavDataCache sees stable scenery paths from
+ // terrasync. Ensure the Terrain and Objects subdirs exist immediately, rather
+ // than waiting for the first tiles to be scheduled.
+ simgear::Dir terrainDir(SGPath(p, "Terrain")),
+ objectsDir(SGPath(p, "Objects"));
+ if (!terrainDir.exists()) {
+ terrainDir.create(0755);
+ }
+
+ if (!objectsDir.exists()) {
+ objectsDir.create(0755);
+ }
+ if (fgGetBool("/sim/terrasync/enabled")) {
const string_list& scenery_paths(globals->get_fg_scenery());
if (std::find(scenery_paths.begin(), scenery_paths.end(), terrasyncDir) == scenery_paths.end()) {
// terrasync dir is not in the scenery paths, add it
globals->append_fg_scenery(root.str());
}
- return FG_OPTIONS_OK;
+ return FG_OPTIONS_OK;
}
void Options::showUsage() const
{
return p->shouldLoadDefaultConfig;
}
-
+
+bool Options::checkForArg(int argc, char* argv[], const char* checkArg)
+{
+ for (int i = 0; i < argc; ++i) {
+ char* arg = argv[i];
+ if (!strncmp("--", arg, 2) && !strcmp(arg + 2, checkArg)) {
+ return true;
+ }
+
+ if ((arg[0] == '-') && !strcmp(arg + 1, checkArg)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
} // of namespace flightgear