Allow AfterAttack to proceed even if the Hedgehog is dead. They could be resurrected after all.
authornemo
Fri, 27 Jul 2012 19:27:39 -0400
changeset 7459 8511a3f899d3
parent 7456 823bd65ef095
child 7462 9cc5a2586978
Allow AfterAttack to proceed even if the Hedgehog is dead. They could be resurrected after all.
hedgewars/uGearsHedgehog.pas
--- a/hedgewars/uGearsHedgehog.pas	Fri Jul 27 20:45:02 2012 +0400
+++ b/hedgewars/uGearsHedgehog.pas	Fri Jul 27 19:27:39 2012 -0400
@@ -455,11 +455,13 @@
 procedure AfterAttack;
 var s: shortstring;
     a: TAmmoType;
+    HHGear: PGear;
 begin
-with CurrentHedgehog^.Gear^, CurrentHedgehog^ do
+with CurrentHedgehog^ do
     begin
+    HHGear:= Gear;
     a:= CurAmmoType;
-    State:= State and (not gstAttacking);
+    if HHGear <> nil then HHGear^.State:= HHGear^.State and (not gstAttacking);
     if (Ammoz[a].Ammo.Propz and ammoprop_Effect) = 0 then
         begin
         Inc(MultiShootAttacks);
@@ -484,8 +486,8 @@
                     TagTurnTimeLeft:= TurnTimeLeft;
                 TurnTimeLeft:=(Ammoz[a].TimeAfterTurn * cGetAwayTime) div 100;
                 end;
-            if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) then
-                State:= State or gstAttacked;
+            if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) and (HHGear <> nil) then 
+                HHGear^.State:= HHGear^.State and (not gstAttacked);
             if (Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) <> 0 then
                 ApplyAmmoChanges(CurrentHedgehog^)
             end;