]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
add a nospectator flag to rank sorting
authorRudolf Polzer <divverent@xonotic.org>
Tue, 29 Jan 2013 08:46:02 +0000 (09:46 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Tue, 29 Jan 2013 08:46:02 +0000 (09:46 +0100)
qcsrc/server/race.qc
qcsrc/server/scores.qc
qcsrc/server/scores.qh

index f761b18ba140cb1257a1e43b05f95a756ea31de8..16f6eca72c4c34fb44006ac6087391ed0563f0ee 100644 (file)
@@ -1026,7 +1026,7 @@ void race_ReadyRestart()
        Score_NicePrint(world);
 
        race_ClearRecords();
-       PlayerScore_Sort(race_place, 0, 1);
+       PlayerScore_Sort(race_place, 0, 1, 0);
 
        entity e;
        FOR_EACH_CLIENT(e)
index 354f5a784f9ce24479f8c11766268062a52be74e..1adfb0cc50914d69829073810d697d24bf45d233 100644 (file)
@@ -685,7 +685,7 @@ float PlayerTeamScore_Compare(entity p1, entity p2, float teams, float strict)
        return PlayerScore_Compare(p1.scorekeeper, p2.scorekeeper, strict);
 }
 
-entity PlayerScore_Sort(.float field, float teams, float strict)
+entity PlayerScore_Sort(.float field, float teams, float strict, float nospectators)
 {
        entity p, plist, pprev, pbest, pbestprev, pfirst, plast;
        float i, j;
@@ -697,6 +697,10 @@ entity PlayerScore_Sort(.float field, float teams, float strict)
 
        FOR_EACH_PLAYER(p) if(p.scorekeeper)
        {
+               if(nospectators)
+                       if(p.frags == FRAGS_SPECTATOR)
+                               continue;
+
                p.chain = plist;
                plist = p;
        }
@@ -871,7 +875,7 @@ void Score_NicePrint(entity to)
                        ++t;
        w = bound(6, floor(SCORESWIDTH / t - 1), 9);
 
-       p = PlayerScore_Sort(score_dummyfield, 1, 1);
+       p = PlayerScore_Sort(score_dummyfield, 1, 1, 0);
        t = -1;
 
        if(!teamscores_entities_count)
index 423fd303cf3a4da0103ae06c18ed1f98113d65ab..60f4d24f6bdeaf6271a223b3919d8bd1e6bed767 100644 (file)
@@ -119,5 +119,6 @@ string GetTeamScoreString(float tm, float shortString);
  * Returns the beginning of a sorted chain of the non-spectators.
  * teams: >0: sort by teams first (always strict ordering); <0: sort by teams only (respects strict flag)
  * strict: return a strict ordering
+ * nospectators: exclude spectators
  */
-entity PlayerScore_Sort(.float field, float teams, float strict);
+entity PlayerScore_Sort(.float field, float teams, float strict, float nospectators);