aboutsummaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
Diffstat (limited to 'code')
-rw-r--r--code/game/g_cmds.c32
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;
}
}