[7829] Rename 3d (x,y,.. versions of IsWithinDist/IsWithinDist functions with adding 3d explict posfix to name for avoid wrong use.

This commit is contained in:
VladimirMangos 2009-05-14 21:40:39 +04:00
parent 42d74d811f
commit 8858aacfb0
8 changed files with 12 additions and 12 deletions

View file

@ -1782,7 +1782,7 @@ bool Creature::IsOutOfThreatArea(Unit* pVictim) const
uint32 ThreatRadius = sWorld.getConfig(CONFIG_THREAT_RADIUS); uint32 ThreatRadius = sWorld.getConfig(CONFIG_THREAT_RADIUS);
//Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and out of combat every update tick. //Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and out of combat every update tick.
return !pVictim->IsWithinDist(CombatStartX,CombatStartY,CombatStartZ, return !pVictim->IsWithinDist3d(CombatStartX,CombatStartY,CombatStartZ,
ThreatRadius > AttackDist ? ThreatRadius : AttackDist); ThreatRadius > AttackDist ? ThreatRadius : AttackDist);
} }

View file

@ -1114,7 +1114,7 @@ float WorldObject::GetDistanceZ(const WorldObject* obj) const
return ( dist > 0 ? dist : 0); return ( dist > 0 ? dist : 0);
} }
bool WorldObject::IsWithinDist(float x, float y, float z, float dist2compare) const bool WorldObject::IsWithinDist3d(float x, float y, float z, float dist2compare) const
{ {
float dx = GetPositionX() - x; float dx = GetPositionX() - x;
float dy = GetPositionY() - y; float dy = GetPositionY() - y;
@ -1231,7 +1231,7 @@ bool WorldObject::IsInRange2d(float x, float y, float minRange, float maxRange)
return distsq < maxdist * maxdist; return distsq < maxdist * maxdist;
} }
bool WorldObject::IsInRange(float x, float y, float z, float minRange, float maxRange) const bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float maxRange) const
{ {
float dx = GetPositionX() - x; float dx = GetPositionX() - x;
float dy = GetPositionY() - y; float dy = GetPositionY() - y;

View file

@ -433,7 +433,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
return IsInWorld() && obj->IsInWorld() && GetMapId()==obj->GetMapId() && return IsInWorld() && obj->IsInWorld() && GetMapId()==obj->GetMapId() &&
GetInstanceId()==obj->GetInstanceId() && InSamePhase(obj); GetInstanceId()==obj->GetInstanceId() && InSamePhase(obj);
} }
bool IsWithinDist(float x, float y, float z, float dist2compare) const; bool IsWithinDist3d(float x, float y, float z, float dist2compare) const;
bool IsWithinDist2d(float x, float y, 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) const;
bool IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D = true) const bool IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D = true) const
@ -450,7 +450,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
bool GetDistanceOrder(WorldObject const* obj1, WorldObject const* obj2, bool is3D = true) 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 IsInRange(WorldObject const* obj, float minRange, float maxRange, bool is3D = true) const;
bool IsInRange2d(float x, float y, float minRange, float maxRange) const; bool IsInRange2d(float x, float y, float minRange, float maxRange) const;
bool IsInRange(float x, float y, float z, 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 WorldObject* obj ) const;
float GetAngle( const float x, const float y ) const; float GetAngle( const float x, const float y ) const;

View file

@ -114,7 +114,7 @@ typedef std::vector<uint32> AutoSpellList;
#define ACTIVE_SPELLS_MAX 4 #define ACTIVE_SPELLS_MAX 4
#define OWNER_MAX_DISTANCE 100 #define OWNER_MAX_DISTANCE 100.0f
#define PET_FOLLOW_DIST 1 #define PET_FOLLOW_DIST 1
#define PET_FOLLOW_ANGLE (M_PI/2) #define PET_FOLLOW_ANGLE (M_PI/2)

View file

@ -1616,7 +1616,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
if (!(options & TELE_TO_NOT_UNSUMMON_PET)) if (!(options & TELE_TO_NOT_UNSUMMON_PET))
{ {
//same map, only remove pet if out of range for new position //same map, only remove pet if out of range for new position
if(pet && !pet->IsWithinDist(x,y,z, OWNER_MAX_DISTANCE)) if(pet && !pet->IsWithinDist3d(x,y,z, OWNER_MAX_DISTANCE))
UnsummonPetTemporaryIfAny(); UnsummonPetTemporaryIfAny();
} }

View file

@ -4689,9 +4689,9 @@ SpellCastResult Spell::CheckRange(bool strict)
if(m_targets.m_targetMask == TARGET_FLAG_DEST_LOCATION && m_targets.m_destX != 0 && m_targets.m_destY != 0 && m_targets.m_destZ != 0) if(m_targets.m_targetMask == TARGET_FLAG_DEST_LOCATION && m_targets.m_destX != 0 && m_targets.m_destY != 0 && m_targets.m_destZ != 0)
{ {
if(!m_caster->IsWithinDist(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ,max_range)) if(!m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ,max_range))
return SPELL_FAILED_OUT_OF_RANGE; return SPELL_FAILED_OUT_OF_RANGE;
if(m_caster->IsWithinDist(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ,min_range)) if(m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ,min_range))
return SPELL_FAILED_TOO_CLOSE; return SPELL_FAILED_TOO_CLOSE;
} }

View file

@ -621,7 +621,7 @@ namespace MaNGOS
if( i_originalCaster->IsFriendlyTo(pPlayer) ) if( i_originalCaster->IsFriendlyTo(pPlayer) )
continue; continue;
if( pPlayer->IsWithinDist(i_spell.m_targets.m_destX, i_spell.m_targets.m_destY, i_spell.m_targets.m_destZ,i_radius)) if( pPlayer->IsWithinDist3d(i_spell.m_targets.m_destX, i_spell.m_targets.m_destY, i_spell.m_targets.m_destZ,i_radius))
i_data.push_back(pPlayer); i_data.push_back(pPlayer);
} }
} }
@ -717,7 +717,7 @@ namespace MaNGOS
i_data->push_back(itr->getSource()); i_data->push_back(itr->getSource());
break; break;
case PUSH_DEST_CENTER: case PUSH_DEST_CENTER:
if(itr->getSource()->IsWithinDist(i_spell.m_targets.m_destX, i_spell.m_targets.m_destY, i_spell.m_targets.m_destZ,i_radius)) if(itr->getSource()->IsWithinDist3d(i_spell.m_targets.m_destX, i_spell.m_targets.m_destY, i_spell.m_targets.m_destZ,i_radius))
i_data->push_back(itr->getSource()); i_data->push_back(itr->getSource());
break; break;
case PUSH_TARGET_CENTER: case PUSH_TARGET_CENTER:

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7828" #define REVISION_NR "7829"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__