Now opening all files via getVolumeFile()

svn-id: r49451
This commit is contained in:
Filippos Karapetis 2010-06-06 13:04:24 +00:00
parent b90ca013a8
commit 43c353d930
3 changed files with 10 additions and 19 deletions

View File

@ -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;

View File

@ -393,7 +393,7 @@ protected:
*/
const char *versionDescription(ResVersion version) const;
Common::File *getVolumeFile(const char *filename);
Common::SeekableReadStream *getVolumeFile(ResourceSource *source);
void loadResource(Resource *res);
bool loadPatch(Resource *res, Common::SeekableReadStream *file);
bool loadFromPatchFile(Resource *res);

View File

@ -33,12 +33,7 @@
namespace Sci {
void ResourceManager::checkIfAudioVolumeIsCompressed(ResourceSource *source) {
Common::SeekableReadStream *fileStream;
if (source->resourceFile)
fileStream = source->resourceFile->createReadStream();
else
fileStream = getVolumeFile(source->location_name.c_str());
Common::SeekableReadStream *fileStream = getVolumeFile(source);
if (!fileStream) {
warning("Failed to open %s", source->location_name.c_str());