mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 22:26:22 +00:00
refactor(Core): apply clang-tidy modernize-* (#9975)
Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
@@ -101,7 +101,7 @@ public:
|
||||
[[nodiscard]] uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
|
||||
void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); }
|
||||
|
||||
float GetObjectScale() const { return GetFloatValue(OBJECT_FIELD_SCALE_X); }
|
||||
[[nodiscard]] float GetObjectScale() const { return GetFloatValue(OBJECT_FIELD_SCALE_X); }
|
||||
virtual void SetObjectScale(float scale) { SetFloatValue(OBJECT_FIELD_SCALE_X, scale); }
|
||||
|
||||
[[nodiscard]] TypeID GetTypeId() const { return m_objectTypeId; }
|
||||
@@ -375,26 +375,26 @@ struct Position
|
||||
return dx*dx + dy*dy;
|
||||
}
|
||||
|
||||
float GetExactDist2dSq(Position const& pos) const { return GetExactDist2dSq(pos.m_positionX, pos.m_positionY); }
|
||||
[[nodiscard]] float GetExactDist2dSq(Position const& pos) const { return GetExactDist2dSq(pos.m_positionX, pos.m_positionY); }
|
||||
float GetExactDist2dSq(Position const* pos) const { return GetExactDist2dSq(*pos); }
|
||||
float GetExactDist2d(const float x, const float y) const { return std::sqrt(GetExactDist2dSq(x, y)); }
|
||||
float GetExactDist2d(Position const& pos) const { return GetExactDist2d(pos.m_positionX, pos.m_positionY); }
|
||||
[[nodiscard]] float GetExactDist2d(const float x, const float y) const { return std::sqrt(GetExactDist2dSq(x, y)); }
|
||||
[[nodiscard]] float GetExactDist2d(Position const& pos) const { return GetExactDist2d(pos.m_positionX, pos.m_positionY); }
|
||||
float GetExactDist2d(Position const* pos) const { return GetExactDist2d(*pos); }
|
||||
|
||||
float GetExactDistSq(float x, float y, float z) const
|
||||
[[nodiscard]] float GetExactDistSq(float x, float y, float z) const
|
||||
{
|
||||
float dz = z - m_positionZ;
|
||||
return GetExactDist2dSq(x, y) + dz*dz;
|
||||
}
|
||||
|
||||
float GetExactDistSq(Position const& pos) const { return GetExactDistSq(pos.m_positionX, pos.m_positionY, pos.m_positionZ); }
|
||||
[[nodiscard]] float GetExactDistSq(Position const& pos) const { return GetExactDistSq(pos.m_positionX, pos.m_positionY, pos.m_positionZ); }
|
||||
float GetExactDistSq(Position const* pos) const { return GetExactDistSq(*pos); }
|
||||
float GetExactDist(float x, float y, float z) const { return std::sqrt(GetExactDistSq(x, y, z)); }
|
||||
float GetExactDist(Position const& pos) const { return GetExactDist(pos.m_positionX, pos.m_positionY, pos.m_positionZ); }
|
||||
[[nodiscard]] float GetExactDist(float x, float y, float z) const { return std::sqrt(GetExactDistSq(x, y, z)); }
|
||||
[[nodiscard]] float GetExactDist(Position const& pos) const { return GetExactDist(pos.m_positionX, pos.m_positionY, pos.m_positionZ); }
|
||||
float GetExactDist(Position const* pos) const { return GetExactDist(*pos); }
|
||||
|
||||
void GetPositionOffsetTo(const Position& endPos, Position& retOffset) const;
|
||||
Position GetPositionWithOffset(Position const& offset) const;
|
||||
[[nodiscard]] Position GetPositionWithOffset(Position const& offset) const;
|
||||
|
||||
float GetAngle(const Position* pos) const;
|
||||
[[nodiscard]] float GetAngle(float x, float y) const;
|
||||
@@ -413,7 +413,7 @@ struct Position
|
||||
return GetAngle(pos) - m_orientation;
|
||||
}
|
||||
[[nodiscard]] float GetRelativeAngle(float x, float y) const { return GetAngle(x, y) - m_orientation; }
|
||||
float ToAbsoluteAngle(float relAngle) const { return NormalizeOrientation(relAngle + m_orientation); }
|
||||
[[nodiscard]] float ToAbsoluteAngle(float relAngle) const { return NormalizeOrientation(relAngle + m_orientation); }
|
||||
|
||||
void GetSinCos(float x, float y, float& vsin, float& vcos) const;
|
||||
|
||||
@@ -655,7 +655,7 @@ class MovableMapObject
|
||||
template<class T> friend class RandomMovementGenerator;
|
||||
|
||||
protected:
|
||||
MovableMapObject() {}
|
||||
MovableMapObject() = default;
|
||||
|
||||
private:
|
||||
[[nodiscard]] Cell const& GetCurrentCell() const { return _currentCell; }
|
||||
@@ -702,7 +702,7 @@ public:
|
||||
void UpdateAllowedPositionZ(float x, float y, float& z, float* groundZ = nullptr) const;
|
||||
|
||||
void GetRandomPoint(const Position& srcPos, float distance, float& rand_x, float& rand_y, float& rand_z) const;
|
||||
Position GetRandomPoint(const Position& srcPos, float distance) const;
|
||||
[[nodiscard]] Position GetRandomPoint(const Position& srcPos, float distance) const;
|
||||
|
||||
[[nodiscard]] uint32 GetInstanceId() const { return m_InstanceId; }
|
||||
|
||||
@@ -715,9 +715,9 @@ public:
|
||||
[[nodiscard]] uint32 GetAreaId() const;
|
||||
void GetZoneAndAreaId(uint32& zoneid, uint32& areaid) const;
|
||||
[[nodiscard]] bool IsOutdoors() const;
|
||||
LiquidData const& GetLiquidData() const;
|
||||
[[nodiscard]] LiquidData const& GetLiquidData() const;
|
||||
|
||||
InstanceScript* GetInstanceScript() const;
|
||||
[[nodiscard]] InstanceScript* GetInstanceScript() const;
|
||||
|
||||
[[nodiscard]] std::string const& GetName() const { return m_name; }
|
||||
void SetName(std::string const& newname) { m_name = newname; }
|
||||
|
||||
@@ -129,7 +129,7 @@ class ObjectGuid
|
||||
template<HighGuid type>
|
||||
static typename std::enable_if<ObjectGuidTraits<type>::MapSpecific, ObjectGuid>::type Create(uint32 entry, LowType counter) { return MapSpecific(type, entry, counter); }
|
||||
|
||||
ObjectGuid() : _guid(0) { }
|
||||
ObjectGuid() = default;
|
||||
explicit ObjectGuid(uint64 guid) : _guid(guid) { }
|
||||
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) { }
|
||||
@@ -139,12 +139,12 @@ class ObjectGuid
|
||||
void Set(uint64 guid) { _guid = guid; }
|
||||
void Clear() { _guid = 0; }
|
||||
|
||||
PackedGuid WriteAsPacked() const;
|
||||
[[nodiscard]] PackedGuid WriteAsPacked() const;
|
||||
|
||||
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
|
||||
[[nodiscard]] uint64 GetRawValue() const { return _guid; }
|
||||
[[nodiscard]] HighGuid GetHigh() const { return HighGuid((_guid >> 48) & 0x0000FFFF); }
|
||||
[[nodiscard]] uint32 GetEntry() const { return HasEntry() ? uint32((_guid >> 24) & UI64LIT(0x0000000000FFFFFF)) : 0; }
|
||||
[[nodiscard]] LowType GetCounter() const
|
||||
{
|
||||
return HasEntry()
|
||||
? LowType(_guid & UI64LIT(0x0000000000FFFFFF))
|
||||
@@ -158,26 +158,26 @@ class ObjectGuid
|
||||
: LowType(0xFFFFFFFF);
|
||||
}
|
||||
|
||||
ObjectGuid::LowType GetMaxCounter() const { return GetMaxCounter(GetHigh()); }
|
||||
[[nodiscard]] ObjectGuid::LowType GetMaxCounter() const { return GetMaxCounter(GetHigh()); }
|
||||
|
||||
bool IsEmpty() const { return _guid == 0; }
|
||||
bool IsCreature() const { return GetHigh() == HighGuid::Unit; }
|
||||
bool IsPet() const { return GetHigh() == HighGuid::Pet; }
|
||||
bool IsVehicle() const { return GetHigh() == HighGuid::Vehicle; }
|
||||
bool IsCreatureOrPet() const { return IsCreature() || IsPet(); }
|
||||
bool IsCreatureOrVehicle() const { return IsCreature() || IsVehicle(); }
|
||||
bool IsAnyTypeCreature() const { return IsCreature() || IsPet() || IsVehicle(); }
|
||||
bool IsPlayer() const { return !IsEmpty() && GetHigh() == HighGuid::Player; }
|
||||
bool IsUnit() const { return IsAnyTypeCreature() || IsPlayer(); }
|
||||
bool IsItem() const { return GetHigh() == HighGuid::Item; }
|
||||
bool IsGameObject() const { return GetHigh() == HighGuid::GameObject; }
|
||||
bool IsDynamicObject() const { return GetHigh() == HighGuid::DynamicObject; }
|
||||
bool IsCorpse() const { return GetHigh() == HighGuid::Corpse; }
|
||||
bool IsTransport() const { return GetHigh() == HighGuid::Transport; }
|
||||
bool IsMOTransport() const { return GetHigh() == HighGuid::Mo_Transport; }
|
||||
bool IsAnyTypeGameObject() const { return IsGameObject() || IsTransport() || IsMOTransport(); }
|
||||
bool IsInstance() const { return GetHigh() == HighGuid::Instance; }
|
||||
bool IsGroup() const { return GetHigh() == HighGuid::Group; }
|
||||
[[nodiscard]] bool IsEmpty() const { return _guid == 0; }
|
||||
[[nodiscard]] bool IsCreature() const { return GetHigh() == HighGuid::Unit; }
|
||||
[[nodiscard]] bool IsPet() const { return GetHigh() == HighGuid::Pet; }
|
||||
[[nodiscard]] bool IsVehicle() const { return GetHigh() == HighGuid::Vehicle; }
|
||||
[[nodiscard]] bool IsCreatureOrPet() const { return IsCreature() || IsPet(); }
|
||||
[[nodiscard]] bool IsCreatureOrVehicle() const { return IsCreature() || IsVehicle(); }
|
||||
[[nodiscard]] bool IsAnyTypeCreature() const { return IsCreature() || IsPet() || IsVehicle(); }
|
||||
[[nodiscard]] bool IsPlayer() const { return !IsEmpty() && GetHigh() == HighGuid::Player; }
|
||||
[[nodiscard]] bool IsUnit() const { return IsAnyTypeCreature() || IsPlayer(); }
|
||||
[[nodiscard]] bool IsItem() const { return GetHigh() == HighGuid::Item; }
|
||||
[[nodiscard]] bool IsGameObject() const { return GetHigh() == HighGuid::GameObject; }
|
||||
[[nodiscard]] bool IsDynamicObject() const { return GetHigh() == HighGuid::DynamicObject; }
|
||||
[[nodiscard]] bool IsCorpse() const { return GetHigh() == HighGuid::Corpse; }
|
||||
[[nodiscard]] bool IsTransport() const { return GetHigh() == HighGuid::Transport; }
|
||||
[[nodiscard]] bool IsMOTransport() const { return GetHigh() == HighGuid::Mo_Transport; }
|
||||
[[nodiscard]] bool IsAnyTypeGameObject() const { return IsGameObject() || IsTransport() || IsMOTransport(); }
|
||||
[[nodiscard]] bool IsInstance() const { return GetHigh() == HighGuid::Instance; }
|
||||
[[nodiscard]] bool IsGroup() const { return GetHigh() == HighGuid::Group; }
|
||||
|
||||
static TypeID GetTypeId(HighGuid high)
|
||||
{
|
||||
@@ -200,7 +200,7 @@ class ObjectGuid
|
||||
}
|
||||
}
|
||||
|
||||
TypeID GetTypeId() const { return GetTypeId(GetHigh()); }
|
||||
[[nodiscard]] TypeID GetTypeId() const { return GetTypeId(GetHigh()); }
|
||||
|
||||
operator bool() const { return !IsEmpty(); }
|
||||
bool operator!() const { return !(bool(*this)); }
|
||||
@@ -210,8 +210,8 @@ class ObjectGuid
|
||||
bool operator<= (ObjectGuid const& guid) const { return GetRawValue() <= guid.GetRawValue(); }
|
||||
|
||||
static char const* GetTypeName(HighGuid high);
|
||||
char const* GetTypeName() const { return !IsEmpty() ? GetTypeName(GetHigh()) : "None"; }
|
||||
std::string ToString() const;
|
||||
[[nodiscard]] char const* GetTypeName() const { return !IsEmpty() ? GetTypeName(GetHigh()) : "None"; }
|
||||
[[nodiscard]] std::string ToString() const;
|
||||
|
||||
private:
|
||||
static bool HasEntry(HighGuid high)
|
||||
@@ -236,7 +236,7 @@ class ObjectGuid
|
||||
}
|
||||
}
|
||||
|
||||
bool HasEntry() const { return HasEntry(GetHigh()); }
|
||||
[[nodiscard]] bool HasEntry() const { return HasEntry(GetHigh()); }
|
||||
|
||||
static ObjectGuid Global(HighGuid type, LowType counter);
|
||||
static ObjectGuid MapSpecific(HighGuid type, uint32 entry, LowType counter);
|
||||
@@ -248,7 +248,7 @@ class ObjectGuid
|
||||
// used to catch wrong type assignment
|
||||
operator int64() const = delete;
|
||||
|
||||
uint64 _guid;
|
||||
uint64 _guid{0};
|
||||
};
|
||||
|
||||
// Some Shared defines
|
||||
@@ -273,7 +273,7 @@ class PackedGuid
|
||||
void Set(uint64 guid) { _packedGuid.wpos(0); _packedGuid.appendPackGUID(guid); }
|
||||
void Set(ObjectGuid guid) { _packedGuid.wpos(0); _packedGuid.appendPackGUID(guid.GetRawValue()); }
|
||||
|
||||
std::size_t size() const { return _packedGuid.size(); }
|
||||
[[nodiscard]] std::size_t size() const { return _packedGuid.size(); }
|
||||
|
||||
private:
|
||||
ByteBuffer _packedGuid;
|
||||
@@ -286,8 +286,8 @@ public:
|
||||
|
||||
virtual void Set(ObjectGuid::LowType val) { _nextGuid = val; }
|
||||
virtual ObjectGuid::LowType Generate() = 0;
|
||||
ObjectGuid::LowType GetNextAfterMaxUsed() const { return _nextGuid; }
|
||||
virtual ~ObjectGuidGeneratorBase() { }
|
||||
[[nodiscard]] ObjectGuid::LowType GetNextAfterMaxUsed() const { return _nextGuid; }
|
||||
virtual ~ObjectGuidGeneratorBase() = default;
|
||||
|
||||
protected:
|
||||
static void HandleCounterOverflow(HighGuid high);
|
||||
|
||||
@@ -33,9 +33,9 @@ public:
|
||||
CLIENT_UPDATE_MASK_BITS = sizeof(ClientUpdateMaskType) * 8,
|
||||
};
|
||||
|
||||
UpdateMask() { }
|
||||
UpdateMask() = default;
|
||||
|
||||
UpdateMask(UpdateMask const& right) : _bits(nullptr)
|
||||
UpdateMask(UpdateMask const& right)
|
||||
{
|
||||
SetCount(right.GetCount());
|
||||
memcpy(_bits, right._bits, sizeof(uint8) * _blockCount * 32);
|
||||
|
||||
Reference in New Issue
Block a user