aboutsummaryrefslogtreecommitdiff
path: root/src/game/Object.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-27 13:22:21 -0500
committermegamage <none@none>2009-05-27 13:22:21 -0500
commitba934b35d6f8a13904463cfa1d5dd92e0a9c01f1 (patch)
treeb23a6bcedc4e9480979db731bd60d48a6ebd072a /src/game/Object.cpp
parent199cac6ddab1389bf5b31290344c9f3f6720b536 (diff)
*Try to fix a freeze bug. (atan2(0,0) returns invalid value)
--HG-- branch : trunk
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r--src/game/Object.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 2a38a63d457..204d654d000 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -1387,6 +1387,8 @@ 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;