]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/main.qc
Merge branch 'terencehill/min_spec_time' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / main.qc
index 37027d25cd35570419c819179b207311580f157e..efb1fa204eed951d8014b976eee0528865dc8f94 100644 (file)
@@ -9,12 +9,11 @@
 #include <common/effects/all.inc>
 #include "hud/_mod.qh"
 #include "mapvoting.qh"
-#include "mutators/events.qh"
+#include <client/mutators/_mod.qh>
 #include "hud/panel/scoreboard.qh"
 #include "hud/panel/quickmenu.qh"
 #include "shownames.qh"
 #include <common/t_items.qh>
-#include "wall.qh"
 #include "weapons/projectile.qh"
 #include <common/deathtypes/all.qh>
 #include <common/items/_mod.qh>
@@ -24,7 +23,7 @@
 #include <common/net_linked.qh>
 #include <common/net_notice.qh>
 #include <common/scores.qh>
-#include <common/triggers/include.qh>
+#include <common/mapobjects/_mod.qh>
 #include <common/vehicles/all.qh>
 #include <lib/csqcmodel/cl_model.qh>
 #include <lib/csqcmodel/interpolate.qh>
@@ -1144,6 +1143,9 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        strcpy(race_speedaward_alltimebest_holder, ReadString());
                        strcpy(race_speedaward_alltimebest_unit, GetSpeedUnit(autocvar_hud_panel_physics_speed_unit));
                        break;
+               case RACE_NET_RANKINGS_CNT:
+                       RANKINGS_DISPLAY_CNT = ReadByte();
+                       break;
                case RACE_NET_SERVER_RANKINGS:
                        float prevpos, del;
             int pos = ReadShort();
@@ -1153,13 +1155,14 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        // move other rankings out of the way
             int i;
                        if (prevpos) {
-                               for (i=prevpos-1;i>pos-1;--i) {
+                               int m = min(prevpos, RANKINGS_DISPLAY_CNT);
+                               for (i=m-1; i>pos-1; --i) {
                                        grecordtime[i] = grecordtime[i-1];
                                        strcpy(grecordholder[i], grecordholder[i-1]);
                                }
                        } else if (del) { // a record has been deleted by the admin
-                               for (i=pos-1; i<= RANKINGS_CNT-1; ++i) {
-                                       if (i == RANKINGS_CNT-1) { // clear out last record
+                               for (i=pos-1; i<= RANKINGS_DISPLAY_CNT-1; ++i) {
+                                       if (i == RANKINGS_DISPLAY_CNT-1) { // clear out last record
                                                grecordtime[i] = 0;
                                                strfree(grecordholder[i]);
                                        }
@@ -1169,12 +1172,18 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                                        }
                                }
                        } else { // player has no ranked record yet
-                               for (i=RANKINGS_CNT-1;i>pos-1;--i) {
+                               for (i=RANKINGS_DISPLAY_CNT-1;i>pos-1;--i) {
                                        grecordtime[i] = grecordtime[i-1];
                                        strcpy(grecordholder[i], grecordholder[i-1]);
                                }
                        }
 
+                       if (grecordtime[RANKINGS_DISPLAY_CNT]) {
+                               // kick off the player who fell from the last displayed position
+                               grecordtime[RANKINGS_DISPLAY_CNT] = 0;
+                               strfree(grecordholder[RANKINGS_DISPLAY_CNT]);
+                       }
+
                        // store new ranking
                        strcpy(grecordholder[pos-1], ReadString());
                        grecordtime[pos-1] = ReadInt24_t();