diff options
| author | megamage <none@none> | 2009-05-14 16:50:47 -0500 |
|---|---|---|
| committer | megamage <none@none> | 2009-05-14 16:50:47 -0500 |
| commit | 047cc95388a67d5f33cb86082bbef03f654acec1 (patch) | |
| tree | 90547d4892aa217a58408b3353fe943dcc51bb7b /src/game/Object.h | |
| parent | 811eee356ddd3c0b486a828b39822daffd8ac97e (diff) | |
*Add some distance check functions. By VladimirMangos.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Object.h')
| -rw-r--r-- | src/game/Object.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/game/Object.h b/src/game/Object.h index 01c31d5b9b4..326b09cfb73 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -461,11 +461,11 @@ class TRINITY_DLL_SPEC WorldObject : public Object virtual const char* GetNameForLocaleIdx(int32 /*locale_idx*/) const { return GetName(); } float GetDistance( const WorldObject* obj ) const; - float GetDistance(const float x, const float y, const float z) const; + float GetDistance(float x, float y, float z) const; float GetDistanceSq(const float &x, const float &y, const float &z) const; float GetDistanceSq(const WorldObject *obj) const; float GetDistance2d(const WorldObject* obj) const; - float GetDistance2d(const float x, const float y) const; + float GetDistance2d(float x, float y) const; float GetExactDistance2d(const float x, const float y) const; float GetDistanceZ(const WorldObject* obj) const; bool IsInMap(const WorldObject* obj) const @@ -473,9 +473,24 @@ class TRINITY_DLL_SPEC WorldObject : public Object return IsInWorld() && obj->IsInWorld() && GetMapId()==obj->GetMapId() && GetInstanceId()==obj->GetInstanceId() && InSamePhase(obj); } - bool IsWithinDistInMap(const WorldObject* obj, const float dist2compare, const bool is3D = true) const; - bool IsWithinLOS(const float x, const float y, const float z ) const; + bool IsWithinDist3d(float x, float y, float z, float dist2compare) const; + bool IsWithinDist2d(float x, float y, float dist2compare) const; + bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D) const; + bool IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D = true) const + // use only if you will sure about placing both object at same map + { + return obj && _IsWithinDist(obj,dist2compare,is3D); + } + bool IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D = true) const + { + return obj && IsInMap(obj) && _IsWithinDist(obj,dist2compare,is3D); + } + bool IsWithinLOS(float x, float y, float z) const; bool IsWithinLOSInMap(const WorldObject* obj) const; + bool GetDistanceOrder(WorldObject const* obj1, WorldObject const* obj2, bool is3D = true) const; + bool IsInRange(WorldObject const* obj, float minRange, float maxRange, bool is3D = true) const; + bool IsInRange2d(float x, float y, float minRange, float maxRange) const; + bool IsInRange3d(float x, float y, float z, float minRange, float maxRange) const; float GetAngle( const WorldObject* obj ) const; float GetAngle( const float x, const float y ) const; |
