aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorColin Snover2017-05-20 19:50:56 -0500
committerColin Snover2017-05-20 21:14:18 -0500
commit881be25fcd82d765235e95ebf041a70ec1ae5ae5 (patch)
tree23adf16b40a0d539b8ff54b2119cc5f52ea760bb /engines/sci/engine
parent66efb750a0ccaa3c2ff8b77f60544a345328da8b (diff)
downloadscummvm-rg350-881be25fcd82d765235e95ebf041a70ec1ae5ae5.tar.gz
scummvm-rg350-881be25fcd82d765235e95ebf041a70ec1ae5ae5.tar.bz2
scummvm-rg350-881be25fcd82d765235e95ebf041a70ec1ae5ae5.zip
SCI: Stop making copies of ObjMap and remove related dead code
ObjMap owns Objects, so every time this map gets copied instead of referenced, it creates a copy of every single object in the associated script. This is expensive, and it breaks things like the `Object::syncBaseObject` call in savegame.cpp, which hasn't actually been doing anything since 58190c36b4cc84b3200239211d91b0291301db56 because it has been operating on copies.
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/object.h1
-rw-r--r--engines/sci/engine/savegame.cpp7
2 files changed, 1 insertions, 7 deletions
diff --git a/engines/sci/engine/object.h b/engines/sci/engine/object.h
index 136a831636..71b366dc79 100644
--- a/engines/sci/engine/object.h
+++ b/engines/sci/engine/object.h
@@ -309,7 +309,6 @@ public:
void initSpecies(SegManager *segMan, reg_t addr);
void initSuperClass(SegManager *segMan, reg_t addr);
bool initBaseObject(SegManager *segMan, reg_t addr, bool doInitSuperClass = true);
- void syncBaseObject(const SciSpan<const byte> &ptr) { _baseObj = ptr; }
#ifdef ENABLE_SCI32
bool mustSetViewVisible(const int index, const bool fromPropertyOp) const;
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index dce6430946..1095b7fe53 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -255,11 +255,6 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
if (s.isLoading()) {
// Hook the script up in the script->segment map
_scriptSegMap[scr->getScriptNumber()] = i;
-
- ObjMap objects = scr->getObjectMap();
- 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
@@ -287,7 +282,7 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
Script *scr = (Script *)_heap[i];
scr->syncLocalsBlock(this);
- ObjMap objects = scr->getObjectMap();
+ ObjMap &objects = scr->getObjectMap();
for (ObjMap::iterator it = objects.begin(); it != objects.end(); ++it) {
reg_t addr = it->_value.getPos();
Object *obj = scr->scriptObjInit(addr, false);