diff options
author | Filippos Karapetis | 2010-01-26 11:25:15 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-01-26 11:25:15 +0000 |
commit | e0293562de220544662f1cd0b39dba1f3dbe8732 (patch) | |
tree | 3e82e99bf7884ab4a47535947964ebacf9752a90 /engines/sci/engine/kscripts.cpp | |
parent | 326d64d07d528ce630698583b7f2fcb3db76e05d (diff) | |
download | scummvm-rg350-e0293562de220544662f1cd0b39dba1f3dbe8732.tar.gz scummvm-rg350-e0293562de220544662f1cd0b39dba1f3dbe8732.tar.bz2 scummvm-rg350-e0293562de220544662f1cd0b39dba1f3dbe8732.zip |
Ignore kUnload calls which are not made with less than 2 parameters. Apparently, according to the FreeSCI bugs list, SQ1 calls it with 1 parameter when exiting the Ulence flats bar
svn-id: r47563
Diffstat (limited to 'engines/sci/engine/kscripts.cpp')
-rw-r--r-- | engines/sci/engine/kscripts.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp index 18a677c67f..7bc036bbf8 100644 --- a/engines/sci/engine/kscripts.cpp +++ b/engines/sci/engine/kscripts.cpp @@ -73,11 +73,18 @@ reg_t kLock(EngineState *s, int argc, reg_t *argv) { // Unloads an arbitrary resource of type 'restype' with resource numbber 'resnr' reg_t kUnLoad(EngineState *s, int argc, reg_t *argv) { - int restype = argv[0].toUint16(); - reg_t resnr = argv[1]; + if (argc >= 2) { + int restype = argv[0].toUint16(); + reg_t resnr = argv[1]; - if (restype == kResourceTypeMemory) - kfree(s->_segMan, resnr); + if (restype == kResourceTypeMemory) + kfree(s->_segMan, resnr); + + if (argc > 2) + warning("kUnload called with more than 2 parameters (%d)", argc); + } else { + warning("kUnload called with %d arguments - ignoring", argc); + } return s->r_acc; } |