float HUD_CompareTeamScores(entity left, entity right)
{
- float vl, vr;
+ float i, r;
- if(left.team == COLOR_SPECTATOR)
+ if(left.team == FL_SPECTATOR)
return 1;
- if(right.team == COLOR_SPECTATOR)
+ if(right.team == FL_SPECTATOR)
return 0;
- vl = left.teamscores[ts_primary];
- vr = right.teamscores[ts_primary];
- if(vl > vr)
- return IS_INCREASING(teamscores_flags[ts_primary]);
- if(vl < vr)
- return IS_DECREASING(teamscores_flags[ts_primary]);
+ r = HUD_CompareScore(left.teamscores[ts_primary], right.teamscores[ts_primary], teamscores_flags[ts_primary]);
+ if (r >= 0)
+ return r;
- vl = left.teamscores[ts_secondary];
- vr = right.teamscores[ts_secondary];
- if(vl > vr)
- return IS_INCREASING(teamscores_flags[ts_secondary]);
- if(vl < vr)
- return IS_DECREASING(teamscores_flags[ts_secondary]);
+ r = HUD_CompareScore(left.teamscores[ts_secondary], right.teamscores[ts_secondary], teamscores_flags[ts_secondary]);
+ if (r >= 0)
+ return r;
+
+ for(i = 0; i < MAX_SCORE; ++i)
+ {
+ r = HUD_CompareScore(left.teamscores[i], right.teamscores[i], teamscores_flags[i]);
+ if (r >= 0)
+ return r;
+ }
+
+ if (left.team < right.team)
+ return true;
return false;
}