From ba934b35d6f8a13904463cfa1d5dd92e0a9c01f1 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 27 May 2009 13:22:21 -0500 Subject: [PATCH] *Try to fix a freeze bug. (atan2(0,0) returns invalid value) --HG-- branch : trunk --- src/game/Object.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 2a38a63d45..204d654d00 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;