fix name compare in 'follow' command (#4013)
This commit is contained in:
parent
6b4f3aaed2
commit
40e4a2e5c4
|
@ -151,29 +151,6 @@ char *ConcatArgs( int start ) {
|
||||||
return line;
|
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
|
ClientNumberFromString
|
||||||
|
@ -185,8 +162,7 @@ Returns -1 if invalid
|
||||||
int ClientNumberFromString( gentity_t *to, char *s ) {
|
int ClientNumberFromString( gentity_t *to, char *s ) {
|
||||||
gclient_t *cl;
|
gclient_t *cl;
|
||||||
int idnum;
|
int idnum;
|
||||||
char s2[MAX_STRING_CHARS];
|
char cleanName[MAX_STRING_CHARS];
|
||||||
char n2[MAX_STRING_CHARS];
|
|
||||||
|
|
||||||
// numeric values are just slot numbers
|
// numeric values are just slot numbers
|
||||||
if (s[0] >= '0' && s[0] <= '9') {
|
if (s[0] >= '0' && s[0] <= '9') {
|
||||||
|
@ -205,13 +181,13 @@ int ClientNumberFromString( gentity_t *to, char *s ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for a name match
|
// check for a name match
|
||||||
SanitizeString( s, s2 );
|
|
||||||
for ( idnum=0,cl=level.clients ; idnum < level.maxclients ; idnum++,cl++ ) {
|
for ( idnum=0,cl=level.clients ; idnum < level.maxclients ; idnum++,cl++ ) {
|
||||||
if ( cl->pers.connected != CON_CONNECTED ) {
|
if ( cl->pers.connected != CON_CONNECTED ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
SanitizeString( cl->pers.netname, n2 );
|
Q_strncpyz(cleanName, cl->pers.netname, sizeof(cleanName));
|
||||||
if ( !strcmp( n2, s2 ) ) {
|
Q_CleanStr(cleanName);
|
||||||
|
if ( !Q_stricmp( cleanName, s ) ) {
|
||||||
return idnum;
|
return idnum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue