]> git.mxchange.org Git - flightgear.git/commitdiff
assign a unique module name to ai/mp embedded nasal (again): __model%u
authormfranz <mfranz>
Sun, 22 Mar 2009 17:04:02 +0000 (17:04 +0000)
committerTim Moore <timoore@redhat.com>
Wed, 1 Apr 2009 07:23:54 +0000 (09:23 +0200)
src/AIModel/AIBase.cxx
src/Scripting/NasalSys.cxx
src/Scripting/NasalSys.hxx

index 1ba3942eac45b69ac94587d2bc45726bb8aa1f2e..476ada122b117f9c55b2f7975dc81f2c33e258f3 100644 (file)
@@ -41,7 +41,6 @@
 
 #include <Main/globals.hxx>
 #include <Scenery/scenery.hxx>
-#include <Scripting/NasalSys.hxx>
 
 #include "AIBase.hxx"
 #include "AIModelData.hxx"
index a41179366142f0afd823fa66d556db536c4b5afd..02772babbddde8daf6b36895f18f1de9fa7d0865 100644 (file)
@@ -12,6 +12,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fstream>
+#include <sstream>
 
 #include <plib/ul.h>
 
@@ -1099,6 +1100,8 @@ bool FGNasalListener::changed(SGPropertyNode* node)
 // destructor the <unload> 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];
index 090777f65a058da3934e7e503fe692aa8f4c24d1..6d64e5097ba66f3ddfd4dd01902178c047bae76d 100644 (file)
@@ -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;