Commits

Anonymous committed 86d2be7

Fixed missing root in calculation of distances

Comments (0)

Files changed (1)

einheiten-schicken.php

 			$send_err = "Sitter können keine Angriffe ausführen";
 
         if (!isset ($dist))//dist is already calculated for returning troops
-		    $dist = (($x - $me->activevillage->x) * ($x - $me->activevillage->x)) - (($y - $me->activevillage->y) * ($y - $me->activevillage->y));
+        {
+            $distance_a = ($x - $me->activevillage->x) * ($x - $me->activevillage->x);
+            $distance_b = ($y - $me->activevillage->y) * ($y - $me->activevillage->y);
+            $dist = sqrt (abs($distance_a + $distance_b));
+        }
 
 		if (isset ($type))
 			$step = 3;