Fix a bug with automatic weapon switching when attacking from rope
authorunc0rr
Mon, 02 Jun 2008 19:15:53 +0000
changeset 971 d2c49b730771
parent 970 1bd9a4eafbc3
child 972 c90d58ae315e
Fix a bug with automatic weapon switching when attacking from rope
hedgewars/uAmmos.pas
hedgewars/uTeams.pas
--- a/hedgewars/uAmmos.pas	Sun Jun 01 20:01:45 2008 +0000
+++ b/hedgewars/uAmmos.pas	Mon Jun 02 19:15:53 2008 +0000
@@ -138,14 +138,18 @@
 procedure OnUsedAmmo(var Hedgehog: THedgehog);
 begin
 with Hedgehog do
-     begin
-     with Ammo^[CurSlot, CurAmmo] do
-          if Count <> AMMO_INFINITE then
-             begin
-             dec(Count);
-             if Count = 0 then PackAmmo(Ammo, CurSlot)
-             end
-     end
+	begin
+	with Ammo^[CurSlot, CurAmmo] do
+		if Count <> AMMO_INFINITE then
+			begin
+			dec(Count);
+			if Count = 0 then
+				begin
+				PackAmmo(Ammo, CurSlot);
+				SwitchNotHoldedAmmo(Hedgehog)
+				end
+			end
+	end
 end;
 
 function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): boolean;
--- a/hedgewars/uTeams.pas	Sun Jun 01 20:01:45 2008 +0000
+++ b/hedgewars/uTeams.pas	Mon Jun 02 19:15:53 2008 +0000
@@ -146,7 +146,6 @@
         AttacksNum:= 0;
         Gear^.Message:= 0;
         Gear^.Z:= cHHZ;
-        SwitchNotHoldedAmmo(CurrentHedgehog^);
         RemoveGearFromList(Gear);
         InsertGearToList(Gear)
         end;