aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/resource.h
diff options
context:
space:
mode:
authorMatthew Hoops2010-11-20 23:53:14 +0000
committerMatthew Hoops2010-11-20 23:53:14 +0000
commit0f2bcd2f9fcc6d5c8ba67b75f625290db126d231 (patch)
treebe048742e6c46d4706ea895393f998c89bc7fdaa /engines/mohawk/resource.h
parentd886c037dd43aa76550c8dcea7b59f8f53f1c6fa (diff)
downloadscummvm-rg350-0f2bcd2f9fcc6d5c8ba67b75f625290db126d231.tar.gz
scummvm-rg350-0f2bcd2f9fcc6d5c8ba67b75f625290db126d231.tar.bz2
scummvm-rg350-0f2bcd2f9fcc6d5c8ba67b75f625290db126d231.zip
MOHAWK: Cleanup resource handling
- Renamed getRawData() to getResource() - Add a getResource() and hasResource() function for named resources - Other minor formatting changes svn-id: r54396
Diffstat (limited to 'engines/mohawk/resource.h')
-rw-r--r--engines/mohawk/resource.h42
1 files changed, 13 insertions, 29 deletions
diff --git a/engines/mohawk/resource.h b/engines/mohawk/resource.h
index bd63ae7f44..e710cb1b10 100644
--- a/engines/mohawk/resource.h
+++ b/engines/mohawk/resource.h
@@ -183,8 +183,10 @@ public:
virtual void open(Common::SeekableReadStream *stream);
void close();
- bool hasResource(uint32 tag, uint16 id);
- virtual Common::SeekableReadStream *getRawData(uint32 tag, uint16 id);
+ virtual bool hasResource(uint32 tag, uint16 id);
+ virtual bool hasResource(uint32 tag, const Common::String &resName);
+ virtual Common::SeekableReadStream *getResource(uint32 tag, uint16 id);
+ virtual Common::SeekableReadStream *getResource(uint32 tag, const Common::String &resName);
virtual uint32 getOffset(uint32 tag, uint16 id);
protected:
@@ -202,19 +204,9 @@ private:
uint16 _resourceTableAmount;
uint16 _fileTableAmount;
- virtual int16 getTypeIndex(uint32 tag) {
- for (uint16 i = 0; i < _typeTable.resource_types; i++)
- if (_types[i].tag == tag)
- return i;
- return -1; // not found
- }
-
- virtual int16 getIdIndex(int16 typeIndex, uint16 id) {
- for (uint16 i = 0; i < _types[typeIndex].resTable.resources; i++)
- if (_types[typeIndex].resTable.entries[i].id == id)
- return i;
- return -1; // not found
- }
+ int getTypeIndex(uint32 tag);
+ int getIDIndex(int typeIndex, uint16 id);
+ int getIDIndex(int typeIndex, const Common::String &resName);
};
class LivingBooksArchive_v1 : public MohawkArchive {
@@ -222,8 +214,11 @@ public:
LivingBooksArchive_v1() : MohawkArchive() {}
~LivingBooksArchive_v1() {}
+ bool hasResource(uint32 tag, uint16 id);
+ bool hasResource(uint32 tag, const Common::String &resName) { return false; }
void open(Common::SeekableReadStream *stream);
- Common::SeekableReadStream *getRawData(uint32 tag, uint16 id);
+ Common::SeekableReadStream *getResource(uint32 tag, uint16 id);
+ Common::SeekableReadStream *getResource(uint32 tag, const Common::String &resName) { return 0; }
uint32 getOffset(uint32 tag, uint16 id);
private:
@@ -240,19 +235,8 @@ private:
} resTable;
} *_types;
- int16 getTypeIndex(uint32 tag) {
- for (uint16 i = 0; i < _typeTable.resource_types; i++)
- if (_types[i].tag == tag)
- return i;
- return -1; // not found
- }
-
- int16 getIdIndex(int16 typeIndex, uint16 id) {
- for (uint16 i = 0; i < _types[typeIndex].resTable.resources; i++)
- if (_types[typeIndex].resTable.entries[i].id == id)
- return i;
- return -1; // not found
- }
+ int getTypeIndex(uint32 tag);
+ int getIDIndex(int typeIndex, uint16 id);
};
} // End of namespace Mohawk