game/client/clientmode_shared.cpp
bool ContainsBinding( const char *pszBindingString, const char *pszBinding, bool bSearchAliases /*= false*/ )
{
	if ( !strchr( pszBindingString, ';' ) && !bSearchAliases )
	{
		return !Q_stricmp( pszBindingString, pszBinding );
	}
	else
	{
		//lwss: change this to a regular CUtlVector.
		// This is the only use of this weird Vector class that calls the wrong delete operator instead of delete[] on destruction.
		//CUtlVectorAutoPurge< char *> cmdStrings;
		CUtlVector< char *> cmdStrings;
		//lwss end
        // Tokenize the binding name
        V_SplitString( pszBindingString, ";", cmdStrings );
		FOR_EACH_VEC( cmdStrings, i )
		{
			char* szCmd = cmdStrings[ i ];
			if ( bSearchAliases )
			{
				// Search for command in any contained aliases. 
				const char* szAliasCmd = engine->AliasToCommandString( szCmd );
				// NOTE: we could use some kind of recursion guard, but recursive aliases already infinite loop 
				// when being processed by the cmd system. 
				if ( szAliasCmd )
				{
					CUtlString strCmd( szAliasCmd );
					V_StripTrailingWhitespace( strCmd.Access() ); // Alias adds trailing spaces to commands, strip it here so the compare works
					if ( ContainsBinding( strCmd.Get(), pszBinding, true ) )
						return true;
				}
			}

			if ( !Q_stricmp( pszBinding, szCmd ) )
			{
				return true;
			}
		}
		return false;
	}
}
//-----------------------------------------------------------------------------
// Purpose: Helper to find if a binding exists in a possible chain of bindings
//-----------------------------------------------------------------------------
Helper to find if a binding exists in a possible chain of bindings
Helper to find if a binding exists in a possible chain of bindings
bool ContainsBinding( const char *pszBindingString, const char *pszBinding, bool bSearchAliases  )
{
	if ( !strchr( pszBindingString, ';' ) && !bSearchAliases )
	{
		return !Q_stricmp( pszBindingString, pszBinding );
	}
	else
	{
		CUtlVector< char *> cmdStrings;
        V_SplitString( pszBindingString, ";", cmdStrings );
		FOR_EACH_VEC( cmdStrings, i )
		{
			char* szCmd = cmdStrings[ i ];
			if ( bSearchAliases )
			{
				const char* szAliasCmd = engine->AliasToCommandString( szCmd );
				if ( szAliasCmd )
				{
					CUtlString strCmd( szAliasCmd );
					V_StripTrailingWhitespace( strCmd.Access() ); 
					if ( ContainsBinding( strCmd.Get(), pszBinding, true ) )
						return true;
				}
			}
			if ( !Q_stricmp( pszBinding, szCmd ) )
			{
				return true;
			}
		}
		return false;
	}
}
bool ContainsBinding ( const char * pszBindingString , const char * pszBinding , bool bSearchAliases ) { if ( ! strchr ( pszBindingString , ' ' ) && ! bSearchAliases ) { return ! Q_stricmp ( pszBindingString , pszBinding ) ; } else { CUtlVector < char * > cmdStrings ; V_SplitString ( pszBindingString , " " , cmdStrings ) ; FOR_EACH_VEC ( cmdStrings , i ) { char * szCmd = cmdStrings [ i ] ; if ( bSearchAliases ) { const char * szAliasCmd = engine -> AliasToCommandString ( szCmd ) ; if ( szAliasCmd ) { CUtlString strCmd ( szAliasCmd ) ; V_StripTrailingWhitespace ( strCmd . Access ( ) ) ; if ( ContainsBinding ( strCmd . Get ( ) , pszBinding , true ) ) return true ; } } if ( ! Q_stricmp ( pszBinding , szCmd ) ) { return true ; } } return false ; } }
Purpose: Helper to find if a binding exists in a possible chain of bindings
Purpose : Helper to find if a binding exists in a possible chain of bindings
/*= false*/ //lwss: change this to a regular CUtlVector. // This is the only use of this weird Vector class that calls the wrong delete operator instead of delete[] on destruction. //CUtlVectorAutoPurge< char *> cmdStrings; //lwss end // Tokenize the binding name // Search for command in any contained aliases.  // NOTE: we could use some kind of recursion guard, but recursive aliases already infinite loop  // when being processed by the cmd system.  // Alias adds trailing spaces to commands, strip it here so the compare works