mirror of
https://github.com/edubart/otclient.git
synced 2025-11-30 23:26:51 +01:00
Fix possible gcc optimizations to binary reading
This commit is contained in:
@@ -163,6 +163,23 @@ std::string BinaryTree::getString()
|
||||
return ret;
|
||||
}
|
||||
|
||||
Position BinaryTree::getPosition()
|
||||
{
|
||||
Position ret;
|
||||
ret.x = getU16();
|
||||
ret.y = getU16();
|
||||
ret.z = getU8();
|
||||
return ret;
|
||||
}
|
||||
|
||||
Point BinaryTree::getPoint()
|
||||
{
|
||||
Point ret;
|
||||
ret.x = getU8();
|
||||
ret.y = getU8();
|
||||
return ret;
|
||||
}
|
||||
|
||||
BinaryTreePtr BinaryTree::makeChild(uint8 type)
|
||||
{
|
||||
BinaryTreePtr child(new BinaryTree(m_fin));
|
||||
|
||||
@@ -49,8 +49,8 @@ public:
|
||||
uint32 getU32();
|
||||
uint64 getU64();
|
||||
std::string getString();
|
||||
Position getPosition() { return Position(getU16(), getU16(), getU8()); }
|
||||
Point getPoint() { return Point(getU8(), getU8()); }
|
||||
Position getPosition();
|
||||
Point getPoint();
|
||||
|
||||
void setType(uint8 type);
|
||||
void writeU8(uint8 u8);
|
||||
|
||||
@@ -963,12 +963,19 @@ public:
|
||||
|
||||
Position readPos(const std::string& base = std::string()) const
|
||||
{
|
||||
return Position(readType<uint16>(base + "x"), readType<uint16>(base + "y"), readType<uint8>(base + "z"));
|
||||
Position ret;
|
||||
ret.x = readType<uint16>(base + "x");
|
||||
ret.y = readType<uint16>(base + "y");
|
||||
ret.z = readType<uint8>(base + "z");
|
||||
return ret;
|
||||
}
|
||||
|
||||
Point readPoint() const
|
||||
{
|
||||
return Point(readType<int>("x"), readType<int>("y"));
|
||||
Point ret;
|
||||
ret.x = readType<int>("x");
|
||||
ret.y = readType<int>("y");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** Template form of the attribute query which will try to read the
|
||||
|
||||
Reference in New Issue
Block a user