Fix crasher. thanks to dagni for the demo file that tracked it down.
authornemo
Thu, 04 Aug 2011 19:52:27 -0400
changeset 5494 5f55e9202122
parent 5492 a0455a050ca8
child 5496 0ae489d724eb
child 5498 fac3c15707d2
Fix crasher. thanks to dagni for the demo file that tracked it down.
hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Tue Aug 02 00:28:49 2011 +0200
+++ b/hedgewars/GSHandlers.inc	Thu Aug 04 19:52:27 2011 -0400
@@ -257,16 +257,14 @@
     AllInactive := false;
     Gear^.Y := Gear^.Y + cDrownSpeed;
     Gear^.X := Gear^.X + Gear^.dX * cDrownSpeed;
-    if (not SuddenDeathDmg and (cWaterOpacity > $FE)) or (SuddenDeathDmg and (cSDWaterOpacity > $FE)) or (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then
-        DeleteGear(Gear);
     // Create some bubbles (0.5% might be better but causes too few bubbles sometimes)
     if ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cSDWaterOpacity < $FF))) and ((GameTicks and $1F) = 0) then
         if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then
-            AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius,
-            vgtBubble)
+            AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, vgtBubble)
     else if Random(12) = 0 then
-             AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius,
-             vgtBubble)
+             AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, vgtBubble);
+    if (not SuddenDeathDmg and (cWaterOpacity > $FE)) or (SuddenDeathDmg and (cSDWaterOpacity > $FE)) or (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then
+        DeleteGear(Gear);
 end;
 
 ////////////////////////////////////////////////////////////////////////////////