[Scummvm-cvs-logs] SF.net SVN: scummvm:[42112] scummvm/trunk/engines/sci/sfx/iterator.cpp

wjpalenstijn at users.sourceforge.net wjpalenstijn at users.sourceforge.net
Sun Jul 5 01:52:25 CEST 2009


Revision: 42112
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42112&view=rev
Author:   wjpalenstijn
Date:     2009-07-04 23:52:24 +0000 (Sat, 04 Jul 2009)

Log Message:
-----------
When morphing a TeeSongIterator, transfer death listeners to remaining child

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sfx/iterator.cpp

Modified: scummvm/trunk/engines/sci/sfx/iterator.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/iterator.cpp	2009-07-04 23:05:13 UTC (rev 42111)
+++ scummvm/trunk/engines/sci/sfx/iterator.cpp	2009-07-04 23:52:24 UTC (rev 42112)
@@ -1269,6 +1269,15 @@
 	}
 }
 
+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 @@
 			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;
 		}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list