]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/race.qc
Merge branch 'master' into cloudwalk9/mgburstfix
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / race.qc
index 183da23f9a6944ce0c5424ee1e17ff94086c5edf..9a12a04866c2c251fdd333725f0a22c4af757fff 100644 (file)
 #include <common/gamemodes/rules.qh>
 #include <common/net_linked.qh>
 #include <common/state.qh>
+#include <common/weapons/weapon/porto.qh>
 #include "../common/mapobjects/subs.qh"
 #include <common/mapobjects/triggers.qh>
 #include "../lib/warpzone/util_server.qh"
 #include "../lib/warpzone/common.qh"
+#include <common/vehicles/sv_vehicles.qh>
 #include "../common/mutators/mutator/waypoints/waypointsprites.qh"
 
 IntrusiveList g_race_targets;
-STATIC_INIT(g_race_targets) { g_race_targets = IL_NEW(); }
+IntrusiveList g_racecheckpoints;
+STATIC_INIT(g_race)
+{
+       g_race_targets = IL_NEW();
+       g_racecheckpoints = IL_NEW();
+}
 
 void race_InitSpectator()
 {
@@ -30,8 +37,6 @@ void race_InitSpectator()
                        race_SendNextCheckpoint(msg_entity.enemy, 1);
 }
 
-void W_Porto_Fail(entity this, float failhard);
-
 float race_readTime(string map, float pos)
 {
        string rr = ((g_cts) ? CTS_RECORD : ((g_ctf) ? CTF_RECORD : RACE_RECORD));
@@ -85,8 +90,11 @@ void race_writeTime(string map, float t, string myuid)
                // player has no ranked record yet
                for (i = RANKINGS_CNT; i > newpos; --i)
                {
-                       db_put(ServerProgsDB, strcat(map, rr, "time", ftos(i)), ftos(race_readTime(map, i - 1)));
-                       db_put(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(i)), race_readUID(map, i - 1));
+                       float other_time = race_readTime(map, i - 1);
+                       if (other_time) {
+                               db_put(ServerProgsDB, strcat(map, rr, "time", ftos(i)), ftos(other_time));
+                               db_put(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(i)), race_readUID(map, i - 1));
+                       }
                }
        }
 
@@ -105,8 +113,6 @@ string race_readName(string map, float pos)
 
 const float MAX_CHECKPOINTS = 255;
 
-spawnfunc(target_checkpoint);
-
 .float race_penalty;
 .float race_penalty_accumulator;
 .string race_penalty_reason;
@@ -566,6 +572,9 @@ void race_ClearTime(entity e)
 
 void checkpoint_passed(entity this, entity player)
 {
+       if(IS_VEHICLE(player) && player.owner)
+               player = player.owner;
+
        if(player.personal && autocvar_g_allow_checkpoints)
                return; // practice mode!