diff options
author | Colin Snover | 2017-02-08 18:52:20 -0600 |
---|---|---|
committer | Colin Snover | 2017-04-22 13:01:37 -0500 |
commit | 93b337b8335a455d0108c168ebcfae655327753c (patch) | |
tree | 69a89200367f712689f26de88214b5e5c0f33cc9 /engines/sci | |
parent | a22e461208db6000adce464eb501159d015e3492 (diff) | |
download | scummvm-rg350-93b337b8335a455d0108c168ebcfae655327753c.tar.gz scummvm-rg350-93b337b8335a455d0108c168ebcfae655327753c.tar.bz2 scummvm-rg350-93b337b8335a455d0108c168ebcfae655327753c.zip |
SCI: Do not sync objects when saving games
Commit 5de2668939a6735da2b3438b7c586fc185791ef8 silently changed
behaviour from running this code only when restoring a game, to
running all the time, in an apparent copy-paste error.
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/savegame.cpp | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 057d590b78..3b8429bf08 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -271,35 +271,37 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) { syncArray<Class>(s, _classTable); - // Now that all scripts are loaded, init their objects. - // Just like in Script::initializeObjectsSci0, we do two passes - // in case an object is loaded before its base. - int passes = getSciVersion() < SCI_VERSION_1_1 ? 2 : 1; - for (int pass = 1; pass <= passes; ++pass) { - for (uint i = 0; i < _heap.size(); i++) { - if (!_heap[i] || _heap[i]->getType() != SEG_TYPE_SCRIPT) - continue; - - Script *scr = (Script *)_heap[i]; - scr->syncLocalsBlock(this); + if (s.isLoading()) { + // Now that all scripts are loaded, init their objects. + // Just like in Script::initializeObjectsSci0, we do two passes + // in case an object is loaded before its base. + int passes = getSciVersion() < SCI_VERSION_1_1 ? 2 : 1; + for (int pass = 1; pass <= passes; ++pass) { + for (uint i = 0; i < _heap.size(); i++) { + if (!_heap[i] || _heap[i]->getType() != SEG_TYPE_SCRIPT) + continue; - 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); + Script *scr = (Script *)_heap[i]; + scr->syncLocalsBlock(this); - if (pass == 2) { - if (!obj->initBaseObject(this, addr, false)) { - // TODO/FIXME: This should not be happening at all. It might indicate a possible issue - // with the garbage collector. It happens for example in LSL5 (German, perhaps English too). - warning("Failed to locate base object for object at %04X:%04X; skipping", PRINT_REG(addr)); - objects.erase(addr.toUint16()); + 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); + + if (pass == 2) { + if (!obj->initBaseObject(this, addr, false)) { + // TODO/FIXME: This should not be happening at all. It might indicate a possible issue + // with the garbage collector. It happens for example in LSL5 (German, perhaps English too). + warning("Failed to locate base object for object at %04X:%04X; skipping", PRINT_REG(addr)); + objects.erase(addr.toUint16()); + } } } - } - if (s.isLoading() && pass == passes) { - g_sci->_guestAdditions->segManSaveLoadScriptHook(*scr); + if (pass == passes) { + g_sci->_guestAdditions->segManSaveLoadScriptHook(*scr); + } } } } |