diff options
author | Shauren <shauren.trinity@gmail.com> | 2025-09-29 22:01:40 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2025-09-29 22:56:35 +0200 |
commit | 5ef99978c03eb5cc7d40c1f1a1cc4e5c78f8ea27 (patch) | |
tree | 230d706c5738136329af74047f8e874c214ccce9 /src/server/game/Entities/Object | |
parent | bc7be2a08438a1d327586d4a57d4e99944b86418 (diff) |
Core/Misc: Reduce differences between branches3.3.5
Diffstat (limited to 'src/server/game/Entities/Object')
-rw-r--r-- | src/server/game/Entities/Object/Object.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Entities/Object/ObjectGuid.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Entities/Object/ObjectGuid.h | 29 |
3 files changed, 14 insertions, 19 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 6b02a990fa1..e825af8c4dd 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1101,7 +1101,7 @@ bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool Position const* thisOrTransport = this; Position const* objOrObjTransport = obj; - if (GetTransport() && obj->GetTransport() && obj->GetTransport()->GetGUID().GetCounter() == GetTransport()->GetGUID().GetCounter()) + if (GetTransport() && obj->GetTransport() && obj->GetTransport()->GetGUID() == GetTransport()->GetGUID()) { thisOrTransport = &m_movementInfo.transport.pos; objOrObjTransport = &obj->m_movementInfo.transport.pos; diff --git a/src/server/game/Entities/Object/ObjectGuid.cpp b/src/server/game/Entities/Object/ObjectGuid.cpp index 959be366409..cb0f4e5ab4d 100644 --- a/src/server/game/Entities/Object/ObjectGuid.cpp +++ b/src/server/game/Entities/Object/ObjectGuid.cpp @@ -151,7 +151,7 @@ ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid) ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid) { - guid.Set(buf.read<uint64>()); + guid.SetRawValue(buf.read<uint64>()); return buf; } diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h index e17e4c98a38..4c26d2a87cd 100644 --- a/src/server/game/Entities/Object/ObjectGuid.h +++ b/src/server/game/Entities/Object/ObjectGuid.h @@ -144,18 +144,17 @@ class TC_GAME_API ObjectGuid ObjectGuid(HighGuid hi, uint32 entry, LowType counter) : _guid(counter ? uint64(counter) | (uint64(entry) << 24) | (uint64(hi) << 48) : 0) { } ObjectGuid(HighGuid hi, LowType counter) : _guid(counter ? uint64(counter) | (uint64(hi) << 48) : 0) { } - operator uint64() const { return _guid; } PackedGuidReader ReadAsPacked() { return PackedGuidReader(*this); } - void Set(uint64 guid) { _guid = guid; } + uint64 GetRawValue() const { return _guid; } + void SetRawValue(uint64 guid) { _guid = guid; } void Clear() { _guid = 0; } PackedGuidWriter WriteAsPacked() const { return PackedGuidWriter(*this); } - uint64 GetRawValue() const { return _guid; } HighGuid GetHigh() const { return HighGuid((_guid >> 48) & 0x0000FFFF); } - uint32 GetEntry() const { return HasEntry() ? uint32((_guid >> 24) & UI64LIT(0x0000000000FFFFFF)) : 0; } - LowType GetCounter() const + uint32 GetEntry() const { return HasEntry() ? uint32((_guid >> 24) & UI64LIT(0x0000000000FFFFFF)) : 0; } + LowType GetCounter() const { return HasEntry() ? LowType(_guid & UI64LIT(0x0000000000FFFFFF)) @@ -169,7 +168,7 @@ class TC_GAME_API ObjectGuid : LowType(0xFFFFFFFF); } - ObjectGuid::LowType GetMaxCounter() const { return GetMaxCounter(GetHigh()); } + LowType GetMaxCounter() const { return GetMaxCounter(GetHigh()); } bool IsEmpty() const { return _guid == 0; } bool IsCreature() const { return GetHigh() == HighGuid::Unit; } @@ -263,7 +262,7 @@ using GuidList = std::list<ObjectGuid>; using GuidVector = std::vector<ObjectGuid>; using GuidUnorderedSet = std::unordered_set<ObjectGuid>; -// minimum buffer size for packed guid is 9 bytes +// maximum buffer size for packed guid is 9 bytes #define PACKED_GUID_MIN_BUFFER_SIZE 9 class TC_GAME_API PackedGuid @@ -307,18 +306,14 @@ 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); -namespace std +template<> +struct std::hash<ObjectGuid> { - template<> - struct hash<ObjectGuid> + size_t operator()(ObjectGuid const& key) const noexcept { - public: - size_t operator()(ObjectGuid const& key) const - { - return std::hash<uint64>()(key.GetRawValue()); - } - }; -} + return std::hash<uint64>()(key.GetRawValue()); + } +}; namespace fmt { |