diff options
author | megamage <none@none> | 2008-12-06 14:01:44 -0600 |
---|---|---|
committer | megamage <none@none> | 2008-12-06 14:01:44 -0600 |
commit | c5593ef779a4ba7bbe9df391bc0defd3bf6c33a1 (patch) | |
tree | ae0cb37bc8f5de0d33bddae95747d7d2162cd8ce /src/game/Object.cpp | |
parent | 72edfea129c244cde9a18b3227f775250197ec99 (diff) |
*Update to Mangos 6880. Source: Mangos.
*Skip 6878, 6871.
*Main change: change cell size, add is3dDistance for IsWithinDistInMap and isVisibleForOrDetect.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r-- | src/game/Object.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp index cc754f32bd3..35a021ac7c7 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1094,14 +1094,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; |