]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIBase.cxx
add <load>/<unload> support to AI models, including aircraft models. For
[flightgear.git] / src / AIModel / AIBase.cxx
index 348058c870f716e29a0328993fa96b67f31b6a43..d7eda2d56fe17a4a7d93c249a8d76909bed96869 100644 (file)
@@ -39,6 +39,7 @@
 
 #include <Main/globals.hxx>
 #include <Scenery/scenery.hxx>
+#include <Scripting/NasalSys.hxx>
 
 
 #include "AIBase.hxx"
@@ -76,7 +77,7 @@ FGAIBase::~FGAIBase() {
     if (props) {
       SGPropertyNode* parent = props->getParent();
       if (parent)
-        parent->removeChild(props->getName(), props->getIndex());
+        parent->removeChild(props->getName(), props->getIndex(), false);
     }
     delete fp;
     fp = 0;
@@ -121,12 +122,6 @@ void FGAIBase::Transform() {
 
 bool FGAIBase::init() {
 
-   SGPropertyNode *root = globals->get_props()->getNode("ai/models", true);
-
-   unsigned index = root->getChildren(getTypeString()).size();
-
-   props = root->getNode(getTypeString(), index, true);
-
    if (!model_path.empty()) {
      try {
        model = load3DModel( globals->get_fg_root(), model_path, props,
@@ -168,7 +163,8 @@ ssgBranch * FGAIBase::load3DModel(const string& fg_root,
       model = sgLoad3DModel(fg_root,
                            path,
                            prop_root,
-                           sim_time_sec);
+                           sim_time_sec, 0,
+                           new FGNasalModelData);
       manager->setModel(path, model);
     }