[Scummvm-cvs-logs] SF.net SVN: scummvm:[45695] scummvm/trunk/engines/draci

spalek at users.sourceforge.net spalek at users.sourceforge.net
Fri Nov 6 17:48:37 CET 2009


Revision: 45695
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45695&view=rev
Author:   spalek
Date:     2009-11-06 16:48:37 +0000 (Fri, 06 Nov 2009)

Log Message:
-----------
Add safe-guard against collision of animation IDs.

When debugging another issue, I preloaded all animations, and horrible things
happened that I debugged for a few hours.

Modified Paths:
--------------
    scummvm/trunk/engines/draci/animation.cpp
    scummvm/trunk/engines/draci/game.cpp

Modified: scummvm/trunk/engines/draci/animation.cpp
===================================================================
--- scummvm/trunk/engines/draci/animation.cpp	2009-11-06 10:33:36 UTC (rev 45694)
+++ scummvm/trunk/engines/draci/animation.cpp	2009-11-06 16:48:37 UTC (rev 45695)
@@ -63,6 +63,9 @@
 }
 
 void Animation::markDirtyRect(Surface *surface) const {
+	if (getFrameCount() == 0)
+		return;
+
 	// Fetch the current frame's rectangle
 	Drawable *frame = _frames[_currentFrame];
 	Common::Rect frameRect = frame->getRect(_displacement);

Modified: scummvm/trunk/engines/draci/game.cpp
===================================================================
--- scummvm/trunk/engines/draci/game.cpp	2009-11-06 10:33:36 UTC (rev 45694)
+++ scummvm/trunk/engines/draci/game.cpp	2009-11-06 16:48:37 UTC (rev 45695)
@@ -1166,6 +1166,13 @@
 }
 
 int Game::loadAnimation(uint animNum, uint z) {
+	// Make double-sure that an animation isn't loaded more than twice,
+	// otherwise horrible things happen in the AnimationManager, because
+	// they use a simple link-list without duplicate checking.  This should
+	// never happen unless there is a bug in the game, because all GPL2
+	// commands are guarded.
+	assert(!_vm->_anims->getAnimation(animNum));
+
 	const BAFile *animFile = _vm->_animationsArchive->getFile(animNum);
 	Common::MemoryReadStream animationReader(animFile->_data, animFile->_length);
 


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