Fix game extremely slowing down if hog collects crate with huge health, or vampire gets huge health.
authorWuzzy <almikes@aol.com>
Wed, 23 Nov 2016 20:25:44 +0100
changeset 12053 475a1289f940
parent 12052 7163626748e0
child 12054 030464f34d47
Fix game extremely slowing down if hog collects crate with huge health, or vampire gets huge health.
hedgewars/uGearsHedgehog.pas
hedgewars/uGearsUtils.pas
--- a/hedgewars/uGearsHedgehog.pas	Wed Nov 23 19:43:40 2016 +0100
+++ b/hedgewars/uGearsHedgehog.pas	Wed Nov 23 20:25:44 2016 +0100
@@ -748,7 +748,7 @@
                     RecountTeamHealth(HH^.Hedgehog^.Team);
 
                     i:= 0;
-                    while i < Gear^.Health do
+                    while (i < Gear^.Health) and (i <= 1000) do
                         begin
                         vga:= AddVisualGear(hwRound(HH^.X), hwRound(HH^.Y), vgtStraightShot);
                         if vga <> nil then
--- a/hedgewars/uGearsUtils.pas	Wed Nov 23 19:43:40 2016 +0100
+++ b/hedgewars/uGearsUtils.pas	Wed Nov 23 20:25:44 2016 +0100
@@ -282,7 +282,7 @@
                     RenderHealth(CurrentHedgehog^);
                     RecountTeamHealth(CurrentHedgehog^.Team);
                     i:= 0;
-                    while i < vampDmg do
+                    while (i < vampDmg) and (i < 1000) do
                         begin
                         vg:= AddVisualGear(hwRound(CurrentHedgehog^.Gear^.X), hwRound(CurrentHedgehog^.Gear^.Y), vgtStraightShot);
                         if vg <> nil then