[Scummvm-cvs-logs] SF.net SVN: scummvm:[39350] scummvm/trunk/engines/tinsel

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Mar 12 04:26:03 CET 2009


Revision: 39350
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39350&view=rev
Author:   fingolfin
Date:     2009-03-12 03:26:03 +0000 (Thu, 12 Mar 2009)

Log Message:
-----------
TINSEL: Added Serializer::skip() convenience method

Modified Paths:
--------------
    scummvm/trunk/engines/tinsel/saveload.cpp
    scummvm/trunk/engines/tinsel/serializer.h

Modified: scummvm/trunk/engines/tinsel/saveload.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/saveload.cpp	2009-03-12 02:40:04 UTC (rev 39349)
+++ scummvm/trunk/engines/tinsel/saveload.cpp	2009-03-12 03:26:03 UTC (rev 39350)
@@ -149,10 +149,7 @@
 	if (tmp < 0 || hdr.id != SAVEGAME_ID || hdr.ver > CURRENT_VER || hdr.size > 1024)
 		return false;
 	// Skip over any extra bytes
-	while (tmp-- > 0) {
-		byte b = 0;
-		s.syncAsByte(b);
-	}
+	s.skip(tmp);
 	return true;
 }
 

Modified: scummvm/trunk/engines/tinsel/serializer.h
===================================================================
--- scummvm/trunk/engines/tinsel/serializer.h	2009-03-12 02:40:04 UTC (rev 39349)
+++ scummvm/trunk/engines/tinsel/serializer.h	2009-03-12 03:26:03 UTC (rev 39350)
@@ -61,7 +61,7 @@
 
 	uint bytesSynced() const { return _bytesSynced; }
 
-	void syncBytes(byte *buf, uint16 size) {
+	void syncBytes(byte *buf, uint32 size) {
 		if (_loadStream)
 			_loadStream->read(buf, size);
 		else
@@ -69,6 +69,16 @@
 		_bytesSynced += size;
 	}
 
+	void skip(uint32 size) {
+		if (_loadStream)
+			_loadStream->skip(size);
+		else {
+			while (size--)
+				_saveStream->writeByte(0);
+		}
+		_bytesSynced += size;
+	}
+
 	SYNC_AS(Byte, byte, 1)
 
 	SYNC_AS(Uint16LE, uint16, 2)


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