diff options
Diffstat (limited to 'engines/titanic/sound')
-rw-r--r-- | engines/titanic/sound/sound.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index 7e791c2ba5..045f5aad91 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -87,13 +87,16 @@ void CSound::stopChannel(int channel) { } void CSound::checkSounds() { - for (CSoundItemList::iterator i = _sounds.begin(); i != _sounds.end(); ++i) { + for (CSoundItemList::iterator i = _sounds.begin(); i != _sounds.end(); ) { CSoundItem *soundItem = *i; + if (soundItem->_active && soundItem->_freeFlag) { if (_soundManager.isActive(soundItem->_waveFile)) { - _sounds.remove(soundItem); + i = _sounds.erase(i); delete soundItem; } + } else { + ++i; } } } |