aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/resource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/resource.cpp')
-rw-r--r--engines/sci/resource.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index b17117a1cd..f22c4d75fe 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -299,10 +299,15 @@ bool ResourceManager::loadFromPatchFile(Resource *res) {
return loadPatch(res, &file);
}
-Common::File *ResourceManager::getVolumeFile(const char *filename) {
+Common::SeekableReadStream *ResourceManager::getVolumeFile(ResourceSource *source) {
Common::List<Common::File *>::iterator it = _volumeFiles.begin();
Common::File *file;
+ if (source->resourceFile)
+ return source->resourceFile->createReadStream();
+
+ const char *filename = source->location_name.c_str();
+
// check if file is already opened
while (it != _volumeFiles.end()) {
file = *it;
@@ -353,13 +358,7 @@ void ResourceManager::loadResource(Resource *res) {
return;
}
- Common::SeekableReadStream *fileStream;
-
- // Either loading from volume or patch loading failed
- if (res->_source->resourceFile)
- fileStream = res->_source->resourceFile->createReadStream();
- else
- fileStream = getVolumeFile(res->_source->location_name.c_str());
+ Common::SeekableReadStream *fileStream = getVolumeFile(res->_source);
if (!fileStream) {
warning("Failed to open %s", res->_source->location_name.c_str());
@@ -1604,10 +1603,7 @@ ResourceCompression ResourceManager::getViewCompression() {
if (res->_source->source_type != kSourceVolume)
continue;
- if (res->_source->resourceFile)
- fileStream = res->_source->resourceFile->createReadStream();
- else
- fileStream = getVolumeFile(res->_source->location_name.c_str());
+ fileStream = getVolumeFile(res->_source);
if (!fileStream)
continue;