issue #871 in hedgewars: "Hedgehog dropping into water while still attached to a rope makes engine crash"
Due to doStepRopeWork's being completely skipped 75% of the ticks - including drowning/detachment-condition checks
--- a/hedgewars/uGearsHandlersRope.pas Tue Dec 16 08:04:18 2014 -0500
+++ b/hedgewars/uGearsHandlersRope.pas Tue Dec 16 22:30:17 2014 +0100
@@ -121,9 +121,17 @@
haveDivided: boolean;
wrongSide: boolean;
begin
- if GameTicks mod 4 <> 0 then exit;
+ HHGear := Gear^.Hedgehog^.Gear;
- HHGear := Gear^.Hedgehog^.Gear;
+ if ((HHGear^.State and gstHHDriven) = 0) or
+ (CheckGearDrowning(HHGear)) or (Gear^.PortalCounter <> 0) then
+ begin
+ PlaySound(sndRopeRelease);
+ RopeDeleteMe(Gear, HHGear);
+ exit
+ end;
+
+ if GameTicks mod 4 <> 0 then exit;
tX:= HHGear^.X;
if WorldWrap(HHGear) and (WorldEdge = weWrap) and
@@ -137,14 +145,6 @@
end;
tX:= HHGear^.X;
- if ((HHGear^.State and gstHHDriven) = 0) or
- (CheckGearDrowning(HHGear)) or (Gear^.PortalCounter <> 0) then
- begin
- PlaySound(sndRopeRelease);
- RopeDeleteMe(Gear, HHGear);
- exit
- end;
-
HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue shl 2;
HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue shl 2;
if (Gear^.Message and gmLeft <> 0) and (TestCollisionXwithGear(HHGear, -1) = 0) then