diff options
Diffstat (limited to 'mp/src/game/shared/multiplay_gamerules.cpp')
| -rw-r--r-- | mp/src/game/shared/multiplay_gamerules.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
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' ) { |