--- a/hedgewars/uGearsHedgehog.pas Mon Aug 06 21:41:06 2018 +0200
+++ b/hedgewars/uGearsHedgehog.pas Mon Aug 06 22:39:39 2018 +0200
@@ -783,6 +783,7 @@
////////////////////////////////////////////////////////////////////////////////
procedure PickUp(HH, Gear: PGear);
var ag, gi: PGear;
+ healthBoost: LongInt;
begin
if Gear^.State and gstFrozen <> 0 then exit;
@@ -829,14 +830,11 @@
end;
posCaseHealth: begin
PlaySound(sndShotgunReload);
- inc(HH^.Health, Gear^.Health);
- // Prevent overflow
- if (HH^.Health < 0) or (HH^.Health > cMaxHogHealth) then
- HH^.Health:= cMaxHogHealth;
+ healthBoost:= IncHogHealth(HH^.Hedgehog, Gear^.Health);
HH^.Hedgehog^.Effects[hePoisoned] := 0;
RenderHealth(HH^.Hedgehog^);
RecountTeamHealth(HH^.Hedgehog^.Team);
- HHHeal(HH^.Hedgehog, Gear^.Health, true);
+ HHHeal(HH^.Hedgehog, healthBoost, true);
end;
end
end;