From 79abf11466f6cccd0e383e04273997056c97da58 Mon Sep 17 00:00:00 2001
From: mfranz <mfranz>
Date: Sun, 11 Jun 2006 15:32:18 +0000
Subject: [PATCH] add Nasal/Listener hooks for adding/removing AI/MP models.
 Things like 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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx
index a01b3f824..20bc20520 100644
--- a/src/AIModel/AIBase.cxx
+++ b/src/AIModel/AIBase.cxx
@@ -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);