diff options
author | Filippos Karapetis | 2010-07-02 10:18:11 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-07-02 10:18:11 +0000 |
commit | 79768098b13e20bade076b8a36c9d8cd16514b2a (patch) | |
tree | 03f37ecfc7a9d54a58b32dc895ea58795bbcd617 /engines/sci/engine | |
parent | 7b6be52f227aeaf2b544b3b35dd872f3643b1ff4 (diff) | |
download | scummvm-rg350-79768098b13e20bade076b8a36c9d8cd16514b2a.tar.gz scummvm-rg350-79768098b13e20bade076b8a36c9d8cd16514b2a.tar.bz2 scummvm-rg350-79768098b13e20bade076b8a36c9d8cd16514b2a.zip |
Added handling for kLock called with resource id -1 (unlock all resources of the requested type). Happens e.g. in KQ6 and LSL6
svn-id: r50595
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kscripts.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp index 4f4df7d875..4a50553b34 100644 --- a/engines/sci/engine/kscripts.cpp +++ b/engines/sci/engine/kscripts.cpp @@ -86,16 +86,30 @@ reg_t kLock(EngineState *s, int argc, reg_t *argv) { g_sci->getResMan()->findResource(id, 1); break; case 0 : - which = g_sci->getResMan()->findResource(id, 0); - - if (which) - g_sci->getResMan()->unlockResource(which); - else { - if (id.getType() == kResourceTypeInvalid) - warning("[resMan] Attempt to unlock resource %i of invalid type %i", id.getNumber(), type); - else - // Happens in CD games (e.g. LSL6CD) with the message resource - warning("[resMan] Attempt to unlock non-existant resource %s", id.toString().c_str()); + if (id.getNumber() == 0xFFFF) { + // Unlock all resources of the requested type + Common::List<ResourceId> *resources = g_sci->getResMan()->listResources(type); + Common::List<ResourceId>::iterator itr = resources->begin(); + + while (itr != resources->end()) { + Resource *res = g_sci->getResMan()->testResource(*itr); + if (res->isLocked()) + g_sci->getResMan()->unlockResource(res); + ++itr; + } + + } else { + which = g_sci->getResMan()->findResource(id, 0); + + if (which) + g_sci->getResMan()->unlockResource(which); + else { + if (id.getType() == kResourceTypeInvalid) + warning("[resMan] Attempt to unlock resource %i of invalid type %i", id.getNumber(), type); + else + // Happens in CD games (e.g. LSL6CD) with the message resource + warning("[resMan] Attempt to unlock non-existant resource %s", id.toString().c_str()); + } } break; } |