]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/panel/modicons.qc
Optimize hud code displaying race/cts records/rankings
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / panel / modicons.qc
index 4d1691a7fd57798ac639b7023f6a04f81e476a36..6a905a8d5b00d236ccb2b3cb9979048d56a73097 100644 (file)
@@ -496,11 +496,16 @@ string race_status_name_prev;
 // Check if the given name already exist in race rankings? In that case, where? (otherwise return 0)
 int race_CheckName(string net_name)
 {
-       int i;
-       for (i=RANKINGS_CNT-1;i>=0;--i)
-               if(strdecolorize(grecordholder[i]) == strdecolorize(net_name))
-                       return i+1;
-       return 0;
+       int rank = 0;
+       string zoned_name = strzone(strdecolorize(entcs_GetName(player_localnum)));
+       for (int i = RANKINGS_CNT - 1; i >= 0; --i)
+               if (strdecolorize(grecordholder[i]) == zoned_name)
+               {
+                       rank = i + 1;
+                       break;
+               }
+       strfree(zoned_name);
+       return rank;
 }
 
 void race_showTime(string text, vector pos, vector timeText_ofs, float theTime, vector textSize, float f)