From: mfranz Date: Sun, 11 Jun 2006 15:32:18 +0000 (+0000) Subject: add Nasal/Listener hooks for adding/removing AI/MP models. Things like X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=79abf11466f6cccd0e383e04273997056c97da58;p=flightgear.git 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. --- 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);