]> git.mxchange.org Git - flightgear.git/commitdiff
add Nasal/Listener hooks for adding/removing AI/MP models. Things like
authormfranz <mfranz>
Sun, 11 Jun 2006 15:32:18 +0000 (15:32 +0000)
committermfranz <mfranz>
Sun, 11 Jun 2006 15:32:18 +0000 (15:32 +0000)
MP chat or Nasal/xml based radar instruments need that. It uses fgSetString,
because this is in a very "cold path" and shouldn't clutter the AIBase.

src/AIModel/AIBase.cxx

index a01b3f82456ac9925f08acdb143c88641f1c5465..20bc20520c5f63113231d4d151ef5ee4445d4855 100644 (file)
@@ -75,8 +75,10 @@ FGAIBase::~FGAIBase() {
     }
     if (props) {
         SGPropertyNode* parent = props->getParent();
-        if (parent)
+        if (parent) {
+            fgSetString("/ai/models/model-removed", props->getPath());
             parent->removeChild(props->getName(), props->getIndex(), false);
+        }
     }
     delete fp;
     fp = 0;
@@ -138,6 +140,7 @@ bool FGAIBase::init() {
      globals->get_scenery()->get_scene_graph()->addKid(aip.getSceneGraph());
      // Register that one at the scenery manager
      globals->get_scenery()->register_placement_transform(aip.getTransform());
+     fgSetString("/ai/models/model-added", props->getPath());
    } else {
      if (!model_path.empty()) {
        SG_LOG(SG_INPUT, SG_WARN, "AIBase: Could not load model " << model_path);