]> 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 350872ce77148f529726459d93c35954ef8140cb..9a12a04866c2c251fdd333725f0a22c4af757fff 100644 (file)
 #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()
 {
@@ -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!
 
@@ -715,8 +724,6 @@ void checkpoint_passed(entity this, entity player)
 void checkpoint_touch(entity this, entity toucher)
 {
        EXACTTRIGGER_TOUCH(this, toucher);
-       if(IS_VEHICLE(toucher) && toucher.owner)
-               toucher = toucher.owner;
        checkpoint_passed(this, toucher);
 }
 
@@ -725,8 +732,6 @@ void checkpoint_use(entity this, entity actor, entity trigger)
        if(trigger.classname == "info_player_deathmatch") // a spawn, a spawn
                return;
 
-       if(IS_VEHICLE(actor) && actor.owner)
-               actor = actor.owner;
        checkpoint_passed(this, actor);
 }