1
0
Fork 0

Add separate switch to enable/disable AI scenario support.

Switch is enabled automatically when scenarios are given on command-line.
This commit is contained in:
ThorstenB 2012-04-30 19:04:49 +02:00
parent a2c2373758
commit 3986e1fe3a
2 changed files with 11 additions and 2 deletions

View file

@ -89,6 +89,15 @@ FGAIManager::init() {
void
FGAIManager::postinit() {
// postinit, so that it can access the Nasal subsystem
if (!root->getBoolValue("scenarios-enabled", true))
return;
// scenarios enabled, AI subsystem required
if (!enabled->getBoolValue())
enabled->setBoolValue(true);
// process all scenarios
map<string, bool> scenarios;
for (int i = 0 ; i < root->nChildren() ; i++) {
SGPropertyNode *n = root->getChild(i);

View file

@ -1156,7 +1156,7 @@ fgOptScenario( const char *arg )
}
SGPropertyNode_ptr scenario = ai_node->getNode( "scenario", index + 1, true );
scenario->setStringValue( arg );
ai_node->setBoolValue( "enabled", true );
ai_node->setBoolValue( "scenarios-enabled", true );
return FG_OPTIONS_OK;
}
@ -1165,7 +1165,7 @@ fgOptNoScenarios( const char *arg )
{
SGPropertyNode_ptr ai_node = fgGetNode( "/sim/ai", true );
ai_node->removeChildren("scenario",false);
ai_node->setBoolValue( "enabled", false );
ai_node->setBoolValue( "scenarios-enabled", false );
return FG_OPTIONS_OK;
}