1
0
Fork 0

Properly remove FGFX classes when not needed anymore

This commit is contained in:
Erik Hofman 2011-11-27 15:10:44 +01:00
parent f89ad9baf0
commit 99bb79c7d5

View 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();
}
}