diff options
author | Max Horn | 2010-06-15 16:50:10 +0000 |
---|---|---|
committer | Max Horn | 2010-06-15 16:50:10 +0000 |
commit | b8d9cf27737f13937b5950b72d7911cf5281e7c5 (patch) | |
tree | 359585b3487b9ea49c5d037f66e64a6043da4c31 | |
parent | 90408a59cca70c9890f7b32bc0788f8c0418bad7 (diff) | |
download | scummvm-rg350-b8d9cf27737f13937b5950b72d7911cf5281e7c5.tar.gz scummvm-rg350-b8d9cf27737f13937b5950b72d7911cf5281e7c5.tar.bz2 scummvm-rg350-b8d9cf27737f13937b5950b72d7911cf5281e7c5.zip |
SCI: Pass resman to scanSource() methods
svn-id: r49863
-rw-r--r-- | engines/sci/resource.cpp | 24 | ||||
-rw-r--r-- | engines/sci/resource_intern.h | 12 |
2 files changed, 15 insertions, 21 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 24e92060e2..e167d50c1a 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -437,15 +437,14 @@ void ResourceSource::loadResource(Resource *res) { fileStream->seek(res->_fileOffset, SEEK_SET); int error = res->decompress(fileStream); - - if (_resourceFile) - delete fileStream; - if (error) { warning("Error %d occurred while reading %s from resource file: %s", error, res->_id.toString().c_str(), sci_error_types[error]); res->unalloc(); } + + if (_resourceFile) + delete fileStream; } Resource *ResourceManager::testResource(ResourceId id) { @@ -623,13 +622,12 @@ void ResourceManager::scanNewSources() { if (!source->_scanned) { source->_scanned = true; - source->scanSource(); + source->scanSource(this); } } } -void DirectoryResourceSource::scanSource() { - ResourceManager *resMan = g_sci->getResMan(); +void DirectoryResourceSource::scanSource(ResourceManager *resMan) { resMan->readResourcePatches(); // We can't use getSciVersion() at this point, thus using _volVersion @@ -639,21 +637,18 @@ void DirectoryResourceSource::scanSource() { resMan->readWaveAudioPatches(); } -void ExtMapResourceSource::scanSource() { - ResourceManager *resMan = g_sci->getResMan(); +void ExtMapResourceSource::scanSource(ResourceManager *resMan) { if (resMan->_mapVersion < kResVersionSci1Late) resMan->readResourceMapSCI0(this); else resMan->readResourceMapSCI1(this); } -void ExtAudioMapResourceSource::scanSource() { - ResourceManager *resMan = g_sci->getResMan(); +void ExtAudioMapResourceSource::scanSource(ResourceManager *resMan) { resMan->readAudioMapSCI1(this); } -void IntMapResourceSource::scanSource() { - ResourceManager *resMan = g_sci->getResMan(); +void IntMapResourceSource::scanSource(ResourceManager *resMan) { resMan->readAudioMapSCI11(this); } @@ -1441,8 +1436,7 @@ static uint32 resTypeToMacTag(ResourceType type) { return 0; } -void MacResourceForkResourceSource::scanSource() { - ResourceManager *resMan = g_sci->getResMan(); +void MacResourceForkResourceSource::scanSource(ResourceManager *resMan) { if (!_macResMan->open(getLocationName().c_str())) error("%s is not a valid Mac resource fork", getLocationName().c_str()); diff --git a/engines/sci/resource_intern.h b/engines/sci/resource_intern.h index 8cb13bd311..7993fc303e 100644 --- a/engines/sci/resource_intern.h +++ b/engines/sci/resource_intern.h @@ -78,7 +78,7 @@ public: /** * Scan this source for TODO. */ - virtual void scanSource() {} + virtual void scanSource(ResourceManager *resMan) {} /** * Load a resource. @@ -95,7 +95,7 @@ class DirectoryResourceSource : public ResourceSource { public: DirectoryResourceSource(const Common::String &name) : ResourceSource(kSourceDirectory, name) {} - virtual void scanSource(); + virtual void scanSource(ResourceManager *resMan); }; class PatchResourceSource : public ResourceSource { @@ -131,7 +131,7 @@ public: : ResourceSource(kSourceExtMap, name, volNum, resFile) { } - virtual void scanSource(); + virtual void scanSource(ResourceManager *resMan); }; class IntMapResourceSource : public ResourceSource { @@ -140,7 +140,7 @@ public: : ResourceSource(kSourceIntMap, name, volNum) { } - virtual void scanSource(); + virtual void scanSource(ResourceManager *resMan); }; class AudioVolumeResourceSource : public VolumeResourceSource { @@ -162,7 +162,7 @@ public: : ResourceSource(kSourceExtAudioMap, name, volNum) { } - virtual void scanSource(); + virtual void scanSource(ResourceManager *resMan); }; class WaveResourceSource : public ResourceSource { @@ -183,7 +183,7 @@ public: MacResourceForkResourceSource(const Common::String &name, int volNum); ~MacResourceForkResourceSource(); - virtual void scanSource(); + virtual void scanSource(ResourceManager *resMan); virtual void loadResource(Resource *res); }; |