Avoid rare double decrement.
--- a/hedgewars/GSHandlers.inc Sat Mar 10 14:38:31 2012 -0500
+++ b/hedgewars/GSHandlers.inc Sat Mar 10 15:56:36 2012 -0500
@@ -3369,19 +3369,17 @@
if (Gear^.State and gsttmpFlag) <> 0 then
gear^.RenderTimer:= true;
- dec(Gear^.Timer)
+ if Gear^.Timer > 0 then dec(Gear^.Timer)
end
-
- else if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Tag <> 0) then
+ else if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Tag <> 0) then
+ begin
+ if Gear^.Timer > 0 then dec(Gear^.Timer);
+ if Gear^.Timer = 0 then
begin
- if Gear^.Timer = 0 then
- begin
- doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound);
- DeleteGear(Gear);
- end
- else
- dec(Gear^.Timer);
- end;
+ doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound);
+ DeleteGear(Gear);
+ end
+ end;
end;
////////////////////////////////////////////////////////////////////////////////