diff options
author | M. Kristall <mkpdev@gmail.com> | 2007-11-02 01:35:33 +0000 |
---|---|---|
committer | M. Kristall <mkpdev@gmail.com> | 2007-11-02 01:35:33 +0000 |
commit | 580693963c553ca1b63fb62f70e3f048a3666991 (patch) | |
tree | afaf8bd59d3893f776e0e3ee38be2496a64519dc /src | |
parent | 1e0b515a6031a2cd2a77e9c34f2e4292fc9f9750 (diff) |
* prevent kick votes from targetting the wrong person in some cases
Diffstat (limited to 'src')
-rw-r--r-- | src/game/g_cmds.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 66de68f8..e438bfb8 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -82,19 +82,20 @@ Returns -1 if invalid int G_ClientNumberFromString( gentity_t *to, char *s ) { gclient_t *cl; - int idnum; + int i; char s2[ MAX_STRING_CHARS ]; char n2[ MAX_STRING_CHARS ]; // numeric values are just slot numbers - if( s[ 0 ] >= '0' && s[ 0 ] <= '9' ) + for( i = 0; s[ i ] && isdigit( s[ i ] ); i++ ); + if( !s[ i ] ) { - idnum = atoi( s ); + i = atoi( s ); - if( idnum < 0 || idnum >= level.maxclients ) + if( i < 0 || i >= level.maxclients ) return -1; - cl = &level.clients[ idnum ]; + cl = &level.clients[ i ]; if( cl->pers.connected == CON_DISCONNECTED ) return -1; @@ -105,7 +106,7 @@ int G_ClientNumberFromString( gentity_t *to, char *s ) // check for a name match G_SanitiseName( s, s2 ); - for( idnum = 0, cl = level.clients; idnum < level.maxclients; idnum++, cl++ ) + for( i = 0, cl = level.clients; i < level.maxclients; i++, cl++ ) { if( cl->pers.connected == CON_DISCONNECTED ) continue; |