# HG changeset patch # User nemo # Date 1452024954 18000 # Node ID cb64affd7715cfc5bd4fa8679ac9d712f59f6c68 # Parent dbc0d54798dc0867604fb478f19e8931a49d6408 limit Y increment to 6 (saucer/birdy bug) diff -r dbc0d54798dc -r cb64affd7715 hedgewars/uGearsHedgehog.pas --- a/hedgewars/uGearsHedgehog.pas Mon Jan 04 10:08:26 2016 +0300 +++ b/hedgewars/uGearsHedgehog.pas Tue Jan 05 15:15:54 2016 -0500 @@ -876,6 +876,7 @@ procedure doStepHedgehogMoving(Gear: PGear); var isFalling, isUnderwater: boolean; land: Word; + cnt: LongWord; begin if Gear^.Hedgehog^.Unplaced then begin @@ -1037,15 +1038,24 @@ else begin Gear^.State:= Gear^.State and (not gstMoving); - while TestCollisionYWithGear(Gear,1) = 0 do - Gear^.Y:= Gear^.Y+_1; + cnt:= 0; + while (cnt < 6) and (not CheckGearDrowning(Gear)) and (Gear <> nil) and (TestCollisionYWithGear(Gear,1) = 0) do + begin + Gear^.Y:= Gear^.Y + _1; + inc(cnt) + end; + SetLittle(Gear^.dX) end else begin Gear^.State:= Gear^.State and (not gstMoving); - while TestCollisionYWithGear(Gear,1) = 0 do - Gear^.Y:= Gear^.Y+_1; + cnt:= 0; + while (cnt < 6) and (not CheckGearDrowning(Gear)) and (Gear <> nil) and (TestCollisionYWithGear(Gear,1) = 0) do + begin + Gear^.Y:= Gear^.Y + _1; + inc(cnt) + end; SetLittle(Gear^.dX) end else if (hwAbs(Gear^.dX) > cLittle) @@ -1059,8 +1069,12 @@ begin Gear^.State:= Gear^.State and (not gstWinner); Gear^.State:= Gear^.State and (not gstMoving); - while (not CheckGearDrowning(Gear)) and (Gear <> nil) and (TestCollisionYWithGear(Gear,1) = 0) do + cnt:= 0; + while (cnt < 6) and (not CheckGearDrowning(Gear)) and (Gear <> nil) and (TestCollisionYWithGear(Gear,1) = 0) do + begin Gear^.Y:= Gear^.Y + _1; + inc(cnt) + end; // could become nil in CheckGearDrowning if ai's hog fails to respawn in ai survival if Gear = nil then exit;