Core/Objects: fixed packet guid writing

This commit is contained in:
Ovahlord committed 2023-12-10 03:29:23 +01:00
1 parent 4bc6115d4e
commit df646fbe6a
2 files changed
+14 -3

No files matched your search

@@ -117,6 +117,12 @@ ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid)
return buf;
}
ByteBuffer& operator<<(ByteBuffer& buf, PackedGuidWriter const& guid)
{
buf.appendPackGUID(guid.Guid.GetRawValue());
return buf;
}
ByteBuffer& operator>>(ByteBuffer& buf, PackedGuidReader const& guid)
{
buf.readPackGUID(reinterpret_cast<uint64&>(guid.Guid));
+8 -3
View File
@@ -129,6 +129,12 @@ struct PackedGuidReader
ObjectGuid& Guid;
};
struct PackedGuidWriter
{
explicit PackedGuidWriter(ObjectGuid const& guid) : Guid(guid) { }
ObjectGuid const& Guid;
};
class TC_GAME_API ObjectGuid
{
public:
@@ -158,7 +164,7 @@ class TC_GAME_API ObjectGuid
void Set(uint64 guid) { _data._guid = guid; }
void Clear() { _data._guid = 0; }
PackedGuid WriteAsPacked() const;
PackedGuidWriter WriteAsPacked() const { return PackedGuidWriter(*this); }
uint64 GetRawValue() const { return _data._guid; }
HighGuid GetHigh() const
@@ -343,10 +349,9 @@ TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid);
TC_GAME_API ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid);
TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid);
TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, PackedGuidWriter const& guid);
TC_GAME_API ByteBuffer& operator>>(ByteBuffer& buf, PackedGuidReader const& guid);
inline PackedGuid ObjectGuid::WriteAsPacked() const { return PackedGuid(*this); }
namespace std
{
template<>