diff options
Diffstat (limited to 'engines/sherlock/resources.cpp')
-rw-r--r-- | engines/sherlock/resources.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/engines/sherlock/resources.cpp b/engines/sherlock/resources.cpp index 206d7173ac..8ec2c8c440 100644 --- a/engines/sherlock/resources.cpp +++ b/engines/sherlock/resources.cpp @@ -116,6 +116,10 @@ Resources::Resources(SherlockEngine *vm) : _vm(vm), _cache(vm) { } void Resources::addToCache(const Common::String &filename) { + // Return immediately if the library has already been loaded + if (_indexes.contains(filename)) + return; + _cache.load(filename); // Check to see if the file is a library @@ -218,6 +222,10 @@ void Resources::loadLibraryIndex(const Common::String &libFilename, Common::SeekableReadStream *stream, bool isNewStyle) { uint32 offset, nextOffset; + // Return immediately if the library has already been loaded + if (_indexes.contains(libFilename)) + return; + // Create an index entry _indexes[libFilename] = LibraryIndex(); LibraryIndex &index = _indexes[libFilename]; |