]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIBase.cxx
Fix shared library build for metar executable
[flightgear.git] / src / AIModel / AIBase.cxx
index 52eaea041a09d75b28fd450d9e19f5621ceeadf3..d2e2fe25dce9c7956b475377a00ff7c51d989738 100644 (file)
@@ -38,6 +38,7 @@
 #include <simgear/misc/sg_path.hxx>
 #include <simgear/scene/model/modellib.hxx>
 #include <simgear/scene/util/SGNodeMasks.hxx>
+#include <simgear/sound/soundmgr_openal.hxx>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/props/props.hxx>
 
@@ -144,11 +145,13 @@ FGAIBase::~FGAIBase() {
             model_removed->setStringValue(props->getPath());
     }
 
+    if (_refID != 0 && _refID !=  1) {
+        SGSoundMgr *smgr = globals->get_soundmgr();
+        smgr->remove("aifx:"+_refID);
+    }
+
     delete fp;
     fp = 0;
-
-//  delete _fx;
-//  _fx = 0;
 }
 
 /** Cleanly remove the model
@@ -231,7 +234,7 @@ void FGAIBase::update(double dt) {
 
             // initialize the sound configuration
             SGSoundMgr *smgr = globals->get_soundmgr();
-            _fx = new FGFX(smgr, "aifx:"+_name+"-"+_callsign, props);
+            _fx = new FGFX(smgr, "aifx:"+_refID, props);
             _fx->init();
         }
     }
@@ -894,6 +897,17 @@ int FGAIBase::_newAIModelID() {
 }
 
 
+FGAIModelData::FGAIModelData(SGPropertyNode *root)
+  : _nasal( new FGNasalModelData(root) ),
+    _path("")
+{
+}
+
+FGAIModelData::~FGAIModelData()
+{
+    delete _nasal;
+}
+
 void FGAIModelData::modelLoaded(const string& path, SGPropertyNode *prop, osg::Node *n)
 {
     const char* fxpath = prop->getStringValue("sound/path");