From 2116ed4483f21171f49b6c8f64f2dd3c55fb6925 Mon Sep 17 00:00:00 2001 From: "M. Kristall" Date: Wed, 2 Feb 2011 02:22:15 +0000 Subject: * Prevent color from changing partway through the line in namelog output (DevHC) --- src/game/g_admin.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 0e2e84e4..b503adea 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -2639,12 +2639,14 @@ static void namelog_out( void *namelog, char *str ) namelog_t *n = (namelog_t *)namelog; char *p = str; int l, l2 = MAX_STRING_CHARS, i; + const char *scolor; if( n->slot > -1 ) { l = Q_snprintf( p, l2, "^3%-2d", n->slot ); p += l; l2 -= l; + scolor = S_COLOR_YELLOW; } else { @@ -2652,6 +2654,7 @@ static void namelog_out( void *namelog, char *str ) *p++ = ' '; *p = '\0'; l2 -= 2; + scolor = S_COLOR_WHITE; } for( i = 0; i < MAX_NAMELOG_ADDRS && n->ip[ i ].str[ 0 ]; i++ ) @@ -2663,8 +2666,8 @@ static void namelog_out( void *namelog, char *str ) for( i = 0; i < MAX_NAMELOG_NAMES && n->name[ i ][ 0 ]; i++ ) { - l = Q_snprintf( p, l2, " '%s" S_COLOR_WHITE "'%s", n->name[ i ], - ( i == n->nameOffset ) ? "*" : "" ); + l = Q_snprintf( p, l2, " '%s%s'%s", n->name[ i ], scolor, + i == n->nameOffset ? "*" : "" ); p += l; l2 -= l; } -- cgit