hedgewars/HHHandlers.inc
changeset 926 d231e007452a
parent 925 c20156328529
child 927 2c1675344a6f
--- a/hedgewars/HHHandlers.inc	Sat May 10 16:26:53 2008 +0000
+++ b/hedgewars/HHHandlers.inc	Sun May 11 19:21:58 2008 +0000
@@ -59,13 +59,26 @@
 Gear^.Message:= Gear^.Message and not gm_Weapon;
 
 with PHedgehog(Gear^.Hedgehog)^ do
-     while (Ammo^[CurSlot, CurAmmo].AmmoType <> weap) and (t >= 0) do
-           begin
-           ChangeAmmo(Gear);
-           dec(t)
-           end
+	while (Ammo^[CurSlot, CurAmmo].AmmoType <> weap) and (t >= 0) do
+		begin
+		ChangeAmmo(Gear);
+		dec(t)
+		end
 end;
 
+procedure HHSetTimer(Gear: PGear);
+begin
+Gear^.Message:= Gear^.Message and not gm_Timer;
+with PHedgehog(Gear^.Hedgehog)^ do
+	if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Timerable) <> 0 then
+		begin
+		Ammo^[CurSlot, CurAmmo].Timer:= 1000 * Gear^.MsgParam;
+		with CurrentTeam^ do
+			ApplyAmmoChanges(Hedgehogs[CurrHedgehog]);
+		end;
+end;
+
+
 procedure Attack(Gear: PGear);
 var xx, yy: hwFloat;
 begin
@@ -467,6 +480,8 @@
 
 if ((Gear^.Message and gm_Weapon) <> 0) then HHSetWeapon(Gear);
 
+if ((Gear^.Message and gm_Timer) <> 0) then HHSetTimer(Gear);
+
 if ((Gear^.Message and gm_Attack) <> 0) or
    ((Gear^.State and gstAttacking) <> 0) then Attack(Gear);