hedgewars/HHHandlers.inc
changeset 1710 cecb3cc93251
parent 1689 3d0eee01f734
child 1712 f5b916de40f0
equal deleted inserted replaced
1709:97500cd389eb 1710:cecb3cc93251
    54 			begin
    54 			begin
    55 			CurSlot:= slot;
    55 			CurSlot:= slot;
    56 			CurAmmo:= i
    56 			CurAmmo:= i
    57 			end
    57 			end
    58 		end
    58 		end
    59 	end;
    59 	end
    60 
       
    61 ApplyAmmoChanges(PHedgehog(Gear^.Hedgehog)^)
       
    62 end;
    60 end;
    63 
    61 
    64 procedure HHSetWeapon(Gear: PGear);
    62 procedure HHSetWeapon(Gear: PGear);
    65 var t: LongInt;
    63 var t: LongInt;
    66     weap: TAmmoType;
    64     weap: TAmmoType;
    78 with PHedgehog(Gear^.Hedgehog)^ do
    76 with PHedgehog(Gear^.Hedgehog)^ do
    79 	while (Ammo^[CurSlot, CurAmmo].AmmoType <> weap) and (t >= 0) do
    77 	while (Ammo^[CurSlot, CurAmmo].AmmoType <> weap) and (t >= 0) do
    80 		begin
    78 		begin
    81 		ChangeAmmo(Gear);
    79 		ChangeAmmo(Gear);
    82 		dec(t)
    80 		dec(t)
    83 		end
    81 		end;
       
    82 
       
    83 ApplyAmmoChanges(PHedgehog(Gear^.Hedgehog)^)
    84 end;
    84 end;
    85 
    85 
    86 procedure HHSetTimer(Gear: PGear);
    86 procedure HHSetTimer(Gear: PGear);
    87 begin
    87 begin
    88 Gear^.Message:= Gear^.Message and not gm_Timer;
    88 Gear^.Message:= Gear^.Message and not gm_Timer;
   553 		end;
   553 		end;
   554 
   554 
   555 if (CurAmmoGear = nil)
   555 if (CurAmmoGear = nil)
   556 	or ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) <> 0) then
   556 	or ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) <> 0) then
   557 	begin
   557 	begin
   558 	if ((Gear^.Message and gm_Slot) <> 0) then ChangeAmmo(Gear);
   558 	if ((Gear^.Message and gm_Slot) <> 0) then
       
   559 		begin
       
   560 		ChangeAmmo(Gear);
       
   561 		ApplyAmmoChanges(PHedgehog(Gear^.Hedgehog)^)
       
   562 		end;
   559 
   563 
   560 	if ((Gear^.Message and gm_Weapon) <> 0) then HHSetWeapon(Gear);
   564 	if ((Gear^.Message and gm_Weapon) <> 0) then HHSetWeapon(Gear);
   561 
   565 
   562 	if ((Gear^.Message and gm_Timer) <> 0) then HHSetTimer(Gear);
   566 	if ((Gear^.Message and gm_Timer) <> 0) then HHSetTimer(Gear);
   563 	end;
   567 	end;