hedgewars/uTeams.pas
changeset 75 d2b737858ff7
parent 74 42257fee61ae
child 79 29b477319854
--- a/hedgewars/uTeams.pas	Sat Jul 08 21:40:03 2006 +0000
+++ b/hedgewars/uTeams.pas	Tue Jul 11 21:04:05 2006 +0000
@@ -77,6 +77,7 @@
 procedure SwitchHedgehog;
 procedure InitTeams;
 procedure OnUsedAmmo(Ammo: PHHAmmo);
+function  HHHasAmmo(Hedgehog: PHedgehog; Ammo: TAmmoType): boolean;
 function  TeamSize(p: PTeam): Longword;
 procedure RecountTeamHealth(team: PTeam);
 procedure RestoreTeamsFromSave;
@@ -286,6 +287,20 @@
      end
 end;
 
+function  HHHasAmmo(Hedgehog: PHedgehog; Ammo: TAmmoType): boolean;
+var slot, ami: integer;
+begin
+Slot:= Ammoz[Ammo].Slot;
+ami:= 0;
+Result:= false;
+while (not Result) and (ami <= cMaxSlotAmmoIndex) do
+      begin
+      with  Hedgehog.Ammo[Slot, ami] do
+            if (AmmoType = Ammo) and (Count > 0) then Result:= true;
+      inc(ami)
+      end
+end;
+
 function  TeamSize(p: PTeam): Longword;
 var i: Longword;
 begin