This is an automated email from the git hooks/post-receive script. smcv pushed a commit to annotated tag 1.42d in repository iortcw.
commit 438b97998ae9fbef5f039262f7bb08b14039fe6b Author: m4n4t4...@gmail.com <m4n4t4...@gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a> Date: Sat Feb 22 19:24:27 2014 +0000 All: Fix colored name padding and allow IPv6 address to fit in output of 'status' command --- MP/code/server/sv_ccmds.c | 43 ++++++++++++++++++++++++++++--------------- SP/code/server/sv_ccmds.c | 45 +++++++++++++++++++++++++++++---------------- 2 files changed, 57 insertions(+), 31 deletions(-) diff --git a/MP/code/server/sv_ccmds.c b/MP/code/server/sv_ccmds.c index bf831ab..a11f997 100644 --- a/MP/code/server/sv_ccmds.c +++ b/MP/code/server/sv_ccmds.c @@ -1329,6 +1329,25 @@ static void SV_ExceptDel_f(void) } /* +** 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 ================ @@ -1348,21 +1367,21 @@ static void SV_Status_f( void ) { Com_Printf( "map: %s\n", sv_mapname->string ); - Com_Printf( "num score ping name lastmsg address qport rate\n" ); - Com_Printf( "--- ----- ---- --------------- ------- --------------------- ----- -----\n" ); + Com_Printf( "cl score ping name address rate \n" ); + Com_Printf( "-- ----- ---- --------------- --------------------------------------- -----\n" ); for ( i = 0,cl = svs.clients ; i < sv_maxclients->integer ; i++,cl++ ) { if ( !cl->state ) { continue; } - Com_Printf( "%3i ", i ); + Com_Printf( "%2i ", i ); ps = SV_GameClientNum( i ); Com_Printf( "%5i ", ps->persistant[PERS_SCORE] ); if ( cl->state == CS_CONNECTED ) { - Com_Printf( "CNCT " ); + Com_Printf( "CON " ); } else if ( cl->state == CS_ZOMBIE ) { - Com_Printf( "ZMBI " ); + Com_Printf( "ZMB " ); } else { ping = cl->ping < 9999 ? cl->ping : 9999; @@ -1371,10 +1390,7 @@ static void SV_Status_f( void ) { Com_Printf( "%s", cl->name ); - // TTimo adding a ^7 to reset the color - // NOTE: colored names in status breaks the padding (WONTFIX) - Com_Printf ("^7"); - l = 14 - strlen(cl->name); + l = 16 - SV_Strlen(cl->name); j = 0; do @@ -1383,11 +1399,10 @@ static void SV_Status_f( void ) { j++; } while(j < l); - Com_Printf( "%7i ", svs.time - cl->lastPacketTime ); - + // TTimo adding a ^7 to reset the color s = NET_AdrToString( cl->netchan.remoteAddress ); - Com_Printf( "%s", s ); - l = 22 - strlen( s ); + Com_Printf( "^7%s", s ); + l = 39 - strlen( s ); j = 0; do @@ -1396,8 +1411,6 @@ static void SV_Status_f( void ) { j++; } while(j < l); - Com_Printf( "%5i", cl->netchan.qport ); - Com_Printf( " %5i", cl->rate ); Com_Printf( "\n" ); diff --git a/SP/code/server/sv_ccmds.c b/SP/code/server/sv_ccmds.c index 41fd25a..468ade1 100644 --- a/SP/code/server/sv_ccmds.c +++ b/SP/code/server/sv_ccmds.c @@ -1342,6 +1342,25 @@ static void SV_ExceptDel_f(void) } /* +** 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 ================ @@ -1361,21 +1380,21 @@ static void SV_Status_f( void ) { Com_Printf( "map: %s\n", sv_mapname->string ); - Com_Printf( "num score ping name lastmsg address qport rate\n" ); - Com_Printf( "--- ----- ---- --------------- ------- --------------------- ----- -----\n" ); + Com_Printf( "cl score ping name address rate \n" ); + Com_Printf( "-- ----- ---- --------------- --------------------------------------- -----\n" ); for ( i = 0,cl = svs.clients ; i < sv_maxclients->integer ; i++,cl++ ) { if ( !cl->state ) { continue; } - Com_Printf( "%3i ", i ); + Com_Printf( "%2i ", i ); ps = SV_GameClientNum( i ); Com_Printf( "%5i ", ps->persistant[PERS_SCORE] ); if ( cl->state == CS_CONNECTED ) { - Com_Printf( "CNCT " ); + Com_Printf( "CON " ); } else if ( cl->state == CS_ZOMBIE ) { - Com_Printf( "ZMBI " ); + Com_Printf( "ZMB " ); } else { ping = cl->ping < 9999 ? cl->ping : 9999; @@ -1384,23 +1403,19 @@ static void SV_Status_f( void ) { Com_Printf( "%s", cl->name ); - // TTimo adding a ^7 to reset the color - // NOTE: colored names in status breaks the padding (WONTFIX) - Com_Printf ("^7"); - l = 14 - strlen(cl->name); + l = 16 - SV_Strlen(cl->name); j = 0; do { - Com_Printf( " " ); + Com_Printf (" "); j++; } while(j < l); - Com_Printf( "%7i ", svs.time - cl->lastPacketTime ); - + // TTimo adding a ^7 to reset the color s = NET_AdrToString( cl->netchan.remoteAddress ); - Com_Printf( "%s", s ); - l = 22 - strlen( s ); + Com_Printf( "^7%s", s ); + l = 39 - strlen( s ); j = 0; do @@ -1409,8 +1424,6 @@ static void SV_Status_f( void ) { j++; } while(j < l); - Com_Printf( "%5i", cl->netchan.qport ); - Com_Printf( " %5i", cl->rate ); Com_Printf( "\n" ); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git _______________________________________________ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits