hedgewars/uGearsHedgehog.pas
changeset 7550 3c4b4cb40f40
parent 7462 9cc5a2586978
child 7503 deaeac102355
child 7597 1ef520fea21c
--- a/hedgewars/uGearsHedgehog.pas	Sat Aug 18 00:47:51 2012 +0200
+++ b/hedgewars/uGearsHedgehog.pas	Sat Aug 18 00:48:09 2012 +0200
@@ -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 or gstAttacked;
             if (Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) <> 0 then
                 ApplyAmmoChanges(CurrentHedgehog^)
             end;