engine: client: simplified strings operations.

This commit is contained in:
Andrey Akhmichin
2020-11-29 04:05:42 +05:00
committed by Alibek Omarov
parent 69e15e9c7b
commit 5aef09ce5d
15 changed files with 51 additions and 51 deletions

View File

@@ -313,25 +313,25 @@ Key_GetKey
*/
int Key_GetKey( const char *pBinding )
{
int i;
int i, len;
const char *p;
if( !pBinding ) return -1;
len = Q_strlen( pBinding );
for( i = 0; i < 256; i++ )
{
if( !keys[i].binding )
continue;
if( *keys[i].binding == '+' )
{
if( !Q_strnicmp( keys[i].binding + 1, pBinding, Q_strlen( pBinding )))
return i;
}
else
{
if( !Q_strnicmp( keys[i].binding, pBinding, Q_strlen( pBinding )))
return i;
}
p = keys[i].binding;
if( *p == '+' )
p++;
if( !Q_strnicmp( p, pBinding, len ) )
return i;
}
return -1;