hedgewars/uScript.pas
changeset 13617 a6abc2c1fc1a
parent 13604 73b096e1d895
child 13618 edffc9b7ad58
--- a/hedgewars/uScript.pas	Mon Aug 06 21:41:06 2018 +0200
+++ b/hedgewars/uScript.pas	Mon Aug 06 22:39:39 2018 +0200
@@ -1817,11 +1817,7 @@
         healthBoost:= Trunc(lua_tonumber(L, 2));
         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) and (healthBoost >= 1) then
             begin
-            inc(gear^.Health, healthBoost);
-            // Prevent overflow
-            if (gear^.Health < 0) or (gear^.Health > cMaxHogHealth) then
-                gear^.Health:= cMaxHogHealth;
-
+            healthBoost:= IncHogHealth(gear^.Hedgehog, healthBoost);
             RenderHealth(gear^.Hedgehog^);
             RecountTeamHealth(gear^.Hedgehog^.Team);
             if n = 4 then