set CurAmmoType to a temp var so I don't have to worry about it switching inside the routine so that I can actually put OnUsedAmmo where it belongs.
authornemo
Mon, 11 Oct 2010 16:56:00 -0400
changeset 3970 0f6e3219c108
parent 3969 5f4ef3db0a65
child 3971 5c82ee165ed5
set CurAmmoType to a temp var so I don't have to worry about it switching inside the routine so that I can actually put OnUsedAmmo where it belongs.
hedgewars/HHHandlers.inc
--- a/hedgewars/HHHandlers.inc	Mon Oct 11 16:28:54 2010 -0400
+++ b/hedgewars/HHHandlers.inc	Mon Oct 11 16:56:00 2010 -0400
@@ -305,36 +305,35 @@
 
 procedure AfterAttack;
 var s: shortstring;
+    a: TAmmoType;
 begin
 with CurrentHedgehog^.Gear^,
         CurrentHedgehog^ do
     begin
+    a:= CurAmmoType;
     State:= State and not gstAttacking;
-    if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Effect) = 0 then
+    if (Ammoz[a].Ammo.Propz and ammoprop_Effect) = 0 then
         begin
         Inc(MultiShootAttacks);
         
-        if (Ammoz[CurAmmoType].Ammo.NumPerTurn >= MultiShootAttacks) then
+        if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks) then
             begin
-            s:= inttostr(Ammoz[CurAmmoType].Ammo.NumPerTurn - MultiShootAttacks + 1);
+            s:= inttostr(Ammoz[a].Ammo.NumPerTurn - MultiShootAttacks + 1);
             AddCaption(format(trmsg[sidRemaining], s), cWhiteColor, capgrpAmmostate);
             end;
         
-        if (Ammoz[CurAmmoType].Ammo.NumPerTurn >= MultiShootAttacks) or
+        if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks) or
             ((GameFlags and gfMultiWeapon) <> 0) then
             begin
             isInMultiShoot:= true
             end
         else
             begin
-            if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) = 0) and ((GameFlags and gfInfAttack) = 0) then
-                begin
-                TurnTimeLeft:= Ammoz[CurAmmoType].TimeAfterTurn;
-                State:= State or gstAttacked
-                end;
-            if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) <> 0 then ApplyAmmoChanges(CurrentHedgehog^);
-            if (GameFlags and gfInfAttack) <> 0 then State:= State or gstAttacked;
-            OnUsedAmmo(CurrentHedgehog^)
+            OnUsedAmmo(CurrentHedgehog^);
+            if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEndHint) = 0) and ((GameFlags and gfInfAttack) = 0) then
+                TurnTimeLeft:= Ammoz[a].TimeAfterTurn;
+            if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEndHint) = 0) then State:= State or gstAttacked;
+            if (Ammoz[a].Ammo.Propz and ammoprop_NoRoundEndHint) <> 0 then ApplyAmmoChanges(CurrentHedgehog^)
             end;
         end
     else