mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +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
|
|
@ -1207,9 +1207,13 @@ bool WorldObject::IsInRange(WorldObject const* obj, float minRange, float maxRan
|
|||
|
||||
float sizefactor = GetObjectSize() + obj->GetObjectSize();
|
||||
|
||||
float mindist = minRange + sizefactor;
|
||||
if(distsq < mindist * mindist)
|
||||
return false;
|
||||
// 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();
|
||||
|
||||
float mindist = minRange + sizefactor;
|
||||
if(distsq < mindist * mindist)
|
||||
return false;
|
||||
// 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();
|
||||
|
||||
float mindist = minRange + sizefactor;
|
||||
if(distsq < mindist * mindist)
|
||||
return false;
|
||||
// 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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue