hedgewars/GSHandlers.inc
changeset 8933 19be64b0f36e
parent 8924 13ac59499066
child 8934 a4ec39eac0be
--- a/hedgewars/GSHandlers.inc	Sat Apr 20 19:03:57 2013 -0400
+++ b/hedgewars/GSHandlers.inc	Sun Apr 21 01:38:52 2013 +0200
@@ -3682,7 +3682,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