From: mfranz Date: Sun, 26 Nov 2006 12:02:06 +0000 (+0000) Subject: make sure the node for the AI model removal report exists; X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c0e1a380d67f4f8142e2e64d9499eade8a87a4a2;p=flightgear.git make sure the node for the AI model removal report exists; addressing a node with its path is unsafe at that time --- 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