hedgewars/GSHandlers.inc
changeset 1436 252ab509c779
parent 1435 d4b32ee3caa6
child 1437 9f370351e859
--- a/hedgewars/GSHandlers.inc	Tue Oct 28 20:56:02 2008 +0000
+++ b/hedgewars/GSHandlers.inc	Tue Oct 28 20:58:25 2008 +0000
@@ -910,6 +910,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 procedure doStepCase(Gear: PGear);
 var i, x, y: LongInt;
+	k: TGearType;
 begin
 if (Gear^.Message and gm_Destroy) > 0 then
 	begin
@@ -925,13 +926,15 @@
 	begin
 	x:= hwRound(Gear^.X);
 	y:= hwRound(Gear^.Y);
-	if Gear^.Kind = gtCase then
+	k:= Gear^.Kind;
+	DeleteGear(Gear); // <-- delete gear!
+	
+	if k = gtCase then
 		begin
 		doMakeExplosion(x, y, 25, EXPLAutoSound);
 		for i:= 0 to 63 do
 			AddGear(x, y, gtFlame, 0, _0, _0, 0);
 		end;
-	DeleteGear(Gear);
 	exit
 	end;