#358: Missing option to disable AI scenarios
--ai-scenario=... can only add/enable another scenario. Introduce --disable-ai-scenarios option to disable all scenarios (can be used by external launchers, GUIs etc) Also provide error instead of debug message when a scenario cannot be loaded.
This commit is contained in:
parent
c19664291f
commit
1ebab94710
2 changed files with 13 additions and 3 deletions
|
@ -358,9 +358,9 @@ FGAIManager::loadScenarioFile(const std::string& filename)
|
||||||
SGPropertyNode_ptr root = new SGPropertyNode;
|
SGPropertyNode_ptr root = new SGPropertyNode;
|
||||||
readProperties(path.str(), root);
|
readProperties(path.str(), root);
|
||||||
return root;
|
return root;
|
||||||
} catch (const sg_exception &) {
|
} catch (const sg_exception &t) {
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Incorrect path specified for AI "
|
SG_LOG(SG_GENERAL, SG_ALERT, "Failed to load scenario '"
|
||||||
"scenario: \"" << path.str() << "\"");
|
<< path.str() << "': " << t.getFormattedMessage());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1167,6 +1167,15 @@ fgOptScenario( const char *arg )
|
||||||
return FG_OPTIONS_OK;
|
return FG_OPTIONS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
fgOptNoScenarios( const char *arg )
|
||||||
|
{
|
||||||
|
SGPropertyNode_ptr ai_node = fgGetNode( "/sim/ai", true );
|
||||||
|
ai_node->removeChildren("scenario",false);
|
||||||
|
ai_node->setBoolValue( "enabled", false );
|
||||||
|
return FG_OPTIONS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fgOptRunway( const char *arg )
|
fgOptRunway( const char *arg )
|
||||||
{
|
{
|
||||||
|
@ -1465,6 +1474,7 @@ struct OptionDesc {
|
||||||
{"min-status", true, OPTION_STRING, "/sim/aircraft-min-status", false, "all", 0 },
|
{"min-status", true, OPTION_STRING, "/sim/aircraft-min-status", false, "all", 0 },
|
||||||
{"livery", true, OPTION_FUNC, "", false, "", fgOptLivery },
|
{"livery", true, OPTION_FUNC, "", false, "", fgOptLivery },
|
||||||
{"ai-scenario", true, OPTION_FUNC, "", false, "", fgOptScenario },
|
{"ai-scenario", true, OPTION_FUNC, "", false, "", fgOptScenario },
|
||||||
|
{"disable-ai-scenarios", false, OPTION_FUNC, "", false, "", fgOptNoScenarios},
|
||||||
{"parking-id", true, OPTION_FUNC, "", false, "", fgOptParking },
|
{"parking-id", true, OPTION_FUNC, "", false, "", fgOptParking },
|
||||||
{"version", false, OPTION_FUNC, "", false, "", fgOptVersion },
|
{"version", false, OPTION_FUNC, "", false, "", fgOptVersion },
|
||||||
{"enable-fpe", false, OPTION_FUNC, "", false, "", fgOptFpe},
|
{"enable-fpe", false, OPTION_FUNC, "", false, "", fgOptFpe},
|
||||||
|
|
Loading…
Add table
Reference in a new issue