mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 15:21:35 +00:00
Merge pull request #55 from MAN-AT-ARMS/status_command
Fix colored name padding and allow IPv6 address to fit in output of 'status' command
This commit is contained in:
commit
2393c8f44f
1 changed files with 28 additions and 14 deletions
|
@ -1141,6 +1141,25 @@ static void SV_ExceptDel_f(void)
|
||||||
SV_DelBanFromList(qtrue);
|
SV_DelBanFromList(qtrue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** SV_Strlen -- skips color escape codes
|
||||||
|
*/
|
||||||
|
static int SV_Strlen( const char *str ) {
|
||||||
|
const char *s = str;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
while ( *s ) {
|
||||||
|
if ( Q_IsColorString( s ) ) {
|
||||||
|
s += 2;
|
||||||
|
} else {
|
||||||
|
count++;
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
SV_Status_f
|
SV_Status_f
|
||||||
|
@ -1161,20 +1180,20 @@ static void SV_Status_f( void ) {
|
||||||
|
|
||||||
Com_Printf ("map: %s\n", sv_mapname->string );
|
Com_Printf ("map: %s\n", sv_mapname->string );
|
||||||
|
|
||||||
Com_Printf ("num score ping name lastmsg address qport rate\n");
|
Com_Printf ("cl score ping name address rate \n");
|
||||||
Com_Printf ("--- ----- ---- --------------- ------- --------------------- ----- -----\n");
|
Com_Printf ("-- ----- ---- --------------- --------------------------------------- -----\n");
|
||||||
for (i=0,cl=svs.clients ; i < sv_maxclients->integer ; i++,cl++)
|
for (i=0,cl=svs.clients ; i < sv_maxclients->integer ; i++,cl++)
|
||||||
{
|
{
|
||||||
if (!cl->state)
|
if (!cl->state)
|
||||||
continue;
|
continue;
|
||||||
Com_Printf ("%3i ", i);
|
Com_Printf ("%2i ", i);
|
||||||
ps = SV_GameClientNum( i );
|
ps = SV_GameClientNum( i );
|
||||||
Com_Printf ("%5i ", ps->persistant[PERS_SCORE]);
|
Com_Printf ("%5i ", ps->persistant[PERS_SCORE]);
|
||||||
|
|
||||||
if (cl->state == CS_CONNECTED)
|
if (cl->state == CS_CONNECTED)
|
||||||
Com_Printf ("CNCT ");
|
Com_Printf ("CON ");
|
||||||
else if (cl->state == CS_ZOMBIE)
|
else if (cl->state == CS_ZOMBIE)
|
||||||
Com_Printf ("ZMBI ");
|
Com_Printf ("ZMB ");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ping = cl->ping < 9999 ? cl->ping : 9999;
|
ping = cl->ping < 9999 ? cl->ping : 9999;
|
||||||
|
@ -1183,10 +1202,7 @@ static void SV_Status_f( void ) {
|
||||||
|
|
||||||
Com_Printf ("%s", cl->name);
|
Com_Printf ("%s", cl->name);
|
||||||
|
|
||||||
// TTimo adding a ^7 to reset the color
|
l = 16 - SV_Strlen(cl->name);
|
||||||
// NOTE: colored names in status breaks the padding (WONTFIX)
|
|
||||||
Com_Printf ("^7");
|
|
||||||
l = 14 - strlen(cl->name);
|
|
||||||
j = 0;
|
j = 0;
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -1195,11 +1211,11 @@ static void SV_Status_f( void ) {
|
||||||
j++;
|
j++;
|
||||||
} while(j < l);
|
} while(j < l);
|
||||||
|
|
||||||
Com_Printf ("%7i ", svs.time - cl->lastPacketTime );
|
|
||||||
|
|
||||||
|
// TTimo adding a ^7 to reset the color
|
||||||
s = NET_AdrToString( cl->netchan.remoteAddress );
|
s = NET_AdrToString( cl->netchan.remoteAddress );
|
||||||
Com_Printf ("%s", s);
|
Com_Printf ("^7%s", s);
|
||||||
l = 22 - strlen(s);
|
l = 39 - strlen(s);
|
||||||
j = 0;
|
j = 0;
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -1208,8 +1224,6 @@ static void SV_Status_f( void ) {
|
||||||
j++;
|
j++;
|
||||||
} while(j < l);
|
} while(j < l);
|
||||||
|
|
||||||
Com_Printf ("%5i", cl->netchan.qport);
|
|
||||||
|
|
||||||
Com_Printf (" %5i", cl->rate);
|
Com_Printf (" %5i", cl->rate);
|
||||||
|
|
||||||
Com_Printf ("\n");
|
Com_Printf ("\n");
|
||||||
|
|
Loading…
Reference in a new issue