[Scummvm-cvs-logs] SF.net SVN: scummvm:[50595] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Fri Jul 2 12:18:12 CEST 2010
Revision: 50595
http://scummvm.svn.sourceforge.net/scummvm/?rev=50595&view=rev
Author: thebluegr
Date: 2010-07-02 10:18:11 +0000 (Fri, 02 Jul 2010)
Log Message:
-----------
Added handling for kLock called with resource id -1 (unlock all resources of the requested type). Happens e.g. in KQ6 and LSL6
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kscripts.cpp
scummvm/trunk/engines/sci/resource.h
Modified: scummvm/trunk/engines/sci/engine/kscripts.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kscripts.cpp 2010-07-02 09:50:33 UTC (rev 50594)
+++ scummvm/trunk/engines/sci/engine/kscripts.cpp 2010-07-02 10:18:11 UTC (rev 50595)
@@ -86,16 +86,30 @@
g_sci->getResMan()->findResource(id, 1);
break;
case 0 :
- which = g_sci->getResMan()->findResource(id, 0);
+ 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();
- 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());
+ 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;
}
Modified: scummvm/trunk/engines/sci/resource.h
===================================================================
--- scummvm/trunk/engines/sci/resource.h 2010-07-02 09:50:33 UTC (rev 50594)
+++ scummvm/trunk/engines/sci/resource.h 2010-07-02 10:18:11 UTC (rev 50595)
@@ -210,7 +210,7 @@
inline ResourceType getType() const { return _id.getType(); }
inline uint16 getNumber() const { return _id.getNumber(); }
-
+ bool isLocked() const { return _status == kResStatusLocked; }
/**
* Write the resource to the specified stream.
* This method is used only by the "dump" debugger command.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list