hedgewars/GSHandlers.inc
changeset 6474 42e9773eedfd
parent 6473 2bed5ba1a7ea
child 6490 531bf083e8db
--- a/hedgewars/GSHandlers.inc	Thu Dec 01 11:30:06 2011 +0400
+++ b/hedgewars/GSHandlers.inc	Thu Dec 01 18:02:27 2011 +0400
@@ -1378,15 +1378,7 @@
     end
 end;
 
-procedure doStepRopeWork(Gear: PGear);
-var 
-    HHGear: PGear;
-    len, tx, ty, nx, ny, ropeDx, ropeDy, mdX, mdY: hwFloat;
-    lx, ly, cd: LongInt;
-    haveCollision,
-    haveDivided: boolean;
-
-procedure DeleteMe;
+procedure RopeDeleteMe(Gear, HHGear: PGear);
 begin
     with HHGear^ do
     begin
@@ -1396,7 +1388,7 @@
     DeleteGear(Gear)
 end;
 
-procedure WaitCollision;
+procedure RopeWaitCollision(Gear, HHGear: PGear);
 begin
     with HHGear^ do
     begin
@@ -1408,6 +1400,14 @@
     Gear^.doStep := @doStepRopeAfterAttack
 end;
 
+procedure doStepRopeWork(Gear: PGear);
+var 
+    HHGear: PGear;
+    len, tx, ty, nx, ny, ropeDx, ropeDy, mdX, mdY: hwFloat;
+    lx, ly, cd: LongInt;
+    haveCollision,
+    haveDivided: boolean;
+
 begin
     HHGear := Gear^.Hedgehog^.Gear;
 
@@ -1415,7 +1415,7 @@
        or (CheckGearDrowning(HHGear)) then
         begin
         PlaySound(sndRopeRelease);
-        DeleteMe;
+        RopeDeleteMe(Gear, HHGear);
         exit
         end;
 
@@ -1629,9 +1629,9 @@
                 begin
                 PlaySound(sndRopeRelease);
                 if CurAmmoType <> amParachute then
-                    WaitCollision
+                    RopeWaitCollision(Gear, HHGear)
                 else
-                    DeleteMe
+                    RopeDeleteMe(Gear, HHGear)
                 end
         end
     else
@@ -1639,12 +1639,7 @@
             Gear^.State := Gear^.State or gsttmpFlag;
 end;
 
-procedure doStepRopeAttach(Gear: PGear);
-var 
-    HHGear: PGear;
-    tx, ty, tt: hwFloat;
-
-procedure RemoveFromAmmo;
+procedure RopeRemoveFromAmmo(Gear, HHGear: PGear);
 begin
     if (Gear^.State and gstAttacked) = 0 then
     begin
@@ -1654,6 +1649,10 @@
     ApplyAmmoChanges(HHGear^.Hedgehog^)
 end;
 
+procedure doStepRopeAttach(Gear: PGear);
+var 
+    HHGear: PGear;
+    tx, ty, tt: hwFloat;
 begin
     Gear^.X := Gear^.X - Gear^.dX;
     Gear^.Y := Gear^.Y - Gear^.dY;
@@ -1702,7 +1701,7 @@
                     Message := Message and (not gmAttack)
                     end;
 
-                RemoveFromAmmo;
+                RopeRemoveFromAmmo(Gear, HHGear);
 
                 tt := _0;
                 exit
@@ -1728,7 +1727,7 @@
             Message := Message and (not gmAttack)
             end;
 
-        RemoveFromAmmo;
+        RopeRemoveFromAmmo(Gear, HHGear);
 
         exit
         end;