mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-26 22:11:18 +00:00
fix name compare in 'follow' command (#4013)
This commit is contained in:
parent
6b4f3aaed2
commit
40e4a2e5c4
1 changed files with 4 additions and 28 deletions
|
@ -151,29 +151,6 @@ char *ConcatArgs( int start ) {
|
|||
return line;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue