- Clear gm_Slot flag even if you can't switch ammo:
authorunc0rr
Tue, 10 Mar 2009 21:57:33 +0000
changeset 1883 7c7476f56114
parent 1882 fda9407a0070
child 1884 40e59e9f82ce
- Clear gm_Slot flag even if you can't switch ammo: Fixes engine slowdown when trying to switch ammo while firing bazooka
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;