aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2010-06-30 07:18:43 +0000
committerFilippos Karapetis2010-06-30 07:18:43 +0000
commit9f1413b338da98139efb68434f7f875e2abbd745 (patch)
tree8550a4e1671288c7cc59c7a27dc9d6b27c4786da
parent7455c3ec3954e068090004369600c03b6ede43a2 (diff)
downloadscummvm-rg350-9f1413b338da98139efb68434f7f875e2abbd745.tar.gz
scummvm-rg350-9f1413b338da98139efb68434f7f875e2abbd745.tar.bz2
scummvm-rg350-9f1413b338da98139efb68434f7f875e2abbd745.zip
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
-rw-r--r--engines/sci/engine/klists.cpp4
-rw-r--r--engines/sci/engine/savegame.cpp2
2 files changed, 3 insertions, 3 deletions
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);