# HG changeset patch
# User unc0rr
# Date 1341759565 -14400
# Node ID 53bcfc714cb3669a6691c61852eee4b4c5fef19a
# Parent  d833d1010710cc2604c6cf1a33ebed8f9f31d764
Fix rare condition when hog's gear stucks in an infinite loop which adds 1 to its Y coordinate not checking for drowning

diff -r d833d1010710 -r 53bcfc714cb3 hedgewars/uGearsHedgehog.pas
--- a/hedgewars/uGearsHedgehog.pas	Sun Jul 08 10:35:40 2012 -0400
+++ b/hedgewars/uGearsHedgehog.pas	Sun Jul 08 18:59:25 2012 +0400
@@ -957,11 +957,11 @@
             SetLittle(Gear^.dX);
 
 if (not isFalling)
-and (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then
+  and (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then
     begin
     Gear^.State:= Gear^.State and (not gstWinner);
     Gear^.State:= Gear^.State and (not gstMoving);
-    while TestCollisionYWithGear(Gear,1) = 0 do
+    while (TestCollisionYWithGear(Gear,1) = 0) and not CheckGearDrowning(Gear) do
         Gear^.Y:= Gear^.Y+_1;
     SetLittle(Gear^.dX);
     Gear^.dY:= _0