1
0
Fork 0

Adjust for changed SGXMLSound API

Detect bool return value from init(), use this to allow calmer
failures. Requires corresponding SG commit.
This commit is contained in:
Automatic Release Builder 2020-10-05 14:23:40 +01:00 committed by James Turner
parent 632d5bc836
commit d252740307

View file

@ -139,15 +139,17 @@ FGFX::init()
node = root.getNode("fx");
if(node) {
for (int i = 0; i < node->nChildren(); ++i) {
SGXmlSound *soundfx = new SGXmlSound();
std::unique_ptr<SGXmlSound> soundfx{new SGXmlSound};
try {
soundfx->init( _props, node->getChild(i), this, _avionics,
bool ok = soundfx->init( _props, node->getChild(i), this, _avionics,
path.dir() );
_sound.push_back( soundfx );
if (ok) {
// take the pointer out of the unique ptr so it's not deleted
_sound.push_back( soundfx.release() );
}
} catch ( sg_exception &e ) {
SG_LOG(SG_SOUND, SG_ALERT, e.getFormattedMessage());
delete soundfx;
}
}
}