restore uid on resurrection as well
authornemo
Thu, 08 Oct 2015 10:42:00 -0400
changeset 11202 a85b0ef91685
parent 11201 9301550d2566
child 11203 2f4d0a387a02
restore uid on resurrection as well
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsHedgehog.pas
--- a/hedgewars/uGearsHandlersMess.pas	Wed Oct 07 23:20:31 2015 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Thu Oct 08 10:42:00 2015 -0400
@@ -5430,6 +5430,7 @@
             if graves.ar^[i]^.Health > 0 then
                 begin
                 resgear := AddGear(hwRound(graves.ar^[i]^.X), hwRound(graves.ar^[i]^.Y), gtHedgehog, gstWait, _0, _0, 0);
+                resgear^.uid:= graves.ar^[i]^.Pos;
                 resgear^.Hedgehog := graves.ar^[i]^.Hedgehog;
                 resgear^.Health := graves.ar^[i]^.Health;
                 PHedgehog(graves.ar^[i]^.Hedgehog)^.Gear := resgear;
--- a/hedgewars/uGearsHedgehog.pas	Wed Oct 07 23:20:31 2015 +0200
+++ b/hedgewars/uGearsHedgehog.pas	Thu Oct 08 10:42:00 2015 -0400
@@ -572,6 +572,7 @@
 procedure doStepHedgehogDead(Gear: PGear);
 const frametime = 200;
       timertime = frametime * 6;
+var grave:  PGear;
 begin
 if Gear^.Hedgehog^.Unplaced then
     exit;
@@ -587,7 +588,10 @@
     Gear^.Hedgehog^.Effects[heFrozen]:= 0;
     Gear^.State:= Gear^.State or gstNoDamage;
     doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, CurrentHedgehog, EXPLAutoSound);
-    AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtGrave, 0, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
+    grave:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtGrave, 0, _0, _0, 0);
+    grave^.Hedgehog:= Gear^.Hedgehog;
+    grave^.Pos:= Gear^.uid;
+    
     DeleteGear(Gear);
     SetAllToActive
     end