hedgewars/uAmmos.pas
changeset 1784 dfe9bafb4590
parent 1066 1f1b3686a2b0
child 1849 2a989e5abda6
--- a/hedgewars/uAmmos.pas	Sat Jan 31 15:44:07 2009 +0000
+++ b/hedgewars/uAmmos.pas	Sun Feb 01 15:58:44 2009 +0000
@@ -30,6 +30,7 @@
 procedure ApplyAmmoChanges(var Hedgehog: THedgehog);
 procedure SwitchNotHoldedAmmo(var Hedgehog: THedgehog);
 procedure SetWeapon(weap: TAmmoType);
+procedure DisableSomeWeapons;
 
 implementation
 uses uMisc, uGears, uWorld, uLocale, uConsole;
@@ -227,4 +228,22 @@
 ParseCommand('/setweap ' + char(weap), true)
 end;
 
+procedure DisableSomeWeapons;
+var i, slot, a: Longword;
+	t: TAmmoType;
+begin
+for i:= 0 to Pred(StoreCnt) do
+	for slot:= 0 to cMaxSlotIndex do
+		begin
+		for a:= 0 to cMaxSlotAmmoIndex do
+			with StoresList[i]^[slot, a] do
+				if (Propz and ammoprop_NotBorder) <> 0 then Count:= 0;
+
+		PackAmmo(StoresList[i], slot)
+		end;
+
+for t:= Low(TAmmoType) to High(TAmmoType) do
+	if (Ammoz[t].Ammo.Propz and ammoprop_NotBorder) <> 0 then Ammoz[t].Probability:= 0
+end;
+
 end.