mirror of
https://github.com/edubart/otclient.git
synced 2025-12-22 00:17:10 +01:00
Optimize overall memory usage
* Fixes in otbm loader * Rework BinaryTree
This commit is contained in:
@@ -143,7 +143,7 @@ void FileStream::skip(uint len)
|
||||
seek(tell() + len);
|
||||
}
|
||||
|
||||
int FileStream::size()
|
||||
uint FileStream::size()
|
||||
{
|
||||
if(!m_caching)
|
||||
return PHYSFS_fileLength(m_fileHandle);
|
||||
@@ -151,7 +151,7 @@ int FileStream::size()
|
||||
return m_data.size();
|
||||
}
|
||||
|
||||
int FileStream::tell()
|
||||
uint FileStream::tell()
|
||||
{
|
||||
if(!m_caching)
|
||||
return PHYSFS_tell(m_fileHandle);
|
||||
@@ -249,13 +249,11 @@ std::string FileStream::getString()
|
||||
|
||||
BinaryTreePtr FileStream::getBinaryTree()
|
||||
{
|
||||
BinaryTreePtr root = BinaryTreePtr(new BinaryTree);
|
||||
uint8 byte = getU8();
|
||||
if(byte == BINARYTREE_NODE_START)
|
||||
root->unserialize(asFileStream());
|
||||
else
|
||||
if(byte != BINARYTREE_NODE_START)
|
||||
stdext::throw_exception(stdext::format("failed to read node start (getBinaryTree): %d", byte));
|
||||
return root;
|
||||
|
||||
return BinaryTreePtr(new BinaryTree(asFileStream()));
|
||||
}
|
||||
|
||||
void FileStream::addU8(uint8 v)
|
||||
|
||||
Reference in New Issue
Block a user