mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[7836] Fixes for distance range checks.
* ignore 0.0f min range limit (this correct case when 2 object overlapped) * typo in CreatureEventAI::CanCast Also use int32 for temporary store GetSessionDbLocaleIndex result.
This commit is contained in:
parent
7a7ee86f97
commit
45b209df50
4 changed files with 25 additions and 13 deletions
|
|
@ -1581,7 +1581,7 @@ bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Trigge
|
|||
return false;
|
||||
|
||||
//Unit is out of range of this spell
|
||||
if (!m_creature->IsInRange(Target,TempRange->minRange,TempRange->minRange))
|
||||
if (!m_creature->IsInRange(Target,TempRange->minRange,TempRange->maxRange))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -540,7 +540,7 @@ void MaNGOS::PlayerSearcher<Check>::Visit(PlayerMapType &m)
|
|||
template<class Builder>
|
||||
void MaNGOS::LocalizedPacketDo<Builder>::operator()( Player* p )
|
||||
{
|
||||
uint32 loc_idx = p->GetSession()->GetSessionDbLocaleIndex();
|
||||
int32 loc_idx = p->GetSession()->GetSessionDbLocaleIndex();
|
||||
uint32 cache_idx = loc_idx+1;
|
||||
WorldPacket* data;
|
||||
|
||||
|
|
@ -565,7 +565,7 @@ void MaNGOS::LocalizedPacketDo<Builder>::operator()( Player* p )
|
|||
template<class Builder>
|
||||
void MaNGOS::LocalizedPacketListDo<Builder>::operator()( Player* p )
|
||||
{
|
||||
uint32 loc_idx = p->GetSession()->GetSessionDbLocaleIndex();
|
||||
int32 loc_idx = p->GetSession()->GetSessionDbLocaleIndex();
|
||||
uint32 cache_idx = loc_idx+1;
|
||||
WorldPacketList* data_list;
|
||||
|
||||
|
|
|
|||
|
|
@ -1207,9 +1207,13 @@ bool WorldObject::IsInRange(WorldObject const* obj, float minRange, float maxRan
|
|||
|
||||
float sizefactor = GetObjectSize() + obj->GetObjectSize();
|
||||
|
||||
// check only for real range
|
||||
if(minRange > 0.0f)
|
||||
{
|
||||
float mindist = minRange + sizefactor;
|
||||
if(distsq < mindist * mindist)
|
||||
return false;
|
||||
}
|
||||
|
||||
float maxdist = maxRange + sizefactor;
|
||||
return distsq < maxdist * maxdist;
|
||||
|
|
@ -1223,9 +1227,13 @@ bool WorldObject::IsInRange2d(float x, float y, float minRange, float maxRange)
|
|||
|
||||
float sizefactor = GetObjectSize();
|
||||
|
||||
// check only for real range
|
||||
if(minRange > 0.0f)
|
||||
{
|
||||
float mindist = minRange + sizefactor;
|
||||
if(distsq < mindist * mindist)
|
||||
return false;
|
||||
}
|
||||
|
||||
float maxdist = maxRange + sizefactor;
|
||||
return distsq < maxdist * maxdist;
|
||||
|
|
@ -1240,9 +1248,13 @@ bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float m
|
|||
|
||||
float sizefactor = GetObjectSize();
|
||||
|
||||
// check only for real range
|
||||
if(minRange > 0.0f)
|
||||
{
|
||||
float mindist = minRange + sizefactor;
|
||||
if(distsq < mindist * mindist)
|
||||
return false;
|
||||
}
|
||||
|
||||
float maxdist = maxRange + sizefactor;
|
||||
return distsq < maxdist * maxdist;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7835"
|
||||
#define REVISION_NR "7836"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue