aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2006-10-24 00:56:10 +0000
committerJohannes Schickel2006-10-24 00:56:10 +0000
commit3197cb6a2389000ec47bf9d27056403b98ceb0b8 (patch)
treecfc4b5f61408e600d3d7707347ac980714955bb4
parent0d357aab4d7add6011ee1fbc99c502820daf0278 (diff)
downloadscummvm-rg350-3197cb6a2389000ec47bf9d27056403b98ceb0b8.tar.gz
scummvm-rg350-3197cb6a2389000ec47bf9d27056403b98ceb0b8.tar.bz2
scummvm-rg350-3197cb6a2389000ec47bf9d27056403b98ceb0b8.zip
Never unload files loat on startup like "CAVE.APK" and "LAGOON.APK".
svn-id: r24485
-rw-r--r--engines/kyra/resource.cpp5
-rw-r--r--engines/kyra/resource.h6
2 files changed, 9 insertions, 2 deletions
diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp
index 444345d980..829c969394 100644
--- a/engines/kyra/resource.cpp
+++ b/engines/kyra/resource.cpp
@@ -81,6 +81,11 @@ Resource::Resource(KyraEngine *engine) {
if (!loadPakFile(list[i]))
error("couldn't open pakfile '%s'", list[i]);
}
+
+ Common::List<ResourceFile*>::iterator start = _pakfiles.begin();
+ for (;start != _pakfiles.end(); ++start) {
+ (*start)->protect();
+ }
} else {
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
Common::String filename = file->name();
diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h
index 34c9a16986..6d0f725184 100644
--- a/engines/kyra/resource.h
+++ b/engines/kyra/resource.h
@@ -35,7 +35,7 @@ namespace Kyra {
class ResourceFile {
public:
- ResourceFile() : _open(false), _filename() {}
+ ResourceFile() : _open(false), _protected(false), _filename() {}
virtual ~ResourceFile() {}
virtual uint8 *getFile(uint file) = 0;
@@ -47,10 +47,12 @@ public:
virtual bool isValid(void) const { return (_filename != 0); }
bool isOpen(void) const { return _open; }
- virtual void close() { _open = false; }
+ virtual void close() { if (!_protected) _open = false; }
+ virtual void protect(const bool prot = true) { _protected = prot; }
virtual void open() { _open = true; }
protected:
bool _open;
+ bool _protected;
uint _filename;
};