From 3197cb6a2389000ec47bf9d27056403b98ceb0b8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 24 Oct 2006 00:56:10 +0000 Subject: Never unload files loat on startup like "CAVE.APK" and "LAGOON.APK". svn-id: r24485 --- engines/kyra/resource.cpp | 5 +++++ engines/kyra/resource.h | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'engines') 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::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; }; -- cgit v1.2.3