Check for 0 health to avoid div by 0. spotted by mikade.
--- a/hedgewars/GSHandlers.inc Fri Apr 08 21:15:57 2011 +0200
+++ b/hedgewars/GSHandlers.inc Sat Apr 09 15:54:28 2011 -0400
@@ -1930,7 +1930,7 @@
^.dY := _0;
if hwAbs(Gear^.dX) < _0_001 then Gear^.dX := _0;
- if ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then
+ if (Gear^.Health > 0) and ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then
if (cBarrelHealth div Gear^.Health) > 2 then
AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke)
else
@@ -1970,7 +1970,7 @@
if (hwAbs(Gear^.dX) > _0_15) or ((hwAbs(Gear^.dY) > _0_15) and (hwAbs(Gear^.dX) > _0_02))
then Gear^.doStep := @doStepRollingBarrel;
- if ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then
+ if (Gear^.Health > 0) and ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then
if (cBarrelHealth div Gear^.Health) > 2 then
AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke)
else