# HG changeset patch # User unc0rr # Date 1236722253 0 # Node ID 7c7476f561142b46928746da5818001dbecb2a58 # Parent fda9407a00700f351d538595ea1706be9b74a727 - Clear gm_Slot flag even if you can't switch ammo: Fixes engine slowdown when trying to switch ammo while firing bazooka diff -r fda9407a0070 -r 7c7476f56114 hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Tue Mar 10 21:31:29 2009 +0000 +++ b/hedgewars/HHHandlers.inc Tue Mar 10 21:57:33 2009 +0000 @@ -24,11 +24,13 @@ with PHedgehog(Gear^.Hedgehog)^ do begin + Gear^.Message:= Gear^.Message and not gm_Slot; + if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or (AttacksNum > 0) or ((Gear^.State and gstHHDriven) = 0) then exit; - Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump or gm_Slot); + Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump); if CurSlot = slot then begin @@ -212,24 +214,24 @@ CurrentHedgehog^ do begin State:= State and not gstAttacking; - if ((Ammo^[CurSlot, CurAmmo].Propz) and ammoprop_Utility) = 0 then - begin - Inc(AttacksNum); - if (Ammo^[CurSlot, CurAmmo].NumPerTurn >= AttacksNum) or - ((GameFlags and gfMultiWeapon) <> 0) then - isInMultiShoot:= true - else - begin - TurnTimeLeft:= Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].TimeAfterTurn; - State:= State or gstAttacked; - OnUsedAmmo(CurrentHedgehog^); - end; - end - else - begin - OnUsedAmmo(CurrentHedgehog^); - ApplyAmmoChanges(CurrentHedgehog^); - end; + if ((Ammo^[CurSlot, CurAmmo].Propz) and ammoprop_Utility) = 0 then + begin + Inc(AttacksNum); + if (Ammo^[CurSlot, CurAmmo].NumPerTurn >= AttacksNum) or + ((GameFlags and gfMultiWeapon) <> 0) then + isInMultiShoot:= true + else + begin + TurnTimeLeft:= Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].TimeAfterTurn; + State:= State or gstAttacked; + OnUsedAmmo(CurrentHedgehog^); + end; + end + else + begin + OnUsedAmmo(CurrentHedgehog^); + ApplyAmmoChanges(CurrentHedgehog^); + end; AttackBar:= 0; end end;