From 45df399115bef19925a3e4d9253274d0505b2b8d Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 14 May 2009 21:40:39 +0400 Subject: [PATCH] [7829] Rename 3d (x,y,.. versions of IsWithinDist/IsWithinDist functions with adding 3d explict posfix to name for avoid wrong use. --- src/game/Creature.cpp | 2 +- src/game/Object.cpp | 4 ++-- src/game/Object.h | 4 ++-- src/game/Pet.h | 2 +- src/game/Player.cpp | 2 +- src/game/Spell.cpp | 4 ++-- src/game/Spell.h | 4 ++-- src/shared/revision_nr.h | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 5210ba9a5..0680a14e8 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1782,7 +1782,7 @@ bool Creature::IsOutOfThreatArea(Unit* pVictim) const 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. - return !pVictim->IsWithinDist(CombatStartX,CombatStartY,CombatStartZ, + return !pVictim->IsWithinDist3d(CombatStartX,CombatStartY,CombatStartZ, ThreatRadius > AttackDist ? ThreatRadius : AttackDist); } diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 20601091f..81ff11d97 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1114,7 +1114,7 @@ float WorldObject::GetDistanceZ(const WorldObject* obj) const 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 dy = GetPositionY() - y; @@ -1231,7 +1231,7 @@ bool WorldObject::IsInRange2d(float x, float y, float minRange, float maxRange) 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 dy = GetPositionY() - y; diff --git a/src/game/Object.h b/src/game/Object.h index f77ceeead..b42acbd04 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -433,7 +433,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object return IsInWorld() && obj->IsInWorld() && GetMapId()==obj->GetMapId() && 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 _IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D) 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 IsInRange(WorldObject const* obj, float minRange, float maxRange, bool is3D = true) 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 float x, const float y ) const; diff --git a/src/game/Pet.h b/src/game/Pet.h index e88576438..08c72e31c 100644 --- a/src/game/Pet.h +++ b/src/game/Pet.h @@ -114,7 +114,7 @@ typedef std::vector AutoSpellList; #define ACTIVE_SPELLS_MAX 4 -#define OWNER_MAX_DISTANCE 100 +#define OWNER_MAX_DISTANCE 100.0f #define PET_FOLLOW_DIST 1 #define PET_FOLLOW_ANGLE (M_PI/2) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 35b2cb0e5..131b0310a 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1616,7 +1616,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if (!(options & TELE_TO_NOT_UNSUMMON_PET)) { //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(); } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 82147467c..3c874ee56 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -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_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; - 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; } diff --git a/src/game/Spell.h b/src/game/Spell.h index 402c3c2ff..3ffa368eb 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -621,7 +621,7 @@ namespace MaNGOS if( i_originalCaster->IsFriendlyTo(pPlayer) ) 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); } } @@ -717,7 +717,7 @@ namespace MaNGOS i_data->push_back(itr->getSource()); break; 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()); break; case PUSH_TARGET_CENTER: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 709a95ae9..e701b8f17 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7828" + #define REVISION_NR "7829" #endif // __REVISION_NR_H__ -- 2.11.4.GIT