From 9f1413b338da98139efb68434f7f875e2abbd745 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 30 Jun 2010 07:18:43 +0000 Subject: When deleting a list node, erase its references to predecessor and successor nodes. Fixes cases where game scripts could reference a list node after it was deleted (e.g. QFG1 intro, Longbow when exiting the cave). Some slight cleanup svn-id: r50515 --- engines/sci/engine/klists.cpp | 4 +++- engines/sci/engine/savegame.cpp | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/sci/engine') diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp index eff0e725b8..ef2f40e235 100644 --- a/engines/sci/engine/klists.cpp +++ b/engines/sci/engine/klists.cpp @@ -346,7 +346,9 @@ reg_t kDeleteKey(EngineState *s, int argc, reg_t *argv) { if (!n->succ.isNull()) s->_segMan->lookupNode(n->succ)->pred = n->pred; - //s->_segMan->free_Node(node_pos); // TODO + // Erase references to the predecessor and successor nodes + n->pred = NULL_REG; + n->succ = NULL_REG; return make_reg(0, 1); // Signal success } diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index bf7b88b699..b2528fe210 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -74,9 +74,7 @@ SongIterator *build_iterator(ResourceManager *resMan, int song_nr, SongIteratorT #ifdef USE_OLD_MUSIC_FUNCTIONS static void sync_songlib(Common::Serializer &s, SongLibrary &obj); -#endif -#ifdef USE_OLD_MUSIC_FUNCTIONS static void syncSong(Common::Serializer &s, Song &obj) { s.syncAsSint32LE(obj._handle); s.syncAsSint32LE(obj._resourceNum); -- cgit v1.2.3