hedgewars/uAmmos.pas
changeset 1784 dfe9bafb4590
parent 1066 1f1b3686a2b0
child 1849 2a989e5abda6
equal deleted inserted replaced
1783:169ebeefd7ab 1784:dfe9bafb4590
    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 procedure SetWeapon(weap: TAmmoType);
       
    33 procedure DisableSomeWeapons;
    33 
    34 
    34 implementation
    35 implementation
    35 uses uMisc, uGears, uWorld, uLocale, uConsole;
    36 uses uMisc, uGears, uWorld, uLocale, uConsole;
    36 type TAmmoCounts = array[TAmmoType] of Longword;
    37 type TAmmoCounts = array[TAmmoType] of Longword;
    37 var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo;
    38 var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo;
   225 procedure SetWeapon(weap: TAmmoType);
   226 procedure SetWeapon(weap: TAmmoType);
   226 begin
   227 begin
   227 ParseCommand('/setweap ' + char(weap), true)
   228 ParseCommand('/setweap ' + char(weap), true)
   228 end;
   229 end;
   229 
   230 
       
   231 procedure DisableSomeWeapons;
       
   232 var i, slot, a: Longword;
       
   233 	t: TAmmoType;
       
   234 begin
       
   235 for i:= 0 to Pred(StoreCnt) do
       
   236 	for slot:= 0 to cMaxSlotIndex do
       
   237 		begin
       
   238 		for a:= 0 to cMaxSlotAmmoIndex do
       
   239 			with StoresList[i]^[slot, a] do
       
   240 				if (Propz and ammoprop_NotBorder) <> 0 then Count:= 0;
       
   241 
       
   242 		PackAmmo(StoresList[i], slot)
       
   243 		end;
       
   244 
       
   245 for t:= Low(TAmmoType) to High(TAmmoType) do
       
   246 	if (Ammoz[t].Ammo.Propz and ammoprop_NotBorder) <> 0 then Ammoz[t].Probability:= 0
       
   247 end;
       
   248 
   230 end.
   249 end.