mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Merge branch 'master' into 303
Conflicts: src/game/Corpse.cpp src/game/DynamicObject.cpp src/game/GameObject.cpp src/game/Object.h src/game/Unit.cpp src/game/Unit.h
This commit is contained in:
commit
af1e1d7794
13 changed files with 34 additions and 27 deletions
|
|
@ -1105,14 +1105,18 @@ float WorldObject::GetDistanceZ(const WorldObject* obj) const
|
|||
return ( dist > 0 ? dist : 0);
|
||||
}
|
||||
|
||||
bool WorldObject::IsWithinDistInMap(const WorldObject* obj, const float dist2compare) const
|
||||
bool WorldObject::IsWithinDistInMap(const WorldObject* obj, const float dist2compare, const bool is3D) const
|
||||
{
|
||||
if (!obj || !IsInMap(obj)) return false;
|
||||
|
||||
float dx = GetPositionX() - obj->GetPositionX();
|
||||
float dy = GetPositionY() - obj->GetPositionY();
|
||||
float dz = GetPositionZ() - obj->GetPositionZ();
|
||||
float distsq = dx*dx + dy*dy + dz*dz;
|
||||
float distsq = dx*dx + dy*dy;
|
||||
if(is3D)
|
||||
{
|
||||
float dz = GetPositionZ() - obj->GetPositionZ();
|
||||
distsq += dz*dz;
|
||||
}
|
||||
float sizefactor = GetObjectSize() + obj->GetObjectSize();
|
||||
float maxdist = dist2compare + sizefactor;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue