diff options
author | ludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2009-05-08 09:31:26 +0000 |
---|---|---|
committer | ludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2009-05-08 09:31:26 +0000 |
commit | 5e957c92128cb7f4b1259ed70b0109f440e66486 (patch) | |
tree | acee8a9035f57093a1df370adda8e23ef5b54678 /code/game | |
parent | 76eaae85db8e6ccb93e1e7090e8e9a5677733bc4 (diff) | |
download | ioquake3-aero-5e957c92128cb7f4b1259ed70b0109f440e66486.tar.gz ioquake3-aero-5e957c92128cb7f4b1259ed70b0109f440e66486.zip |
fix name compare in 'follow' command (#4013)
git-svn-id: svn://svn.icculus.org/quake3/trunk@1548 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/game')
-rw-r--r-- | code/game/g_cmds.c | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/code/game/g_cmds.c b/code/game/g_cmds.c index 1ecb0cb..2569b3b 100644 --- a/code/game/g_cmds.c +++ b/code/game/g_cmds.c @@ -153,29 +153,6 @@ char *ConcatArgs( int start ) { /* ================== -SanitizeString - -Remove case and control characters -================== -*/ -void SanitizeString( char *in, char *out ) { - while ( *in ) { - if ( *in == 27 ) { - in += 2; // skip color code - continue; - } - if ( *in < 32 ) { - in++; - continue; - } - *out++ = tolower( *in++ ); - } - - *out = 0; -} - -/* -================== ClientNumberFromString Returns a player number for either a number or name string @@ -185,8 +162,7 @@ Returns -1 if invalid int ClientNumberFromString( gentity_t *to, char *s ) { gclient_t *cl; int idnum; - char s2[MAX_STRING_CHARS]; - char n2[MAX_STRING_CHARS]; + char cleanName[MAX_STRING_CHARS]; // numeric values are just slot numbers if (s[0] >= '0' && s[0] <= '9') { @@ -205,13 +181,13 @@ int ClientNumberFromString( gentity_t *to, char *s ) { } // check for a name match - SanitizeString( s, s2 ); for ( idnum=0,cl=level.clients ; idnum < level.maxclients ; idnum++,cl++ ) { if ( cl->pers.connected != CON_CONNECTED ) { continue; } - SanitizeString( cl->pers.netname, n2 ); - if ( !strcmp( n2, s2 ) ) { + Q_strncpyz(cleanName, cl->pers.netname, sizeof(cleanName)); + Q_CleanStr(cleanName); + if ( !Q_stricmp( cleanName, s ) ) { return idnum; } } |