From: mfranz Date: Sun, 22 Mar 2009 17:04:02 +0000 (+0000) Subject: assign a unique module name to ai/mp embedded nasal (again): __model%u X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=de35bbe4ed350bc3e90f66a11039e983587c5ea0;p=flightgear.git assign a unique module name to ai/mp embedded nasal (again): __model%u --- diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index 1ba3942ea..476ada122 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -41,7 +41,6 @@ #include
#include -#include #include "AIBase.hxx" #include "AIModelData.hxx" diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index a41179366..02772babb 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -1099,6 +1100,8 @@ bool FGNasalListener::changed(SGPropertyNode* node) // destructor the script. The latter happens when the model branch // is removed from the scene graph. +unsigned int FGNasalModelData::_module_id = 0; + void FGNasalModelData::modelLoaded(const string& path, SGPropertyNode *prop, osg::Node *) { @@ -1113,9 +1116,10 @@ void FGNasalModelData::modelLoaded(const string& path, SGPropertyNode *prop, if(!load && !_unload) return; - _module = path; - if(_props) - _module += ':' + _props->getPath(); + std::stringstream m; + m << "__model" << _module_id++; + _module = m.str(); + const char *s = load ? load->getStringValue() : ""; naRef arg[2]; diff --git a/src/Scripting/NasalSys.hxx b/src/Scripting/NasalSys.hxx index 090777f65..6d64e5097 100644 --- a/src/Scripting/NasalSys.hxx +++ b/src/Scripting/NasalSys.hxx @@ -167,6 +167,7 @@ public: void modelLoaded(const string& path, SGPropertyNode *prop, osg::Node *); private: + static unsigned int _module_id; string _module; SGPropertyNode_ptr _root; SGConstPropertyNode_ptr _unload;