]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIManager.cxx
apt.dat parser: clearer log and exception messages
[flightgear.git] / src / AIModel / AIManager.cxx
index 27582d9ca708a2fb52a236acce96d99989006886..4faf23e591e5887ffb0937ad15f276d40028e67c 100644 (file)
@@ -32,6 +32,7 @@
 #include <boost/foreach.hpp>
 
 #include <Main/globals.hxx>
+#include <Main/fg_props.hxx>
 #include <Airports/airport.hxx>
 #include <Scripting/NasalSys.hxx>
 
@@ -408,7 +409,14 @@ FGAIBasePtr FGAIManager::addObject(const SGPropertyNode* definition)
     }
 
     ai->readFromScenario(const_cast<SGPropertyNode*>(definition));
-    attach(ai);
+       if((ai->isValid())){
+               attach(ai);
+        SG_LOG(SG_AI, SG_DEBUG, "attached scenario " << ai->_getName());
+       }
+       else{
+               ai->setDie(true);
+               SG_LOG(SG_AI, SG_ALERT, "killed invalid scenario "  << ai->_getName());
+       }
     return ai;
 }