# HG changeset patch # User nemo # Date 1385922126 18000 # Node ID a13afa6c5d21c730e6cbb2c190b71012e7f6aaff # Parent 953197ac43d801ec97f1ad1922a453dcf52f2de2 don't abort changeammo on attacking/attacked in infattack mode, keep scrolling through slot after setweap even if a multishoot was aborted triggering gstattacked, to ensure proper ammo gets set for next turn diff -r 953197ac43d8 -r a13afa6c5d21 hedgewars/uGearsHedgehog.pas --- a/hedgewars/uGearsHedgehog.pas Sat Nov 30 22:34:39 2013 -0500 +++ b/hedgewars/uGearsHedgehog.pas Sun Dec 01 13:22:06 2013 -0500 @@ -65,7 +65,7 @@ HHGear^.Message:= HHGear^.Message and (not gmSlot); prevAmmo:= CurAmmoType; ammoidx:= 0; - if ((HHGear^.State and (gstAttacking or gstAttacked)) <> 0) + if (((HHGear^.State and (gstAttacking or gstAttacked)) <> 0) and (GameFlags and gfInfAttack = 0)) or ((HHGear^.State and gstHHDriven) = 0) then exit; ChangeAmmo:= true; @@ -140,6 +140,7 @@ weap: TAmmoType; Hedgehog: PHedgehog; s: boolean; + prevState, newState: LongWord; begin s:= false; @@ -155,12 +156,18 @@ HHGear^.Message:= HHGear^.Message and (not gmWeapon); +prevState:= HHGear^.State; +newState:= prevState; with Hedgehog^ do while (CurAmmoType <> weap) and (t >= 0) do begin s:= ChangeAmmo(HHGear); + if HHGear^.State <> prevState then // so we can keep gstAttacked out of consideration when looping + newState:= HHGear^.State; + HHGear^.State:= prevState; dec(t) end; +HHGear^.State:= newState; if s then ApplyAmmoChanges(HHGear^.Hedgehog^)