mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 13:16:23 +00:00
fix(Core/Misc): Change const to be after type name (#10591)
This commit is contained in:
@@ -1191,7 +1191,7 @@ InstanceScript* WorldObject::GetInstanceScript() const
|
||||
return map->IsDungeon() ? map->ToInstanceMap()->GetInstanceScript() : nullptr;
|
||||
}
|
||||
|
||||
float WorldObject::GetDistanceZ(const WorldObject* obj) const
|
||||
float WorldObject::GetDistanceZ(WorldObject const* obj) const
|
||||
{
|
||||
float dz = std::fabs(GetPositionZ() - obj->GetPositionZ());
|
||||
float sizefactor = GetObjectSize() + obj->GetObjectSize();
|
||||
@@ -1238,7 +1238,7 @@ Position WorldObject::GetHitSpherePointFor(Position const& dest) const
|
||||
return Position(contactPoint.x, contactPoint.y, contactPoint.z, GetAngle(contactPoint.x, contactPoint.y));
|
||||
}
|
||||
|
||||
float WorldObject::GetDistance(const WorldObject* obj) const
|
||||
float WorldObject::GetDistance(WorldObject const* obj) const
|
||||
{
|
||||
float d = GetExactDist(obj) - GetObjectSize() - obj->GetObjectSize();
|
||||
return d > 0.0f ? d : 0.0f;
|
||||
@@ -1256,7 +1256,7 @@ float WorldObject::GetDistance(const WorldObject* obj) const
|
||||
return d > 0.0f ? d : 0.0f;
|
||||
}
|
||||
|
||||
float WorldObject::GetDistance2d(const WorldObject* obj) const
|
||||
float WorldObject::GetDistance2d(WorldObject const* obj) const
|
||||
{
|
||||
float d = GetExactDist2d(obj) - GetObjectSize() - obj->GetObjectSize();
|
||||
return d > 0.0f ? d : 0.0f;
|
||||
@@ -1268,7 +1268,7 @@ float WorldObject::GetDistance2d(const WorldObject* obj) const
|
||||
return d > 0.0f ? d : 0.0f;
|
||||
}
|
||||
|
||||
bool WorldObject::IsSelfOrInSameMap(const WorldObject* obj) const
|
||||
bool WorldObject::IsSelfOrInSameMap(WorldObject const* obj) const
|
||||
{
|
||||
if (this == obj)
|
||||
{
|
||||
@@ -1278,7 +1278,7 @@ bool WorldObject::IsSelfOrInSameMap(const WorldObject* obj) const
|
||||
return IsInMap(obj);
|
||||
}
|
||||
|
||||
bool WorldObject::IsInMap(const WorldObject* obj) const
|
||||
bool WorldObject::IsInMap(WorldObject const* obj) const
|
||||
{
|
||||
if (obj)
|
||||
{
|
||||
@@ -1340,7 +1340,7 @@ bool WorldObject::IsWithinLOS(float ox, float oy, float oz, LineOfSightChecks ch
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WorldObject::IsWithinLOSInMap(const WorldObject* obj, LineOfSightChecks checks) const
|
||||
bool WorldObject::IsWithinLOSInMap(WorldObject const* obj, LineOfSightChecks checks) const
|
||||
{
|
||||
if (!IsInMap(obj))
|
||||
return false;
|
||||
@@ -1463,7 +1463,7 @@ bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float m
|
||||
return distsq < maxdist * maxdist;
|
||||
}
|
||||
|
||||
bool WorldObject::IsInBetween(const WorldObject* obj1, const WorldObject* obj2, float size) const
|
||||
bool WorldObject::IsInBetween(WorldObject const* obj1, WorldObject const* obj2, float size) const
|
||||
{
|
||||
if (!obj1 || !obj2)
|
||||
return false;
|
||||
@@ -1665,7 +1665,7 @@ float WorldObject::GetVisibilityRange() const
|
||||
return IsInWintergrasp() ? VISIBILITY_DIST_WINTERGRASP : GetMap()->GetVisibilityRange();
|
||||
}
|
||||
|
||||
float WorldObject::GetSightRange(const WorldObject* target) const
|
||||
float WorldObject::GetSightRange(WorldObject const* target) const
|
||||
{
|
||||
if (ToUnit())
|
||||
{
|
||||
@@ -1756,7 +1756,7 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
|
||||
|
||||
// pussywizard: arena spectator
|
||||
if (obj->GetTypeId() == TYPEID_PLAYER)
|
||||
if (((const Player*)obj)->IsSpectator() && ((const Player*)obj)->FindMap()->IsBattleArena())
|
||||
if (((Player const*)obj)->IsSpectator() && ((Player const*)obj)->FindMap()->IsBattleArena())
|
||||
return false;
|
||||
|
||||
bool corpseVisibility = false;
|
||||
@@ -1841,7 +1841,7 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
|
||||
|
||||
// pussywizard: arena spectator
|
||||
if (this->GetTypeId() == TYPEID_PLAYER)
|
||||
if (((const Player*)this)->IsSpectator() && ((const Player*)this)->FindMap()->IsBattleArena() && (obj->m_invisibility.GetFlags() || obj->m_stealth.GetFlags()))
|
||||
if (((Player const*)this)->IsSpectator() && ((Player const*)this)->FindMap()->IsBattleArena() && (obj->m_invisibility.GetFlags() || obj->m_stealth.GetFlags()))
|
||||
return false;
|
||||
|
||||
if (!CanDetect(obj, ignoreStealth, !distanceCheck, checkAlert))
|
||||
@@ -1859,10 +1859,10 @@ bool WorldObject::CanNeverSee(WorldObject const* obj) const
|
||||
|
||||
bool WorldObject::CanDetect(WorldObject const* obj, bool ignoreStealth, bool checkClient, bool checkAlert) const
|
||||
{
|
||||
const WorldObject* seer = this;
|
||||
WorldObject const* seer = this;
|
||||
|
||||
// Pets don't have detection, they use the detection of their masters
|
||||
if (const Unit* thisUnit = ToUnit())
|
||||
if (Unit const* thisUnit = ToUnit())
|
||||
if (Unit* controller = thisUnit->GetCharmerOrOwner())
|
||||
seer = controller;
|
||||
|
||||
@@ -2619,7 +2619,7 @@ void WorldObject::GetVoidClosePoint(float& x, float& y, float& z, float size, fl
|
||||
GetNearPoint(nullptr, x, y, z, size, distance2d, GetOrientation() + relAngle, controlZ);
|
||||
}
|
||||
|
||||
bool WorldObject::GetClosePoint(float& x, float& y, float& z, float size, float distance2d, float angle, const WorldObject* forWho, bool force) const
|
||||
bool WorldObject::GetClosePoint(float& x, float& y, float& z, float size, float distance2d, float angle, WorldObject const* forWho, bool force) const
|
||||
{
|
||||
// angle calculated from current orientation
|
||||
GetNearPoint(forWho, x, y, z, size, distance2d, GetOrientation() + angle);
|
||||
@@ -2630,7 +2630,7 @@ bool WorldObject::GetClosePoint(float& x, float& y, float& z, float size, float
|
||||
y = this->GetPositionY();
|
||||
z = this->GetPositionZ();
|
||||
if (forWho)
|
||||
if (const Unit* u = forWho->ToUnit())
|
||||
if (Unit const* u = forWho->ToUnit())
|
||||
u->UpdateAllowedPositionZ(x, y, z);
|
||||
}
|
||||
float maxDist = GetObjectSize() + size + distance2d + 1.0f;
|
||||
@@ -2662,7 +2662,7 @@ Position WorldObject::GetRandomNearPosition(float radius)
|
||||
return pos;
|
||||
}
|
||||
|
||||
void WorldObject::GetContactPoint(const WorldObject* obj, float& x, float& y, float& z, float distance2d) const
|
||||
void WorldObject::GetContactPoint(WorldObject const* obj, float& x, float& y, float& z, float distance2d) const
|
||||
{
|
||||
// angle to face `obj` to `this` using distance includes size of `obj`
|
||||
GetNearPoint(obj, x, y, z, obj->GetObjectSize(), distance2d, GetAngle(obj));
|
||||
@@ -2677,7 +2677,7 @@ void WorldObject::GetContactPoint(const WorldObject* obj, float& x, float& y, fl
|
||||
}
|
||||
}
|
||||
|
||||
void WorldObject::GetChargeContactPoint(const WorldObject* obj, float& x, float& y, float& z, float distance2d) const
|
||||
void WorldObject::GetChargeContactPoint(WorldObject const* obj, float& x, float& y, float& z, float distance2d) const
|
||||
{
|
||||
// angle to face `obj` to `this` using distance includes size of `obj`
|
||||
GetNearPoint(obj, x, y, z, obj->GetObjectSize(), distance2d, GetAngle(obj));
|
||||
|
||||
@@ -185,9 +185,9 @@ public:
|
||||
[[nodiscard]] Creature const* ToCreature() const { if (GetTypeId() == TYPEID_UNIT) return (Creature const*)((Creature*)this); else return nullptr; }
|
||||
|
||||
Unit* ToUnit() { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Unit*>(this); else return nullptr; }
|
||||
[[nodiscard]] Unit const* ToUnit() const { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return (const Unit*)((Unit*)this); else return nullptr; }
|
||||
[[nodiscard]] Unit const* ToUnit() const { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return (Unit const*)((Unit*)this); else return nullptr; }
|
||||
GameObject* ToGameObject() { if (GetTypeId() == TYPEID_GAMEOBJECT) return reinterpret_cast<GameObject*>(this); else return nullptr; }
|
||||
[[nodiscard]] GameObject const* ToGameObject() const { if (GetTypeId() == TYPEID_GAMEOBJECT) return (const GameObject*)((GameObject*)this); else return nullptr; }
|
||||
[[nodiscard]] GameObject const* ToGameObject() const { if (GetTypeId() == TYPEID_GAMEOBJECT) return (GameObject const*)((GameObject*)this); else return nullptr; }
|
||||
|
||||
Corpse* ToCorpse() { if (GetTypeId() == TYPEID_CORPSE) return reinterpret_cast<Corpse*>(this); else return nullptr; }
|
||||
[[nodiscard]] Corpse const* ToCorpse() const { if (GetTypeId() == TYPEID_CORPSE) return (const Corpse*)((Corpse*)this); else return nullptr; }
|
||||
@@ -392,7 +392,7 @@ public:
|
||||
void GetNearPoint2D(float& x, float& y, float distance, float absAngle, Position const* startPos = nullptr) const;
|
||||
void GetNearPoint(WorldObject const* searcher, float& x, float& y, float& z, float searcher_size, float distance2d, float absAngle, float controlZ = 0, Position const* startPos = nullptr) const;
|
||||
void GetVoidClosePoint(float& x, float& y, float& z, float size, float distance2d = 0, float relAngle = 0, float controlZ = 0) const;
|
||||
bool GetClosePoint(float& x, float& y, float& z, float size, float distance2d = 0, float angle = 0, const WorldObject* forWho = nullptr, bool force = false) const;
|
||||
bool GetClosePoint(float& x, float& y, float& z, float size, float distance2d = 0, float angle = 0, WorldObject const* forWho = nullptr, bool force = false) const;
|
||||
void MovePosition(Position& pos, float dist, float angle);
|
||||
Position GetNearPosition(float dist, float angle);
|
||||
void MovePositionToFirstCollision(Position& pos, float dist, float angle);
|
||||
@@ -401,8 +401,8 @@ public:
|
||||
Position GetFirstCollisionPosition(float dist, float angle);
|
||||
Position GetRandomNearPosition(float radius);
|
||||
|
||||
void GetContactPoint(const WorldObject* obj, float& x, float& y, float& z, float distance2d = CONTACT_DISTANCE) const;
|
||||
void GetChargeContactPoint(const WorldObject* obj, float& x, float& y, float& z, float distance2d = CONTACT_DISTANCE) const;
|
||||
void GetContactPoint(WorldObject const* obj, float& x, float& y, float& z, float distance2d = CONTACT_DISTANCE) const;
|
||||
void GetChargeContactPoint(WorldObject const* obj, float& x, float& y, float& z, float distance2d = CONTACT_DISTANCE) const;
|
||||
|
||||
[[nodiscard]] float GetObjectSize() const;
|
||||
|
||||
@@ -433,15 +433,15 @@ public:
|
||||
|
||||
[[nodiscard]] virtual std::string const& GetNameForLocaleIdx(LocaleConstant /*locale_idx*/) const { return m_name; }
|
||||
|
||||
float GetDistance(const WorldObject* obj) const;
|
||||
float GetDistance(WorldObject const* obj) const;
|
||||
[[nodiscard]] float GetDistance(const Position& pos) const;
|
||||
[[nodiscard]] float GetDistance(float x, float y, float z) const;
|
||||
float GetDistance2d(const WorldObject* obj) const;
|
||||
float GetDistance2d(WorldObject const* obj) const;
|
||||
[[nodiscard]] float GetDistance2d(float x, float y) const;
|
||||
float GetDistanceZ(const WorldObject* obj) const;
|
||||
float GetDistanceZ(WorldObject const* obj) const;
|
||||
|
||||
bool IsSelfOrInSameMap(const WorldObject* obj) const;
|
||||
bool IsInMap(const WorldObject* obj) const;
|
||||
bool IsSelfOrInSameMap(WorldObject const* obj) const;
|
||||
bool IsInMap(WorldObject const* obj) const;
|
||||
[[nodiscard]] bool IsWithinDist3d(float x, float y, float z, float dist) const;
|
||||
bool IsWithinDist3d(const Position* pos, float dist) const;
|
||||
[[nodiscard]] bool IsWithinDist2d(float x, float y, float dist) const;
|
||||
@@ -460,7 +460,7 @@ public:
|
||||
bool isInFront(WorldObject const* target, float arc = M_PI) const;
|
||||
bool isInBack(WorldObject const* target, float arc = M_PI) const;
|
||||
|
||||
bool IsInBetween(const WorldObject* obj1, const WorldObject* obj2, float size = 0) const;
|
||||
bool IsInBetween(WorldObject const* obj1, WorldObject const* obj2, float size = 0) const;
|
||||
|
||||
virtual void CleanupsBeforeDelete(bool finalCleanup = true); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units
|
||||
|
||||
@@ -481,7 +481,7 @@ public:
|
||||
|
||||
[[nodiscard]] float GetGridActivationRange() const;
|
||||
[[nodiscard]] float GetVisibilityRange() const;
|
||||
virtual float GetSightRange(const WorldObject* target = nullptr) const;
|
||||
virtual float GetSightRange(WorldObject const* target = nullptr) const;
|
||||
//bool CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth = false, bool distanceCheck = false) const;
|
||||
bool CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth = false, bool distanceCheck = false, bool checkAlert = false) const;
|
||||
|
||||
@@ -663,13 +663,13 @@ namespace Acore
|
||||
class ObjectDistanceOrderPred
|
||||
{
|
||||
public:
|
||||
ObjectDistanceOrderPred(const WorldObject* pRefObj, bool ascending = true) : m_refObj(pRefObj), m_ascending(ascending) {}
|
||||
bool operator()(const WorldObject* pLeft, const WorldObject* pRight) const
|
||||
ObjectDistanceOrderPred(WorldObject const* pRefObj, bool ascending = true) : m_refObj(pRefObj), m_ascending(ascending) {}
|
||||
bool operator()(WorldObject const* pLeft, WorldObject const* pRight) const
|
||||
{
|
||||
return m_ascending ? m_refObj->GetDistanceOrder(pLeft, pRight) : !m_refObj->GetDistanceOrder(pLeft, pRight);
|
||||
}
|
||||
private:
|
||||
const WorldObject* m_refObj;
|
||||
WorldObject const* m_refObj;
|
||||
const bool m_ascending;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user