mirror of
https://github.com/edubart/otclient.git
synced 2025-12-22 00:17:10 +01:00
Add binary tree class for reading otb
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "filestream.h"
|
||||
#include "binarytree.h"
|
||||
#include <framework/application.h>
|
||||
|
||||
#include <physfs.h>
|
||||
@@ -246,6 +247,17 @@ std::string FileStream::getString()
|
||||
return str;
|
||||
}
|
||||
|
||||
BinaryTreePtr FileStream::getBinaryTree()
|
||||
{
|
||||
BinaryTreePtr root = BinaryTreePtr(new BinaryTree);
|
||||
uint8 byte = getU8();
|
||||
if(byte == BINARYTREE_NODE_START)
|
||||
root->unserialize(asFileStream());
|
||||
else
|
||||
stdext::throw_exception(stdext::format("failed to read node start (getFirstNode): %d", byte));
|
||||
return root;
|
||||
}
|
||||
|
||||
void FileStream::addU8(uint8 v)
|
||||
{
|
||||
if(!m_caching) {
|
||||
|
||||
Reference in New Issue
Block a user