From 55ed12f8d1eb6887d348be03aee5573d44177ffb Mon Sep 17 00:00:00 2001 From: Michael Sartain Date: Thu, 2 Oct 2014 08:25:55 -0700 Subject: Updated the SDK with the latest code from the TF and HL2 branches. --- mp/src/game/shared/multiplay_gamerules.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'mp/src/game/shared/multiplay_gamerules.cpp') diff --git a/mp/src/game/shared/multiplay_gamerules.cpp b/mp/src/game/shared/multiplay_gamerules.cpp index abecba9e..16cfe297 100644 --- a/mp/src/game/shared/multiplay_gamerules.cpp +++ b/mp/src/game/shared/multiplay_gamerules.cpp @@ -1149,14 +1149,17 @@ ConVarRef suitcharger( "sk_suitcharger" ); } } - void StripChar(char *szBuffer, const char cWhiteSpace ) + // Strip ' ' and '\n' characters from string. + static void StripWhitespaceChars( char *szBuffer ) { + char *szOut = szBuffer; - while ( char *pSpace = strchr( szBuffer, cWhiteSpace ) ) + for ( char *szIn = szOut; *szIn; szIn++ ) { - char *pNextChar = pSpace + sizeof(char); - V_strcpy( pSpace, pNextChar ); + if ( *szIn != ' ' && *szIn != '\r' ) + *szOut++ = *szIn; } + *szOut = '\0'; } void CMultiplayRules::GetNextLevelName( char *pszNextMap, int bufsize, bool bRandom /* = false */ ) @@ -1283,9 +1286,8 @@ ConVarRef suitcharger( "sk_suitcharger" ); { bool bIgnore = false; - // Strip out the spaces in the name - StripChar( mapList[i] , '\r'); - StripChar( mapList[i] , ' '); + // Strip out ' ' and '\r' chars. + StripWhitespaceChars( mapList[i] ); if ( !Q_strncmp( mapList[i], "//", 2 ) || mapList[i][0] == '\0' ) { -- cgit v1.2.3