# HG changeset patch # User sheepluva # Date 1418765417 -3600 # Node ID 4a4a82686e91ec58586816aaf001b0d149b96c17 # Parent 5989c293955a33b14686b622da0c44947dedd9f2 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 diff -r 5989c293955a -r 4a4a82686e91 hedgewars/uGearsHandlersRope.pas --- 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