hedgewars/uAmmos.pas
changeset 6770 7d2c6cdb816a
parent 6762 85ba0c55d077
child 6898 344b0dbd9690
equal deleted inserted replaced
6769:44ad49a3a126 6770:7d2c6cdb816a
    31 procedure SetAmmoDelay(s: shortstring);
    31 procedure SetAmmoDelay(s: shortstring);
    32 procedure SetAmmoReinforcement(s: shortstring);
    32 procedure SetAmmoReinforcement(s: shortstring);
    33 procedure AssignStores;
    33 procedure AssignStores;
    34 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType);
    34 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType);
    35 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType; cnt: LongWord);
    35 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType; cnt: LongWord);
    36 function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): boolean;
    36 function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): LongWord;
    37 procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt);
    37 procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt);
    38 procedure OnUsedAmmo(var Hedgehog: THedgehog);
    38 procedure OnUsedAmmo(var Hedgehog: THedgehog);
    39 procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType);
    39 procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType);
    40 procedure ApplyAmmoChanges(var Hedgehog: THedgehog);
    40 procedure ApplyAmmoChanges(var Hedgehog: THedgehog);
    41 procedure SwitchNotHeldAmmo(var Hedgehog: THedgehog);
    41 procedure SwitchNotHeldAmmo(var Hedgehog: THedgehog);
   275                 end
   275                 end
   276             end
   276             end
   277     end;
   277     end;
   278 end;
   278 end;
   279 
   279 
   280 function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): boolean;
   280 function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): LongWord;
   281 var slot, ami: LongInt;
   281 var slot, ami: LongInt;
   282 begin
   282 begin
   283 Slot:= Ammoz[Ammo].Slot;
   283 Slot:= Ammoz[Ammo].Slot;
   284 ami:= 0;
   284 ami:= 0;
   285 while (ami <= cMaxSlotAmmoIndex) do
   285 while (ami <= cMaxSlotAmmoIndex) do
   286         begin
   286         begin
   287         with Hedgehog.Ammo^[Slot, ami] do
   287         with Hedgehog.Ammo^[Slot, ami] do
   288             if (AmmoType = Ammo) then
   288             if (AmmoType = Ammo) then
   289                 exit((Count > 0) and (Hedgehog.Team^.Clan^.TurnNumber > Ammoz[AmmoType].SkipTurns));
   289                 if Hedgehog.Team^.Clan^.TurnNumber > Ammoz[AmmoType].SkipTurns then
       
   290                     exit(Count)
       
   291                 else exit(0);
   290       inc(ami)
   292       inc(ami)
   291       end;
   293       end;
   292 HHHasAmmo:= false
   294 HHHasAmmo:= 0
   293 end;
   295 end;
   294 
   296 
   295 procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType);
   297 procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType);
   296 begin
   298 begin
   297 with Hedgehog do
   299 with Hedgehog do