// 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)
vector text_ofs = vec2(0.5 * hud_fontsize.x, (1.25 - 1) / 2 * hud_fontsize.y); // center text vertically
string str = "";
int column = 0, j = 0;
+ string zoned_name_self = strzone(strdecolorize(entcs_GetName(player_localnum)));
for(i = 0; i < RANKINGS_RECEIVED_CNT; ++i)
{
float t;
if (t == 0)
continue;
- if(strdecolorize(grecordholder[i]) == strdecolorize(entcs_GetName(player_localnum)))
+ if(strdecolorize(grecordholder[i]) == zoned_name_self)
drawfill(pos, columnsize, hl_rgb, sbt_highlight_alpha_self, DRAWFLAG_NORMAL);
else if(!((j + column) & 1) && sbt_highlight)
drawfill(pos, columnsize, hl_rgb, sbt_highlight_alpha, DRAWFLAG_NORMAL);
pos.y = panel_pos.y;
}
}
+ strfree(zoned_name_self);
panel_size.x += panel_bg_padding * 2; // restore initial width
return end_pos;