aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/tinsel/saveload.cpp5
-rw-r--r--engines/tinsel/serializer.h12
2 files changed, 12 insertions, 5 deletions
diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp
index 139f385bb7..13c1fc58f2 100644
--- a/engines/tinsel/saveload.cpp
+++ b/engines/tinsel/saveload.cpp
@@ -149,10 +149,7 @@ static bool syncSaveGameHeader(Serializer &s, SaveGameHeader &hdr) {
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;
}
diff --git a/engines/tinsel/serializer.h b/engines/tinsel/serializer.h
index 8984cb4757..cfb528776f 100644
--- a/engines/tinsel/serializer.h
+++ b/engines/tinsel/serializer.h
@@ -61,7 +61,7 @@ public:
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 @@ public:
_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)