hedgewars/uAmmos.pas
changeset 783 4f59db6f147d
parent 553 5478386d935f
child 784 b203147d91b5
equal deleted inserted replaced
782:e2d2b84aa776 783:4f59db6f147d
    27 function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): boolean;
    27 function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): boolean;
    28 procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt);
    28 procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt);
    29 procedure OnUsedAmmo(var Hedgehog: THedgehog);
    29 procedure OnUsedAmmo(var Hedgehog: THedgehog);
    30 procedure ApplyAmmoChanges(var Hedgehog: THedgehog);
    30 procedure ApplyAmmoChanges(var Hedgehog: THedgehog);
    31 procedure SwitchNotHoldedAmmo(var Hedgehog: THedgehog);
    31 procedure SwitchNotHoldedAmmo(var Hedgehog: THedgehog);
       
    32 procedure SetWeapon(weap: TAmmoType);
    32 
    33 
    33 implementation
    34 implementation
    34 uses uMisc, uGears, uWorld, uLocale;
    35 uses uMisc, uGears, uWorld, uLocale, uConsole;
    35 type TAmmoCounts = array[TAmmoType] of Longword;
    36 type TAmmoCounts = array[TAmmoType] of Longword;
    36 var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo;
    37 var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo;
    37     StoreCnt: Longword = 0;
    38     StoreCnt: Longword = 0;
    38 
    39 
    39 procedure FillAmmoStore(Ammo: PHHAmmo; var cnts: TAmmoCounts);
    40 procedure FillAmmoStore(Ammo: PHHAmmo; var cnts: TAmmoCounts);
   212         CurSlot:= 0;
   213         CurSlot:= 0;
   213         while (CurSlot <= cMaxSlotIndex) and (Ammo^[CurSlot, CurAmmo].Count = 0) do inc(CurSlot)
   214         while (CurSlot <= cMaxSlotIndex) and (Ammo^[CurSlot, CurAmmo].Count = 0) do inc(CurSlot)
   214         end
   215         end
   215 end;
   216 end;
   216 
   217 
       
   218 procedure SetWeapon(weap: TAmmoType);
       
   219 begin
       
   220 ParseCommand('/setweap ' + chr(ord('a') + byte(weap)), true)
       
   221 end;
       
   222 
   217 end.
   223 end.