Nuke MAX_SCOREBOARDNAME from qw.

It was different from nq's MAX_SCOREBOARDNAME, and not really necessary,
what with being able to uuse info_key_t caches.
This commit is contained in:
Bill Currie 2012-05-21 23:04:47 +09:00
parent b4ad695e16
commit 1aa2c22169
7 changed files with 40 additions and 41 deletions

View file

@ -60,16 +60,13 @@ typedef struct player_state_s {
} player_state_t;
#undef MAX_SCOREBOARDNAME
#define MAX_SCOREBOARDNAME 16
typedef struct player_info_s
{
int userid;
struct info_s *userinfo;
// scoreboard information
char name[MAX_SCOREBOARDNAME];
struct info_key_s *name;
float entertime;
int frags;
int ping;

View file

@ -355,7 +355,7 @@ Cam_CheckHighTarget (void)
j = -1;
for (i = 0, max = -9999; i < MAX_CLIENTS; i++) {
s = &cl.players[i];
if (s->name[0] && !s->spectator && s->frags > max) {
if (s->name->value[0] && !s->spectator && s->frags > max) {
max = s->frags;
j = i;
}
@ -391,7 +391,7 @@ Cam_Track (usercmd_t *cmd)
return;
if (locked
&& (!cl.players[spec_track].name[0]
&& (!cl.players[spec_track].name->value[0]
|| cl.players[spec_track].spectator)) {
locked = false;
if (cl_hightrack->int_val)
@ -620,7 +620,7 @@ Cam_FinishMove (usercmd_t *cmd)
i = end;
do {
s = &cl.players[i];
if (s->name[0] && !s->spectator) {
if (s->name->value[0] && !s->spectator) {
Cam_Lock (i);
ideal_track = i;
return;
@ -630,7 +630,7 @@ Cam_FinishMove (usercmd_t *cmd)
// stay on same guy?
i = spec_track;
s = &cl.players[i];
if (s->name[0] && !s->spectator) {
if (s->name->value[0] && !s->spectator) {
Cam_Lock (i);
ideal_track = i;
return;

View file

@ -406,7 +406,7 @@ CL_LinkPlayers (void)
if (state->messagenum != cl.parsecount)
continue; // not present this frame
if (!info->name[0])
if (!info->name || !info->name->value[0])
continue;
// spawn light flashes, even ones coming from invisible objects

View file

@ -543,10 +543,10 @@ CL_User_f (void)
uid = atoi (Cmd_Argv (1));
for (i = 0; i < MAX_CLIENTS; i++) {
if (!cl.players[i].name[0])
if (!cl.players[i].name->value[0])
continue;
if (cl.players[i].userid == uid
|| !strcmp (cl.players[i].name, Cmd_Argv (1))) {
|| !strcmp (cl.players[i].name->value, Cmd_Argv (1))) {
Info_Print (cl.players[i].userinfo);
return;
}
@ -568,9 +568,9 @@ CL_Users_f (void)
Sys_Printf ("userid frags name\n");
Sys_Printf ("------ ----- ----\n");
for (i = 0; i < MAX_CLIENTS; i++) {
if (cl.players[i].name[0]) {
if (cl.players[i].name->value[0]) {
Sys_Printf ("%6i %4i %s\n", cl.players[i].userid,
cl.players[i].frags, cl.players[i].name);
cl.players[i].frags, cl.players[i].name->value);
c++;
}
}

View file

@ -1090,12 +1090,13 @@ CL_ProcessUserInfo (int slot, player_info_t *player)
Info_SetValueForKey (player->userinfo, "skin", skin, 1);
}
s = Info_ValueForKey (player->userinfo, "name");
if (!*s && player->userid)
Info_SetValueForKey (player->userinfo, "name",
va ("user-%i [exploit]", player->userid), 1);
strncpy (player->name, Info_ValueForKey (player->userinfo, "name"),
sizeof (player->name) - 1);
while (!(player->name = Info_Key (player->userinfo, "name"))) {
if (player->userid)
Info_SetValueForKey (player->userinfo, "name",
va ("user-%i [exploit]", player->userid), 1);
else
Info_SetValueForKey (player->userinfo, "name", "", 1);
}
player->_topcolor = player->_bottomcolor = -1;
player->topcolor = atoi (Info_ValueForKey (player->userinfo, "topcolor"));
player->bottomcolor =
@ -1170,8 +1171,6 @@ CL_SetInfo (void)
strncpy (value, MSG_ReadString (net_message), sizeof (value) - 1);
key[sizeof (value) - 1] = 0;
Sys_MaskPrintf (SYS_DEV, "SETINFO %s: %s=%s\n", player->name, key, value);
if (!player->userinfo)
player->userinfo = Info_ParseString ("", MAX_INFO_STRING, 0);
@ -1180,6 +1179,9 @@ CL_SetInfo (void)
Info_SetValueForKey (player->userinfo, key, value, flags);
CL_ProcessUserInfo (slot, player);
Sys_MaskPrintf (SYS_DEV, "SETINFO %s: %s=%s\n", player->name->value, key,
value);
}
static void

View file

@ -72,7 +72,7 @@ Skin_NextDownload (void)
for (; cls.downloadnumber != MAX_CLIENTS; cls.downloadnumber++) {
sc = &cl.players[cls.downloadnumber];
if (!sc->name[0])
if (!sc->name || !sc->name->value[0])
continue;
//XXX Skin_Find (sc);
if (noskins->int_val) //XXX FIXME
@ -86,7 +86,7 @@ Skin_NextDownload (void)
// now load them in for real
for (i = 0; i < MAX_CLIENTS; i++) {
sc = &cl.players[i];
if (!sc->name[0])
if (!sc->name || !sc->name->value[0])
continue;
//XXX Skin_Find (sc);
//XXX Skin_Cache (sc->skin);

View file

@ -381,8 +381,8 @@ Sbar_SortFrags (qboolean includespec)
// sort by frags
scoreboardlines = 0;
for (i = 0; i < MAX_CLIENTS; i++) {
if (cl.players[i].name[0] && (!cl.players[i].spectator ||
includespec)) {
if (cl.players[i].name && cl.players[i].name->value[0]
&& (!cl.players[i].spectator || includespec)) {
fragsort[scoreboardlines] = i;
scoreboardlines++;
if (cl.players[i].spectator)
@ -420,7 +420,7 @@ Sbar_SortTeams (void)
for (i = 0; i < MAX_CLIENTS; i++) {
s = &cl.players[i];
if (!s->name[0])
if (!s->name || !s->name->value[0])
continue;
if (s->spectator)
continue;
@ -739,7 +739,7 @@ dmo_team (view_t *view, int x, int y, player_info_t *s)
static inline void
dmo_name (view_t *view, int x, int y, player_info_t *s)
{
draw_string (view, x, y, s->name);
draw_string (view, x, y, s->name->value);
}
static void
@ -760,7 +760,7 @@ draw_frags (view_t *view)
for (i = 0; i < l; i++) {
k = fragsort[i];
s = &cl.players[k];
if (!s->name[0])
if (!s->name || !s->name->value[0])
continue;
if (s->spectator)
continue;
@ -836,7 +836,7 @@ draw_spectator (view_t *view)
} else {
// Sbar_DrawString (160-14*8+4,4, "SPECTATOR MODE - TRACK CAMERA");
snprintf (st, sizeof (st), "Tracking %-.13s, [JUMP] for next",
cl.players[spec_track].name);
cl.players[spec_track].name->value);
draw_string (view, 0, -8, st);
}
}
@ -1078,7 +1078,7 @@ Sbar_LogFrags (void)
for (i = 0; i < l; i++) {
k = fragsort[i];
s = &cl.players[k];
if (!s->name[0])
if (!s->name || !s->name->value[0])
continue;
// draw pl
@ -1097,8 +1097,8 @@ Sbar_LogFrags (void)
fph = calc_fph (f, total);
name = malloc (strlen (s->name) + 1);
for (cp = (byte *) s->name, d = 0; *cp; cp++, d++)
name = malloc (strlen (s->name->value) + 1);
for (cp = (byte *) s->name->value, d = 0; *cp; cp++, d++)
name[d] = sys_char_map[*cp];
name[d] = 0;
@ -1144,7 +1144,7 @@ Sbar_Draw_DMO_Team_Ping (view_t *view, int l, int y, int skip)
for (i = 0; i < l && y <= view->ylen - 10; i++) {
k = fragsort[i];
s = &cl.players[k];
if (!s->name[0])
if (!s->name || !s->name->value[0])
continue;
dmo_ping (view, x + 0, y, s);
@ -1183,7 +1183,7 @@ Sbar_Draw_DMO_Team_UID (view_t *view, int l, int y, int skip)
for (i = 0; i < l && y <= view->ylen - 10; i++) {
k = fragsort[i];
s = &cl.players[k];
if (!s->name[0])
if (!s->name || !s->name->value[0])
continue;
dmo_uid (view, x + 0, y, s);
@ -1223,7 +1223,7 @@ Sbar_Draw_DMO_Team_Ping_UID (view_t *view, int l, int y, int skip)
for (i = 0; i < l && y <= view->ylen - 10; i++) {
k = fragsort[i];
s = &cl.players[k];
if (!s->name[0])
if (!s->name || !s->name->value[0])
continue;
dmo_ping (view, x + 0, y, s);
@ -1265,7 +1265,7 @@ Sbar_Draw_DMO_Ping (view_t *view, int l, int y, int skip)
for (i = 0; i < l && y <= view->ylen - 10; i++) {
k = fragsort[i];
s = &cl.players[k];
if (!s->name[0])
if (!s->name || !s->name->value[0])
continue;
dmo_ping (view, x + 0, y, s);
@ -1303,7 +1303,7 @@ Sbar_Draw_DMO_UID (view_t *view, int l, int y, int skip)
for (i = 0; i < l && y <= view->ylen - 10; i++) {
k = fragsort[i];
s = &cl.players[k];
if (!s->name[0])
if (!s->name || !s->name->value[0])
continue;
dmo_uid (view, x + 0, y, s);
@ -1341,7 +1341,7 @@ Sbar_Draw_DMO_Ping_UID (view_t *view, int l, int y, int skip)
for (i = 0; i < l && y <= view->ylen - 10; i++) {
k = fragsort[i];
s = &cl.players[k];
if (!s->name[0])
if (!s->name || !s->name->value[0])
continue;
dmo_ping (view, x + 0, y, s);
@ -1484,7 +1484,7 @@ draw_minifrags (view_t *view)
for (; i < scoreboardlines && y < view->ylen - 8 + 1; i++) {
k = fragsort[i];
s = &cl.players[k];
if (!s->name[0])
if (!s->name || !s->name->value[0])
continue;
// draw ping
@ -1509,9 +1509,9 @@ draw_minifrags (view_t *view)
// team
if (cl.teamplay) {
draw_nstring (view, x + 48, y, s->team->value, 4);
draw_nstring (view, x + 48 + 40, y, s->name, 16);
draw_nstring (view, x + 48 + 40, y, s->name->value, 16);
} else
draw_nstring (view, x + 48, y, s->name, 16);
draw_nstring (view, x + 48, y, s->name->value, 16);
y += 8;
}
}