diff options
author | Willem Jan Palenstijn | 2009-07-04 23:52:24 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2009-07-04 23:52:24 +0000 |
commit | f907dc7fc72594e00b48c76629b40229e76657cb (patch) | |
tree | 374e696f141b6bdffb3c5fd9cb579acae32a6103 /engines | |
parent | 9255bfc9074b65226dc4d5c012e2a968051572a9 (diff) | |
download | scummvm-rg350-f907dc7fc72594e00b48c76629b40229e76657cb.tar.gz scummvm-rg350-f907dc7fc72594e00b48c76629b40229e76657cb.tar.bz2 scummvm-rg350-f907dc7fc72594e00b48c76629b40229e76657cb.zip |
When morphing a TeeSongIterator, transfer death listeners to remaining child
svn-id: r42112
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/sfx/iterator.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp index ad33bc8dfb..8b6a17fac8 100644 --- a/engines/sci/sfx/iterator.cpp +++ b/engines/sci/sfx/iterator.cpp @@ -1269,6 +1269,15 @@ static void song_iterator_remove_death_listener(SongIterator *it, TeeSongIterato } } +static void song_iterator_transfer_death_listeners(SongIterator *it, TeeSongIterator *old_client) { + song_iterator_remove_death_listener(it, old_client); + for (int i = 0; i < SONGIT_MAX_LISTENERS; ++i) { + if (old_client->_deathListeners[i]) + song_iterator_add_death_listener(it, old_client->_deathListeners[i]); + old_client->_deathListeners[i] = 0; + } +} + static void songit_tee_death_notification(TeeSongIterator *self, SongIterator *corpse) { if (corpse == self->_children[TEE_LEFT].it) { self->_status &= ~TEE_LEFT_ACTIVE; @@ -1505,12 +1514,14 @@ SongIterator *TeeSongIterator::handleMessage(Message msg) { delete _children[TEE_LEFT].it; _children[TEE_LEFT].it = 0; old_it = _children[TEE_RIGHT].it; + song_iterator_transfer_death_listeners(old_it, this); delete this; return old_it; } else if (!(_status & TEE_RIGHT_ACTIVE)) { delete _children[TEE_RIGHT].it; _children[TEE_RIGHT].it = 0; old_it = _children[TEE_LEFT].it; + song_iterator_transfer_death_listeners(old_it, this); delete this; return old_it; } |