Use separate variable to store number of records to arrive from the server
authorMorosophos <ahci0op@yandex.ru>
Tue, 5 Jun 2018 07:22:34 +0000 (10:22 +0300)
committerMorosophos <ahcie0op@yandex.ru>
Tue, 5 Jun 2018 07:23:03 +0000 (10:23 +0300)
qcsrc/client/main.qc
qcsrc/client/main.qh

index 9f1061dc9dd6bafaa43016b9a612108febd05a29..9222d976b0b31a39a3807189e1dbe8991f01e68d 100644 (file)
@@ -1145,7 +1145,7 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        strcpy(race_speedaward_alltimebest_unit, GetSpeedUnit(autocvar_hud_panel_physics_speed_unit));
                        break;
                case RACE_NET_RANKINGS_CNT:
-                       RANKINGS_RECEIVED_CNT = ReadByte();
+                       RANKINGS_DISPLAY_CNT = ReadByte();
                        break;
                case RACE_NET_SERVER_RANKINGS:
                        float prevpos, del;
@@ -1156,14 +1156,14 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                        // move other rankings out of the way
             int i;
                        if (prevpos) {
-                               int m = min(prevpos, RANKINGS_RECEIVED_CNT);
+                               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_RECEIVED_CNT-1; ++i) {
-                                       if (i == RANKINGS_RECEIVED_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]);
                                        }
@@ -1173,16 +1173,16 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew)
                                        }
                                }
                        } else { // player has no ranked record yet
-                               for (i=RANKINGS_RECEIVED_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_RECEIVED_CNT]) {
+                       if (grecordtime[RANKINGS_DISPLAY_CNT]) {
                                // kick off the player who fell from the last displayed position
-                               grecordtime[RANKINGS_RECEIVED_CNT] = 0;
-                               strfree(grecordholder[RANKINGS_RECEIVED_CNT]);
+                               grecordtime[RANKINGS_DISPLAY_CNT] = 0;
+                               strfree(grecordholder[RANKINGS_DISPLAY_CNT]);
                        }
 
                        // store new ranking
index a2f4d18bba97e2ef4070fe83ac362d83dd462404..70189b3a23b2a36099f342cfd7f410017f4930c3 100644 (file)
@@ -24,6 +24,7 @@ void LoadMenuSkinValues();
 vector hud_fontsize;
 
 float RANKINGS_RECEIVED_CNT;
+float RANKINGS_DISPLAY_CNT;
 string grecordholder[RANKINGS_CNT];
 float grecordtime[RANKINGS_CNT];