map stuff

This commit is contained in:
otfallen
2012-06-21 04:31:29 +02:00
parent 9d5d400f7a
commit d139c3738b
15 changed files with 6244 additions and 23 deletions

View File

@@ -249,6 +249,30 @@ std::string FileStream::getString()
return str;
}
uint8 FileStream::readNode(uint8 &oldNode, uint32 &type)
{
if (!oldNode) {
if ((oldNode = getU8()) == 0xFE) {
type = getU32();
return oldNode;
} else {
dump << "Failed to read new node.";
return 0;
}
}
assert(getU8() == 0xFF);
if ((oldNode = getU8()) == 0xFE) {
type = getU32();
return oldNode;
} else {
dump << "Failed to read node with old type: " << type;
return 0;
}
return 0;
}
void FileStream::addU8(uint8 v)
{
if(PHYSFS_write(m_fileHandle, &v, 1, 1) != 1)

View File

@@ -59,6 +59,7 @@ public:
void addU32(uint8 v);
void addU64(uint8 v);
uint8 readNode(uint8 &oldNode, uint32 &type);
private:
std::string m_name;
PHYSFS_File *m_fileHandle;