diff options
author | M. Kristall <mkpdev@gmail.com> | 2009-10-03 11:36:04 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:15:09 +0000 |
commit | 3a51f3d17095fd06471ae1b589cb211f569b625e (patch) | |
tree | f4b5d54d6dc643734dfc82d7b7ccdca22374d36b /src/game/g_client.c | |
parent | 0a04a17d0a1ad5718d78905eb90418eb866687c4 (diff) |
* (bug 3057) Granger breaks under certain conditions (Risujin)
* (bug 3256) G_admin_print to a tty should not decolour if com_ansiColor is
set (Ben Millwood)
* (bug 3392) Console is affected by flag @ (Chris "Lakitu7" Schwarz)
* Automatically load default admin levels when g_admin is disabled, since admin
commands can still be used (since r894)
* Make return value of G_SelectiveRadiusDamage useful and use it for Overmind
and Reactor attacks
* /entitylist was skipping entity 0
* Check original search string against IP and slot number for !ban
* Preserve score and ping so they are always reported correctly
* Random refactoring and formatting fixes
Diffstat (limited to 'src/game/g_client.c')
-rw-r--r-- | src/game/g_client.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/game/g_client.c b/src/game/g_client.c index f9742109..3022a9cc 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -801,7 +801,6 @@ ClientCheckName static void ClientCleanName( const char *in, char *out, int outSize ) { int len, colorlessLen; - char ch; char *p; int spaces; @@ -814,42 +813,33 @@ static void ClientCleanName( const char *in, char *out, int outSize ) *p = 0; spaces = 0; - while( 1 ) + for( ; *in; in++ ) { - ch = *in++; - if( !ch ) - break; - // don't allow leading spaces - if( !*p && ch == ' ' ) + if( colorlessLen == 0 && *in == ' ' ) continue; // check colors - if( ch == Q_COLOR_ESCAPE ) + if( Q_IsColorString( in ) ) { - // solo trailing carat is not a color prefix - if( !*in ) - break; + in++; // don't allow black in a name, period if( ColorIndex( *in ) == 0 ) - { - in++; continue; - } // make sure room in dest for both chars if( len > outSize - 2 ) break; - *out++ = ch; - *out++ = *in++; + *out++ = Q_COLOR_ESCAPE; + *out++ = *in; len += 2; continue; } // don't allow too many consecutive spaces - if( ch == ' ' ) + if( *in == ' ' ) { spaces++; if( spaces > 3 ) @@ -861,7 +851,7 @@ static void ClientCleanName( const char *in, char *out, int outSize ) if( len > outSize - 1 ) break; - *out++ = ch; + *out++ = *in; colorlessLen++; len++; } |