aboutsummaryrefslogtreecommitdiff
path: root/src/game/Object.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-28 15:49:23 -0500
committermegamage <none@none>2009-05-28 15:49:23 -0500
commit4a7a63e4388baceb4ada57f978fc2dbd303c8213 (patch)
tree617a16465537f5c6c0b0374234e5db6ba729abf2 /src/game/Object.cpp
parent05011544dff19e5be0bcc06858ac0f74c1f44f75 (diff)
*Add an errorlog in HasInArc function to find a bug.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r--src/game/Object.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 204d654d000..46a824b99c7 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -1387,8 +1387,6 @@ float WorldObject::GetAngle( const float x, const float y ) const
float dx = x - GetPositionX();
float dy = y - GetPositionY();
- if(!dx && !dy)
- return 0;
float ang = atan2(dy, dx);
ang = (ang >= 0) ? ang : 2 * M_PI + ang;
return ang;
@@ -1430,6 +1428,15 @@ bool WorldObject::HasInArc(const float arcangle, const WorldObject* obj) const
float angle = GetAngle( obj );
angle -= m_orientation;
+ if(angle > 100 || angle < -100)
+ {
+ sLog.outCrash("Invalid Angle %f: this %u %u %f %f %f %f, that %u %u %f %f %f %f", angle,
+ GetEntry(), GetGUIDLow(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation(),
+ obj->GetEntry(), obj->GetGUIDLow(), obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation());
+ assert(false);
+ return false;
+ }
+
// move angle to range -pi ... +pi
while( angle > M_PI)
angle -= 2.0f * M_PI;