hedgewars/GSHandlers.inc
changeset 547 b81a055f2d06
parent 545 f527450337c1
child 549 4278a80140a8
equal deleted inserted replaced
546:0e7cc3fb05cd 547:b81a055f2d06
   872    DeleteGear(Gear)
   872    DeleteGear(Gear)
   873    end
   873    end
   874 end;
   874 end;
   875 
   875 
   876 procedure doStepTeamHealthSorter(Gear: PGear);
   876 procedure doStepTeamHealthSorter(Gear: PGear);
   877 var team: PTeam;
   877 var i, t: Longword;
   878     i, t: Longword;
   878 begin
   879 begin
   879 AllInactive:= false;
   880 AllInactive:= false;
       
   881 team:= TeamsList;
       
   882 i:= 0;
   880 i:= 0;
   883 while team <> nil do
   881 for t:= 0 to Pred(TeamsCount) do
   884       begin
   882    with TeamsArray[t]^ do
   885       thexchar[i].oy:= team^.DrawHealthY;
   883       begin
   886       thexchar[i].team:= team;
   884       thexchar[i].oy:= DrawHealthY;
       
   885       thexchar[i].team:= TeamsArray[t];
   887       inc(i);
   886       inc(i);
   888       team:= team^.Next
       
   889       end;
   887       end;
       
   888 
   890 thexchcnt:= i;
   889 thexchcnt:= i;
   891 for i:= 1 to thexchcnt do
   890 for i:= 1 to thexchcnt do
   892     for t:= 0 to thexchcnt - 2 do
   891     for t:= 0 to thexchcnt - 2 do
   893         if thexchar[t].team^.TeamHealthBarWidth > thexchar[Succ(t)].team^.TeamHealthBarWidth then
   892         if thexchar[t].team^.TeamHealthBarWidth > thexchar[Succ(t)].team^.TeamHealthBarWidth then
   894            begin
   893            begin
   895            thexchar[5]:= thexchar[t];
   894            thexchar[5]:= thexchar[t];
   896            thexchar[t]:= thexchar[Succ(t)];
   895            thexchar[t]:= thexchar[Succ(t)];
   897            thexchar[Succ(t)]:= thexchar[5]
   896            thexchar[Succ(t)]:= thexchar[5]
   898            end;
   897            end;
       
   898            
   899 t:= cScreenHeight - 4;
   899 t:= cScreenHeight - 4;
   900 for i:= 0 to Pred(thexchcnt) do
   900 for i:= 0 to Pred(thexchcnt) do
   901     with thexchar[i] do
   901     with thexchar[i] do
   902          begin
   902          begin
   903          dec(t, team^.HealthRect.h + 2);
   903          dec(t, team^.HealthRect.h + 2);
   904          ny:= t
   904          ny:= t
   905          end;
   905          end;
       
   906          
   906 Gear^.Timer:= 640;
   907 Gear^.Timer:= 640;
   907 Gear^.doStep:= @doStepTeamHealthSorterWork;
   908 Gear^.doStep:= @doStepTeamHealthSorterWork;
   908 currsorter:= Gear
   909 currsorter:= Gear
   909 end;
   910 end;
   910 
   911