hedgewars/GSHandlers.inc
branch0.9.19
changeset 8898 0ccaa19c6367
parent 8838 aa2ffd427f6a
child 8900 b77fd3c2eec5
--- a/hedgewars/GSHandlers.inc	Tue Apr 16 12:24:13 2013 +0200
+++ b/hedgewars/GSHandlers.inc	Tue Apr 16 17:31:39 2013 +0200
@@ -3683,7 +3683,11 @@
             // wow! good candidate there, let's see if the distance and direction is okay!
             if hasdxy then
                 begin
-                s := r / Distance(iterator^.dX, iterator^.dY);
+                s: = Distance(iterator^.dX, iterator^.dY);
+                // if the resulting distance is 0 skip this gear
+                if s.QWordValue = 0 then
+                    continue;
+                s := r / s
                 ox:= iterator^.X + s * iterator^.dX;
                 oy:= iterator^.Y + s * iterator^.dY;
                 end