From 4da76278ada8d004598e84753e4833fce79019ef Mon Sep 17 00:00:00 2001 From: "M. Kristall" Date: Tue, 11 Jan 2011 04:21:15 +0000 Subject: * Refactor code handling player name matching --- src/game/g_svcmds.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/game/g_svcmds.c') diff --git a/src/game/g_svcmds.c b/src/game/g_svcmds.c index ff9b0895..9338766f 100644 --- a/src/game/g_svcmds.c +++ b/src/game/g_svcmds.c @@ -117,23 +117,15 @@ void Svcmd_EntityList_f( void ) static gclient_t *ClientForString( char *s ) { - int idnum, count; - int pids[ MAX_CLIENTS ]; + int idnum; + char err[ MAX_STRING_CHARS ]; - if( ( count = G_ClientNumbersFromString( s, pids, MAX_CLIENTS ) ) != 1 ) + idnum = G_ClientNumberFromString( s, err, sizeof( err ) ); + if( idnum == -1 ) { - idnum = G_ClientNumberFromString( s ); - - if( idnum == -1 ) - { - char err[ MAX_STRING_CHARS ]; - G_MatchOnePlayer( pids, count, err, sizeof( err ) ); - G_Printf( "%s\n", err ); - return NULL; - } + G_Printf( "%s", err ); + return NULL; } - else - idnum = pids[ 0 ]; return &level.clients[ idnum ]; } -- cgit