hedgewars/GSHandlers.inc
changeset 601 78a68cc4d846
parent 590 e816adf4a27f
child 602 f7628ebfccde
equal deleted inserted replaced
600:f6e5f4e122db 601:78a68cc4d846
   864                              record
   864                              record
   865                              dy, ny, dw: LongInt;
   865                              dy, ny, dw: LongInt;
   866                              team: PTeam;
   866                              team: PTeam;
   867                              SortFactor: QWord;
   867                              SortFactor: QWord;
   868                              end;
   868                              end;
   869     currsorter: PGear;
   869     currsorter: PGear = nil;
   870 
   870 
   871 procedure doStepTeamHealthSorterWork(Gear: PGear);
   871 procedure doStepTeamHealthSorterWork(Gear: PGear);
   872 var i: LongInt;
   872 var i: LongInt;
   873 begin
   873 begin
   874 AllInactive:= false;
   874 AllInactive:= false;
   904       SortFactor:= TeamsArray[t]^.Clan^.ClanHealth;
   904       SortFactor:= TeamsArray[t]^.Clan^.ClanHealth;
   905       SortFactor:= (SortFactor shl  3) + TeamsArray[t]^.Clan^.ClanIndex;
   905       SortFactor:= (SortFactor shl  3) + TeamsArray[t]^.Clan^.ClanIndex;
   906       SortFactor:= (SortFactor shl 30) + TeamsArray[t]^.TeamHealth;
   906       SortFactor:= (SortFactor shl 30) + TeamsArray[t]^.TeamHealth;
   907       end;
   907       end;
   908 
   908 
   909 repeat
   909 if TeamsCount > 1 then
       
   910   repeat
   910     b:= true;
   911     b:= true;
   911     for t:= 0 to TeamsCount - 2 do
   912     for t:= 0 to TeamsCount - 2 do
   912         if (thexchar[t].SortFactor > thexchar[Succ(t)].SortFactor) then
   913         if (thexchar[t].SortFactor > thexchar[Succ(t)].SortFactor) then
   913            begin
   914            begin
   914            thexchar[cMaxTeams]:= thexchar[t];
   915            thexchar[cMaxTeams]:= thexchar[t];
   915            thexchar[t]:= thexchar[Succ(t)];
   916            thexchar[t]:= thexchar[Succ(t)];
   916            thexchar[Succ(t)]:= thexchar[cMaxTeams];
   917            thexchar[Succ(t)]:= thexchar[cMaxTeams];
   917            b:= false
   918            b:= false
   918            end
   919            end
   919 until b;
   920   until b;
   920 
   921 
   921 t:= cScreenHeight - 4;
   922 t:= cScreenHeight - 4;
   922 for i:= 0 to Pred(TeamsCount) do
   923 for i:= 0 to Pred(TeamsCount) do
   923     with thexchar[i] do
   924     with thexchar[i] do
   924          begin
   925          begin