# HG changeset patch
# User nemo
# Date 1289602489 18000
# Node ID 160f987a5d9fe38b4de771a11cea1b341baad760
# Parent  4b7d3507d1750bdfd019a2c21ea2bf08b0122bf3
improve behaviour of resurrection. pull in 4254 and 4259 which replace random with index

diff -r 4b7d3507d175 -r 160f987a5d9f hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Fri Nov 12 17:53:35 2010 -0500
+++ b/hedgewars/GSHandlers.inc	Fri Nov 12 17:54:49 2010 -0500
@@ -4240,12 +4240,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);
diff -r 4b7d3507d175 -r 160f987a5d9f hedgewars/uGears.pas
--- a/hedgewars/uGears.pas	Fri Nov 12 17:53:35 2010 -0500
+++ b/hedgewars/uGears.pas	Fri Nov 12 17:54:49 2010 -0500
@@ -540,6 +540,7 @@
                 end;
  gtResurrector: begin
                 gear^.Radius := 100;
+                gear^.Tag := 0
                 end;
      gtWaterUp: begin
                 gear^.Tag := 47;