hedgewars/uGearsUtils.pas
changeset 13597 f7cbf7d8298d
parent 13572 a71e6856ffab
child 13604 73b096e1d895
--- a/hedgewars/uGearsUtils.pas	Thu Aug 02 01:52:01 2018 +0200
+++ b/hedgewars/uGearsUtils.pas	Thu Aug 02 03:16:08 2018 +0200
@@ -290,6 +290,9 @@
                     // was considering pulsing on attack, Tiy thinks it should be permanent while in play
                     //CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State or gstVampiric;
                     inc(CurrentHedgehog^.Gear^.Health,vampDmg);
+                    // Prevent overflow
+                    if (CurrentHedgehog^.Gear^.Health < 0) or (CurrentHedgehog^.Gear^.Health > cMaxHogHealth) then
+                        CurrentHedgehog^.Gear^.Health:= cMaxHogHealth;
                     RenderHealth(CurrentHedgehog^);
                     RecountTeamHealth(CurrentHedgehog^.Team);
                     HHHeal(CurrentHedgehog, vampDmg, true, $FF0000FF);