hedgewars/uAmmos.pas
changeset 6770 7d2c6cdb816a
parent 6762 85ba0c55d077
child 6898 344b0dbd9690
--- a/hedgewars/uAmmos.pas	Sun Mar 11 18:28:32 2012 -0400
+++ b/hedgewars/uAmmos.pas	Sun Mar 11 20:12:31 2012 -0400
@@ -33,7 +33,7 @@
 procedure AssignStores;
 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType);
 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType; cnt: LongWord);
-function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): boolean;
+function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): LongWord;
 procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt);
 procedure OnUsedAmmo(var Hedgehog: THedgehog);
 procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType);
@@ -277,7 +277,7 @@
     end;
 end;
 
-function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): boolean;
+function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): LongWord;
 var slot, ami: LongInt;
 begin
 Slot:= Ammoz[Ammo].Slot;
@@ -286,10 +286,12 @@
         begin
         with Hedgehog.Ammo^[Slot, ami] do
             if (AmmoType = Ammo) then
-                exit((Count > 0) and (Hedgehog.Team^.Clan^.TurnNumber > Ammoz[AmmoType].SkipTurns));
+                if Hedgehog.Team^.Clan^.TurnNumber > Ammoz[AmmoType].SkipTurns then
+                    exit(Count)
+                else exit(0);
       inc(ami)
       end;
-HHHasAmmo:= false
+HHHasAmmo:= 0
 end;
 
 procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType);