diff options
author | Filippos Karapetis | 2010-06-06 13:04:24 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-06-06 13:04:24 +0000 |
commit | 43c353d9308515e0ce4d73773e50810f9e89ae47 (patch) | |
tree | e21c35e4ef8a3221628b5a1690114390a55b6746 /engines/sci/resource.cpp | |
parent | b90ca013a814fd1023254543217c554382a3bd67 (diff) | |
download | scummvm-rg350-43c353d9308515e0ce4d73773e50810f9e89ae47.tar.gz scummvm-rg350-43c353d9308515e0ce4d73773e50810f9e89ae47.tar.bz2 scummvm-rg350-43c353d9308515e0ce4d73773e50810f9e89ae47.zip |
Now opening all files via getVolumeFile()
svn-id: r49451
Diffstat (limited to 'engines/sci/resource.cpp')
-rw-r--r-- | engines/sci/resource.cpp | 20 |
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; |