hedgewars/GSHandlers.inc
changeset 2882 b9aceb3fe3d6
parent 2871 eec42a0b7014
child 2886 c7087a565bd2
--- a/hedgewars/GSHandlers.inc	Sun Feb 28 15:41:42 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Sun Feb 28 16:03:33 2010 +0000
@@ -1190,7 +1190,7 @@
 	if ((GameTicks and $3F) = 25) then
 		doStepFallingGear(Gear);
 
-if ((Gear^.State and gsttmpFlag) <> 0) then
+if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then
 	if ((Gear^.State and gstAttacking) = 0) then
 		begin
 		if ((GameTicks and $1F) = 0) then
@@ -1201,8 +1201,14 @@
 		if (Gear^.Timer and $FF) = 0 then PlaySound(sndMineTick);
 		if Gear^.Timer = 0 then
 			begin
-			doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
-			DeleteGear(Gear);
+            if ((Gear^.State and gstWait) <> 0) or 
+               (cMineDudPercent = 0) or
+		       (getRandom(100) > cMineDudPercent) then
+               begin
+			   doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
+			   DeleteGear(Gear)
+               end
+            else Gear^.Health:= 0;
 			exit
 			end;
 		dec(Gear^.Timer);