hedgewars/GSHandlers.inc
changeset 143 3dacbd83209b
parent 113 d975a426ebf7
child 146 458f4f58c1b6
--- a/hedgewars/GSHandlers.inc	Mon Sep 11 18:27:49 2006 +0000
+++ b/hedgewars/GSHandlers.inc	Mon Sep 11 21:44:38 2006 +0000
@@ -742,6 +742,7 @@
                              team: PTeam;
                              end;
     thexchcnt: Longword;
+    currsorter: PGear;
 
 procedure doStepTeamHealthSorterWork(Gear: PGear);
 var i: integer;
@@ -754,8 +755,11 @@
             {$WARNINGS OFF}
             team.DrawHealthY:= ny + (oy - ny) * Gear.Timer div 640;
             {$WARNINGS ON}
-if Gear.Timer = 0 then
+if (Gear.Timer = 0) or (currsorter <> Gear) then
+   begin
+   if currsorter = Gear then currsorter:= nil;
    DeleteGear(Gear)
+   end
 end;
 
 procedure doStepTeamHealthSorter(Gear: PGear);
@@ -789,7 +793,8 @@
          ny:= t
          end;
 Gear.Timer:= 640;
-Gear.doStep:= doStepTeamHealthSorterWork
+Gear.doStep:= doStepTeamHealthSorterWork;
+currsorter:= Gear
 end;
 
 ////////////////////////////////////////////////////////////////////////////////