]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/race.qc
Merge branch 'terencehill/ca_arena_mutators' of git://git.xonotic.org/xonotic/xonotic...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / race.qc
index 911106a30560358e6ae03054ab21526dc0e6ad8a..2742888b6179bab1e088d5d4a222b778f01af3e2 100644 (file)
@@ -141,6 +141,7 @@ void race_setTime(string map, float t, string myuid, string mynetname, entity e)
        newpos = race_readPos(map, t);
 
        float i;
+       player_prevpos = 0;
        for(i = 1; i <= RANKINGS_CNT; ++i)
        {
                if(race_readUID(map, i) == myuid)
@@ -272,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);
@@ -490,8 +495,8 @@ void checkpoint_passed()
                        self.race_checkpoint = other.race_checkpoint;
                }
 
-               float largest_cp_id;
-               float cp_amount;
+               float largest_cp_id = 0;
+               float cp_amount = 0;
                for(cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
                        cp_amount += 1;
                        if(cp.race_checkpoint > largest_cp_id) // update the finish id if someone hit a new checkpoint
@@ -664,7 +669,7 @@ void trigger_race_checkpoint_verify()
                g_race_qualifying = 1;
                self.race_place = race_lowest_place_spawn;
                if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, FALSE))
-                       error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
+                       error(strcat("Checkpoint 0 misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
        }
        else
        {
@@ -710,7 +715,7 @@ void trigger_race_checkpoint_verify()
                        }
 
                        if(defragcpexists != -1){
-                               float largest_cp_id;
+                               float largest_cp_id = 0;
                                for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
                                        if(cp.race_checkpoint > largest_cp_id)
                                                largest_cp_id = cp.race_checkpoint;
@@ -816,11 +821,11 @@ void spawnfunc_trigger_race_checkpoint()
        waypoint_spawnforitem_force(self, trace_endpos);
        self.nearestwaypointtimeout = time + 1000000000;
 
-       if(!self.message)
+       if(self.message == "")
                self.message = "went backwards";
-       if (!self.message2)
+       if (self.message2 == "")
                self.message2 = "was pushed backwards by";
-       if (!self.race_penalty_reason)
+       if (self.race_penalty_reason == "")
                self.race_penalty_reason = "missing a checkpoint";
        
        self.race_checkpoint = self.cnt;
@@ -869,11 +874,11 @@ void spawnfunc_target_checkpoint() // defrag entity
        waypoint_spawnforitem_force(self, trace_endpos);
        self.nearestwaypointtimeout = time + 1000000000;
 
-       if(!self.message)
+       if(self.message == "")
                self.message = "went backwards";
-       if (!self.message2)
+       if (self.message2 == "")
                self.message2 = "was pushed backwards by";
-       if (!self.race_penalty_reason)
+       if (self.race_penalty_reason == "")
                self.race_penalty_reason = "missing a checkpoint";
 
        if(self.classname == "target_startTimer")
@@ -1025,7 +1030,7 @@ void race_ReadyRestart()
        Score_NicePrint(world);
 
        race_ClearRecords();
-       PlayerScore_Sort(race_place);
+       PlayerScore_Sort(race_place, 0, 1, 0);
 
        entity e;
        FOR_EACH_CLIENT(e)
@@ -1101,7 +1106,7 @@ void spawnfunc_trigger_race_penalty()
        if not(self.spawnflags & 1)
                self.touch = penalty_touch;
 
-       if (!self.race_penalty_reason)
+       if (self.race_penalty_reason == "")
                self.race_penalty_reason = "missing a checkpoint";
        if (!self.race_penalty)
                self.race_penalty = 5;