Index: /trunk/src/game/RandomMovementGenerator.cpp
===================================================================
--- /trunk/src/game/RandomMovementGenerator.cpp (revision 18)
+++ /trunk/src/game/RandomMovementGenerator.cpp (revision 26)
@@ -55,5 +55,5 @@
     MaNGOS::NormalizeMapCoord(ny);
 
-    dist = distanceX*distanceX + distanceY*distanceY;
+    dist = (nx - X)*(nx - X) + (ny - Y)*(ny - Y);
 
     if (is_air_ok) // 3D system above ground and above water (flying mode)
