aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/savegame.cpp5
-rw-r--r--engines/sci/engine/script.h1
2 files changed, 4 insertions, 2 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 5ba88d9417..e2099a4865 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -256,8 +256,9 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
_scriptSegMap[scr->getScriptNumber()] = i;
ObjMap objects = scr->getObjectMap();
- for (ObjMap::iterator it = objects.begin(); it != objects.end(); ++it)
- it->_value.syncBaseObject(SciSpan<const byte>(scr->getBuf(it->_value.getPos().getOffset()), scr->getBufSize() - it->_value.getPos().getOffset()));
+ for (ObjMap::iterator it = objects.begin(); it != objects.end(); ++it) {
+ it->_value.syncBaseObject(scr->getSpan(it->_value.getPos().getOffset()));
+ }
}
// Sync the script's string heap
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h
index f9b3845f6a..65f3ffb6ab 100644
--- a/engines/sci/engine/script.h
+++ b/engines/sci/engine/script.h
@@ -107,6 +107,7 @@ public:
uint32 getBufSize() const { return _buf->size(); }
const byte *getBuf(uint offset = 0) const { return _buf->getUnsafeDataAt(offset); }
+ SciSpan<const byte> getSpan(uint offset) const { return _buf->subspan(offset); }
int getScriptNumber() const { return _nr; }
SegmentId getLocalsSegment() const { return _localsSegment; }