PINK: reformat file's code

This commit is contained in:
whiterandrek 2018-06-03 14:28:49 +03:00 committed by Eugene Sandulenko
parent 4874ed50d2
commit 83799edcba
2 changed files with 30 additions and 26 deletions

View File

@ -27,6 +27,24 @@
namespace Pink {
void ObjectDescription::load(Common::File &file) {
file.read(name, sizeof(name));
objectsOffset = file.readUint32LE();
objectsCount = file.readUint32LE();
resourcesOffset = file.readUint32LE();
resourcesCount = file.readUint32LE();
}
void ResourceDescription::load(Common::File &file) {
file.read(name, sizeof(name));
offset = file.readUint32LE();
size = file.readUint32LE();
inBro = (bool) file.readUint16LE();
}
OrbFile::OrbFile()
: File(), _timestamp(0),
_tableOffset(0),
@ -87,15 +105,6 @@ void OrbFile::loadObject(Object *obj, ObjectDescription *objDesc) {
obj->load(archive);
}
uint32 OrbFile::getTimestamp() {
return _timestamp;
}
void OrbFile::seekToObject(const char *name) {
ObjectDescription *desc = getObjDesc(name);
seek(desc->objectsOffset);
}
static int objDescComp(const void *a, const void *b) {
return scumm_stricmp((char *) a, (char *) b);
}
@ -117,6 +126,16 @@ ResourceDescription *OrbFile::getResDescTable(ObjectDescription *objDesc){
return table;
}
uint32 OrbFile::getTimestamp() {
return _timestamp;
}
void OrbFile::seekToObject(const char *name) {
ObjectDescription *desc = getObjDesc(name);
seek(desc->objectsOffset);
}
bool BroFile::open(const Common::String &name, uint32 orbTimestamp) {
if (!File::open(name) || readUint32BE() != 'BRO\0')
return false;
@ -134,21 +153,4 @@ bool BroFile::open(const Common::String &name, uint32 orbTimestamp) {
return timestamp == orbTimestamp;
}
void ObjectDescription::load(Common::File &file) {
file.read(name, sizeof(name));
objectsOffset = file.readUint32LE();
objectsCount = file.readUint32LE();
resourcesOffset = file.readUint32LE();
resourcesCount = file.readUint32LE();
}
void ResourceDescription::load(Common::File &file) {
file.read(name, sizeof(name));
offset = file.readUint32LE();
size = file.readUint32LE();
inBro = (bool) file.readUint16LE();
}
} // End of namespace Pink

View File

@ -61,12 +61,14 @@ public:
void loadObject(Object *obj, ObjectDescription *objDesc);
ObjectDescription *getObjDesc(const char *name);
ResourceDescription *getResDescTable(ObjectDescription *objDesc);
uint32 getTimestamp();
private:
void seekToObject(const char *name);
ObjectDescription *_table;
uint32 _timestamp;
uint32 _tableOffset;