hedgewars/GSHandlers.inc
changeset 3584 7c05f2e0a8b5
parent 3583 13818670ad9e
child 3585 39570d86de57
--- a/hedgewars/GSHandlers.inc	Tue Jun 29 05:22:25 2010 +0200
+++ b/hedgewars/GSHandlers.inc	Tue Jun 29 06:27:59 2010 +0200
@@ -1153,10 +1153,6 @@
 
     haveDivided := false;
     // check whether rope needs dividing
-    len := _1 / Distance(ropeDx, ropeDy);
-    // old rope pos
-    nx := ropeDx * len;
-    ny := ropeDy * len;
 
     len := Gear^.Elasticity - _5;
     while len > _3 do
@@ -1166,6 +1162,15 @@
         if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and (Land[ly, lx] <> 0
            ) then
         begin
+            // calculate those the first time we have to divide the rope
+            if not haveDivided then
+            begin
+            ny := _1 / Distance(ropeDx, ropeDy);
+            // old rope pos
+            nx := ropeDx * ny;
+            ny := ropeDy * ny;
+            end;
+
             with RopePoints.ar[RopePoints.Count] do
             begin
                 X := Gear^.X;