diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index de52894b0..da109c1c7 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -52,6 +52,7 @@ const double FGAIBase::lbs_to_slugs = 0.031080950172; //conversion factor FGAIBase::FGAIBase(object_type ot) : props( NULL ), + model_removed( fgGetNode("/ai/models/model-removed", true) ), manager( NULL ), fp( NULL ), _refID( _newAIModelID() ), @@ -77,7 +78,7 @@ FGAIBase::~FGAIBase() { if (props) { SGPropertyNode* parent = props->getParent(); if (parent) { - fgSetString("/ai/models/model-removed", props->getPath()); + model_removed->setStringValue(props->getPath()); parent->removeChild(props->getName(), props->getIndex(), false); } } diff --git a/src/AIModel/AIBase.hxx b/src/AIModel/AIBase.hxx index 8b72958f1..2fa960ace 100644 --- a/src/AIModel/AIBase.hxx +++ b/src/AIModel/AIBase.hxx @@ -80,6 +80,7 @@ public: protected: SGPropertyNode_ptr props; + SGPropertyNode_ptr model_removed; // where to report model removal FGAIManager* manager; // these describe the model's actual state