]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Race/CTS: if you have a fastest lap, you should show up in the scoreboard any time
authorRudolf Polzer <divverent@xonotic.org>
Tue, 29 Jan 2013 08:55:09 +0000 (09:55 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Tue, 29 Jan 2013 08:55:09 +0000 (09:55 +0100)
qcsrc/server/cl_client.qc
qcsrc/server/race.qc
qcsrc/server/scores_rules.qc

index 165460eeb2ae3ad678729611f873f927c7f65cb9..062d4474d73490974e1cad0c56f871bc5bab79ea 100644 (file)
@@ -534,6 +534,13 @@ void PutObserverInServer (void)
                else
                        self.frags = FRAGS_SPECTATOR;
        }
+       else if(g_race)
+       {
+               if(PlayerScore_Add(e, SP_RACE_FASTEST, 0))
+                       self.frags = FRAGS_LMS_LOSER;
+               else
+                       self.frags = FRAGS_SPECTATOR;
+       }
        else
                self.frags = FRAGS_SPECTATOR;
 }
index 16f6eca72c4c34fb44006ac6087391ed0563f0ee..2742888b6179bab1e088d5d4a222b778f01af3e2 100644 (file)
@@ -273,6 +273,10 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
                }
                else
                {
+                       s = PlayerScore_Add(e, SP_RACE_FASTEST, 0);
+                       if(!s || t < s)
+                               PlayerScore_Add(e, SP_RACE_FASTEST, t - s);
+
                        s = PlayerScore_Add(e, SP_RACE_TIME, 0);
                        snew = TIME_ENCODE(time - game_starttime);
                        PlayerScore_Add(e, SP_RACE_TIME, snew - s);
index c4021fc397ea3d2cf28c67e004bb9afdde68e1aa..b7947f0fa8e06755b511465aea2471be7566d3fb 100644 (file)
@@ -99,9 +99,8 @@ void ScoreRules_kh(float teams)
 // Race stuff
 #define ST_RACE_LAPS 1
 #define SP_RACE_LAPS 4
-#define SP_RACE_FASTEST 5
 #define SP_RACE_TIME 5
-//#define SP_RACE_RANK 6
+#define SP_RACE_FASTEST 6
 void ScoreRules_race()
 {
        ScoreRules_basics(race_teams, 0, 0, FALSE);
@@ -110,7 +109,7 @@ void ScoreRules_race()
                ScoreInfo_SetLabel_TeamScore(  ST_RACE_LAPS,    "laps",      SFL_SORT_PRIO_PRIMARY);
                ScoreInfo_SetLabel_PlayerScore(SP_RACE_LAPS,    "laps",      SFL_SORT_PRIO_PRIMARY);
                ScoreInfo_SetLabel_PlayerScore(SP_RACE_TIME,    "time",      SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME);
-               //ScoreInfo_SetLabel_PlayerScore(SP_RACE_RANK,    "rank",      SFL_LOWER_IS_BETTER | SFL_RANK | SFL_ALLOW_HIDE);
+               ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest",   SFL_LOWER_IS_BETTER | SFL_TIME);
        }
        else if(g_race_qualifying)
        {
@@ -118,9 +117,9 @@ void ScoreRules_race()
        }
        else
        {
-               //ScoreInfo_SetLabel_TeamScore(  ST_RACE_LAPS,    "laps",      0);
                ScoreInfo_SetLabel_PlayerScore(SP_RACE_LAPS,    "laps",      SFL_SORT_PRIO_PRIMARY);
                ScoreInfo_SetLabel_PlayerScore(SP_RACE_TIME,    "time",      SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME);
+               ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest",   SFL_LOWER_IS_BETTER | SFL_TIME);
        }
        ScoreRules_basics_end();
 }