]> git.mxchange.org Git - flightgear.git/commitdiff
Add separate switch to enable/disable AI scenario support.
authorThorstenB <brehmt@gmail.com>
Mon, 30 Apr 2012 17:04:49 +0000 (19:04 +0200)
committerThorstenB <brehmt@gmail.com>
Mon, 30 Apr 2012 17:04:49 +0000 (19:04 +0200)
Switch is enabled automatically when scenarios are given on command-line.

src/AIModel/AIManager.cxx
src/Main/options.cxx

index 7f7b5bab25c13b45b96adfe2d7aa290f916b8586..c5ea283fc56c6eacf30b25ac7309dd2923900329 100644 (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);
index 52df477ac6767d5d93b18e6b18020c39287b9cfa..9a5c84dd89f1982e9e6a03c160f3ada0c4b1531c 100644 (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;
 }