distribute health evenly amongst graves instead of randomly - avoid situation where a grave stays dead
authornemo
Fri, 12 Nov 2010 13:54:22 -0500
changeset 4265 039b08012887
parent 4262 154253f77b03
child 4267 37c2d0d3a039
distribute health evenly amongst graves instead of randomly - avoid situation where a grave stays dead
hedgewars/GSHandlers.inc
hedgewars/uGears.pas
--- a/hedgewars/GSHandlers.inc	Fri Nov 12 12:35:30 2010 -0500
+++ b/hedgewars/GSHandlers.inc	Fri Nov 12 13:54:22 2010 -0500
@@ -4244,12 +4244,13 @@
 
     if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) and (TurnTimeLeft > 0) then 
         begin
-        i := getRandom(Length(graves));
+        if Length(graves) > Gear^.Tag then Gear^.Tag:= 0;
         dec(hh^.Gear^.Health);
         if (hh^.Gear^.Health = 0) and (hh^.Gear^.Damage = 0) then
             hh^.Gear^.Damage:= 1;
         RenderHealth(hh^);
-        inc(graves[i]^.Health);
+        inc(graves[Gear^.Tag]^.Health);
+        inc(Gear^.Tag)
 {-for i:= 0 to High(graves) do begin
             if hh^.Gear^.Health > 0 then begin
                 dec(hh^.Gear^.Health);
--- a/hedgewars/uGears.pas	Fri Nov 12 12:35:30 2010 -0500
+++ b/hedgewars/uGears.pas	Fri Nov 12 13:54:22 2010 -0500
@@ -540,6 +540,7 @@
                 end;
  gtResurrector: begin
                 gear^.Radius := 100;
+                gear^.Tag := 0
                 end;
      gtWaterUp: begin
                 gear^.Tag := 47;