summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_main.c25
-rw-r--r--src/game/g_admin.c8
-rw-r--r--src/game/g_main.c19
-rw-r--r--src/game/g_session.c9
4 files changed, 16 insertions, 45 deletions
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 3bca625d..2dd07ba2 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -1437,28 +1437,11 @@ static clientInfo_t * CG_InfoFromScoreIndex( int index, int team, int *scoreInde
static qboolean CG_ClientIsReady( int clientNum )
{
- // CS_CLIENTS_READY is a hex string, each character of which is 4 bits
- // the highest bit of the first char is a toggle for client 0, the second
- // highest for client 1, etc.
- // there are exactly four bits of information in each character
- int val;
- const char *s = CG_ConfigString( CS_CLIENTS_READY );
-
- // select the appropriate character without passing the end of the string
- for( val = clientNum / 4; *s && val > 0; s++, val-- );
-
- // convert hex -> int
- if( isdigit( *s ) )
- val = *s - '0';
- else if( *s >= 'a' && *s <= 'f' )
- val = 10 + *s - 'a';
- else if( *s >= 'A' && *s <= 'F' )
- val = 10 + *s - 'A';
- else
- return qfalse;
+ clientList_t ready;
+
+ BG_ClientListParse( &ready, CG_ConfigString( CS_CLIENTS_READY ) );
- // select appropriate bit
- return ( ( val & 1 << ( 3 - clientNum % 4 ) ) != 0 );
+ return BG_ClientListTest( &ready, clientNum );
}
static const char *CG_FeederItemText( float feederID, int index, int column, qhandle_t *handle )
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index d067a1cf..02bb1ff2 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -1624,11 +1624,9 @@ qboolean G_admin_ban( gentity_t *ent, int skiparg )
G_SanitiseString( g_admin_namelog[ i ]->name[ j ], n2, sizeof( n2 ) );
if( strstr( n2, s2 ) )
{
- if( g_admin_namelog[ i ]->slot > -1 )
- ADMBP( "^3" );
- ADMBP( va( "%-2s (*%s) %15s ^7'%s^7'\n",
+ ADMBP( va( "%s (*%s) %15s ^7'%s^7'\n",
( g_admin_namelog[ i ]->slot > -1 ) ?
- va( "%d", g_admin_namelog[ i ]->slot ) : "-",
+ va( "^3%-2d", g_admin_namelog[ i ]->slot ) : "- ",
g_admin_namelog[ i ]->guid + 24,
g_admin_namelog[ i ]->ip,
g_admin_namelog[ i ]->name[ j ] ) );
@@ -2789,7 +2787,7 @@ qboolean G_admin_namelog( gentity_t *ent, int skiparg )
printed++;
ADMBP( va( "%s (*%s) %15s^7",
( g_admin_namelog[ i ]->slot > -1 ) ?
- va( "^3%-2d", g_admin_namelog[ i ]->slot ) : "-",
+ va( "^3%-2d", g_admin_namelog[ i ]->slot ) : "- ",
g_admin_namelog[ i ]->guid + 24, g_admin_namelog[ i ]->ip ) );
for( j = 0; j < MAX_ADMIN_NAMELOG_NAMES &&
g_admin_namelog[ i ]->name[ j ][ 0 ]; j++ )
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 7c851ee0..3c36382c 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -1853,9 +1853,7 @@ void CheckIntermissionExit( void )
int ready, notReady;
int i;
gclient_t *cl;
- byte readyMasks[ ( MAX_CLIENTS + 7 ) / 8 ];
- // each byte in readyMasks will become two characters 00 - ff in the string
- char readyString[ 2 * sizeof( readyMasks ) + 1 ];
+ clientList_t readyMasks;
//if no clients are connected, just exit
if( level.numConnectedClients == 0 )
@@ -1867,7 +1865,7 @@ void CheckIntermissionExit( void )
// see which players are ready
ready = 0;
notReady = 0;
- Com_Memset( readyMasks, 0, sizeof( readyMasks ) );
+ Com_Memset( &readyMasks, 0, sizeof( readyMasks ) );
for( i = 0; i < g_maxclients.integer; i++ )
{
cl = level.clients + i;
@@ -1881,21 +1879,14 @@ void CheckIntermissionExit( void )
if( cl->readyToExit )
{
ready++;
- // the nth bit of readyMasks is for client (n - 1)
- readyMasks[ i / 8 ] |= 1 << ( 7 - ( i % 8 ) );
+
+ BG_ClientListAdd( &readyMasks, i );
}
else
notReady++;
}
- // this is hex because we can convert bits to a hex string in pieces,
- // whereas a decimal string would have to all be written at once
- // (and we can't fit a number that large in an int)
- for( i = 0; i < ( g_maxclients.integer + 7 ) / 8; i++ )
- Com_sprintf( &readyString[ i * 2 ], sizeof( readyString ) - i * 2,
- "%2.2x", readyMasks[ i ] );
-
- trap_SetConfigstring( CS_CLIENTS_READY, readyString );
+ trap_SetConfigstring( CS_CLIENTS_READY, BG_ClientListString( &readyMasks ) );
// never exit in less than five seconds
if( level.time < level.intermissiontime + 5000 )
diff --git a/src/game/g_session.c b/src/game/g_session.c
index c5b517ab..f6b46285 100644
--- a/src/game/g_session.c
+++ b/src/game/g_session.c
@@ -70,21 +70,20 @@ void G_ReadSessionData( gclient_t *client )
char s[ MAX_STRING_CHARS ];
const char *var;
int spectatorState;
+ char ignorelist[ 17 ];
var = va( "session%i", client - level.clients );
trap_Cvar_VariableStringBuffer( var, s, sizeof(s) );
- // FIXME: should be using BG_ClientListParse() for ignoreList, but
- // bg_lib.c's sscanf() currently lacks %s
- sscanf( s, "%i %i %i %x%x",
+ sscanf( s, "%i %i %i %16s",
&client->sess.spectatorTime,
&spectatorState,
&client->sess.spectatorClient,
- &client->sess.ignoreList.hi,
- &client->sess.ignoreList.lo
+ ignorelist
);
client->sess.spectatorState = (spectatorState_t)spectatorState;
+ BG_ClientListParse( &client->sess.ignoreList, ignorelist );
}