Avoid burning other hog's turn
authornemo
Wed, 31 Aug 2011 11:08:03 -0400
changeset 5716 9505a6f3fe05
parent 5715 59a8dd33f274
child 5717 6d513913b7a9
Avoid burning other hog's turn
hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Wed Aug 31 08:45:22 2011 -0400
+++ b/hedgewars/GSHandlers.inc	Wed Aug 31 11:08:03 2011 -0400
@@ -4925,6 +4925,7 @@
         begin
         if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible = 0) then
             begin
+	    AfterAttack;
             if Gear = CurAmmoGear then CurAmmoGear := nil;
             DeleteCI(HH^.Gear);
             RemoveGearFromList(HH^.Gear);
@@ -5009,13 +5010,13 @@
     3. Hog is a king
 *)
     HH:= Gear^.Hedgehog;
-    if HH^.Gear <> nil then 
-        begin
-        HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack;
-        HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking;
-        end;
     if (HH^.Gear = nil) or (HH^.King) or (SuddenDeathDmg) then
         begin
+	if HH^.Gear <> nil then 
+	    begin
+	    HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack;
+	    HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking;
+	    end;
         PlaySound(sndDenied);
         DeleteGear(gear);
         exit
@@ -5029,11 +5030,15 @@
                 HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Damage) then inc(cnt);
     if cnt < 2 then
         begin
+	if HH^.Gear <> nil then 
+	    begin
+	    HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack;
+	    HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking;
+	    end;
         PlaySound(sndDenied);
         DeleteGear(gear);
         exit
         end;
-    AfterAttack;
     Gear^.doStep:= @doStepTardisWarp
 end;