[Scummvm-cvs-logs] SF.net SVN: scummvm:[50175] scummvm/trunk/engines/m4

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Jun 23 13:22:44 CEST 2010


Revision: 50175
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50175&view=rev
Author:   thebluegr
Date:     2010-06-23 11:22:44 +0000 (Wed, 23 Jun 2010)

Log Message:
-----------
Changed some asserts to warnings

Modified Paths:
--------------
    scummvm/trunk/engines/m4/assets.cpp
    scummvm/trunk/engines/m4/graphics.cpp
    scummvm/trunk/engines/m4/sprite.cpp

Modified: scummvm/trunk/engines/m4/assets.cpp
===================================================================
--- scummvm/trunk/engines/m4/assets.cpp	2010-06-23 10:11:01 UTC (rev 50174)
+++ scummvm/trunk/engines/m4/assets.cpp	2010-06-23 11:22:44 UTC (rev 50175)
@@ -320,7 +320,12 @@
 }
 
 M4Sprite *SpriteAsset::getFrame(int frameIndex) {
-	return _frames[frameIndex].frame;
+	if ((uint)frameIndex < _frames.size()) {
+		return _frames[frameIndex].frame;
+	} else {
+		warning("SpriteAsset::getFrame: Invalid frame %d, out of %d", frameIndex, _frames.size());
+		return _frames[_frames.size() - 1].frame;
+	}
 }
 
 void SpriteAsset::loadStreamingFrame(M4Sprite *frame, int frameIndex, int destX, int destY) {

Modified: scummvm/trunk/engines/m4/graphics.cpp
===================================================================
--- scummvm/trunk/engines/m4/graphics.cpp	2010-06-23 10:11:01 UTC (rev 50174)
+++ scummvm/trunk/engines/m4/graphics.cpp	2010-06-23 11:22:44 UTC (rev 50175)
@@ -920,8 +920,10 @@
 
 	for (int i = 0; i < width() * height(); ++i, ++p) {
 		if (!isTransparent || (*p != TRANSPARENT_COLOUR_INDEX)) {
-			assert(*p < list->size());
-			*p = palIndexes[*p];
+			if (*p < list->size()) {
+				warning("Pal pointer exceeds list size");
+				*p = palIndexes[*p];
+			}
 		}
 	}
 

Modified: scummvm/trunk/engines/m4/sprite.cpp
===================================================================
--- scummvm/trunk/engines/m4/sprite.cpp	2010-06-23 10:11:01 UTC (rev 50174)
+++ scummvm/trunk/engines/m4/sprite.cpp	2010-06-23 11:22:44 UTC (rev 50175)
@@ -182,7 +182,10 @@
 		// Check if we need to scan forward to find the end of the line
 		if (!newLine) {
 			do {
-				assert(!source->eos());
+				if (source->eos()) {
+					warning("M4Sprite::loadMadsSprite: unexpected end of data");
+					break;
+				}
 			} while (source->readByte() != 0xff);
 		}
 	}


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