# HG changeset patch # User nemo # Date 1270392465 0 # Node ID 0973c5af51413ad0382e38aed1aed6f95c73d245 # Parent df0c2a29c3d7bfd887b8ee6a30a3808634a5941e Add reference to ammo at time of gear creation to allow switching to work on jetpack/parachute diff -r df0c2a29c3d7 -r 0973c5af5141 hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Sun Apr 04 10:16:40 2010 +0000 +++ b/hedgewars/HHHandlers.inc Sun Apr 04 14:47:45 2010 +0000 @@ -110,7 +110,7 @@ ((State and (gstAttacked or gstHHChooseTarget)) = 0) and (((State and gstMoving) = 0) or // Allow attacks while moving on ammo with AltAttack - ((CurAmmoGear <> nil) and ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) <> 0)) or + ((CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)) or ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackInMove) <> 0)) and ((TargetPoint.X <> NoPointX) or ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_NeedTarget) = 0)) then begin @@ -226,6 +226,7 @@ and (((Ammo^[CurSlot, CurAmmo].Propz) and ammoprop_AltUse) = 0){check for dropping ammo from rope} then begin CurAmmoGear^.Ammo:= @(Ammo^[CurSlot, CurAmmo]); + CurAmmoGear^.AmmoType:= CurAmmoGear^.Ammo^.AmmoType; Message:= Message or gm_Attack; CurAmmoGear^.Message:= Message end else begin @@ -663,7 +664,7 @@ Attack(Gear) // should be before others to avoid desync with '/put' msg and changing weapon msgs else else with PHedgehog(Gear^.Hedgehog)^ do - if ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) <> 0) + if ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) and ((Gear^.Message and gm_LJump) <> 0) and (((Ammo^[CurSlot, CurAmmo].Propz) and ammoprop_AltUse) <> 0) then begin @@ -672,7 +673,7 @@ end; if (CurAmmoGear = nil) - or ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) <> 0) then + or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) then begin if ((Gear^.Message and gm_Slot) <> 0) then begin diff -r df0c2a29c3d7 -r 0973c5af5141 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Sun Apr 04 10:16:40 2010 +0000 +++ b/hedgewars/uGears.pas Sun Apr 04 14:47:45 2010 +0000 @@ -33,6 +33,7 @@ Invulnerable: Boolean; RenderTimer: Boolean; Ammo : PAmmo; + AmmoType : TAmmoType; // Used to track AmmoType at time of Gear creation, since Ammo can be reassigned State : Longword; X : hwFloat; Y : hwFloat;