hedgewars/uTeams.pas
changeset 247 07605d2a2024
parent 198 6f00e0f4cb88
child 255 97b2d242e2a1
--- a/hedgewars/uTeams.pas	Fri Nov 17 13:36:58 2006 +0000
+++ b/hedgewars/uTeams.pas	Sat Nov 18 14:47:50 2006 +0000
@@ -349,11 +349,16 @@
 end;
 
 procedure SetWeapon(weap: TAmmoType);
+var t: integer;
 begin
+t:= cMaxSlotAmmoIndex;
 with CurrentTeam^ do
      with Hedgehogs[CurrHedgehog] do
-          while Ammo[CurSlot, CurAmmo].AmmoType <> weap do
+          while (Ammo[CurSlot, CurAmmo].AmmoType <> weap) and (t > 0) do
+                begin
                 ParseCommand('/slot ' + chr(49 + Ammoz[TAmmoType(weap)].Slot));
+                dec(t)
+                end
 end;
 
 initialization