[quake3-commits] r1548 - trunk/code/game

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri May 8 05:31:27 EDT 2009


Author: ludwig
Date: 2009-05-08 05:31:26 -0400 (Fri, 08 May 2009)
New Revision: 1548

Modified:
   trunk/code/game/g_cmds.c
Log:
fix name compare in 'follow' command (#4013)

Modified: trunk/code/game/g_cmds.c
===================================================================
--- trunk/code/game/g_cmds.c	2009-05-08 09:17:06 UTC (rev 1547)
+++ trunk/code/game/g_cmds.c	2009-05-08 09:31:26 UTC (rev 1548)
@@ -153,29 +153,6 @@
 
 /*
 ==================
-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 @@
 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 @@
 	}
 
 	// 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;
 		}
 	}



More information about the quake3-commits mailing list