summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_main.c19
-rw-r--r--src/cgame/cg_servercmds.c31
2 files changed, 12 insertions, 38 deletions
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 9f7d26d5..fe90b629 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -1425,19 +1425,17 @@ static clientInfo_t * CG_InfoFromScoreIndex( int index, int team, int *scoreInde
static qboolean CG_ClientIsReady( int clientNum )
{
- // each character of the hex string corresponds to 4 bits, which correspond
- // to readiness for client (0, 1, 2, 3...) i.e. the highest order bit
- // corresponds to the lowest clientnum
- // so we only need one character for a given client
- int val = clientNum / 4;
+ // 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 );
- while( *s && val > 0 )
- s++, val--;
-
- if( !*s )
- return qfalse;
+ // 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' )
@@ -1447,6 +1445,7 @@ static qboolean CG_ClientIsReady( int clientNum )
else
return qfalse;
+ // select appropriate bit
return ( ( val & 1 << ( 3 - clientNum % 4 ) ) != 0 );
}
diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c
index c21d1a52..f95d18b7 100644
--- a/src/cgame/cg_servercmds.c
+++ b/src/cgame/cg_servercmds.c
@@ -446,27 +446,6 @@ static void CG_MapRestart( void )
}
/*
-=================
-CG_RemoveChatEscapeChar
-=================
-*/
-static void CG_RemoveChatEscapeChar( char *text )
-{
- int i, l;
-
- l = 0;
- for( i = 0; text[ i ]; i++ )
- {
- if( text[ i ] == '\x19' )
- continue;
-
- text[ l++ ] = text[ i ];
- }
-
- text[ l ] = '\0';
-}
-
-/*
==============
CG_Menu
==============
@@ -943,7 +922,6 @@ static void CG_Say( int clientNum, char *text )
"%s: " S_COLOR_WHITE S_COLOR_GREEN "%s" S_COLOR_WHITE "\n",
ci->name, text );
- CG_RemoveChatEscapeChar( sayText );
if( BG_ClientListTest( &cgs.ignoreList, clientNum ) )
CG_Printf( "[skipnotify]%s", sayText );
else
@@ -959,17 +937,15 @@ static void CG_SayTeam( int clientNum, char *text )
{
clientInfo_t *ci;
char sayText[ MAX_SAY_TEXT ] = {""};
-
+
if( clientNum < 0 || clientNum >= MAX_CLIENTS )
return;
-
ci = &cgs.clientinfo[ clientNum ];
Com_sprintf( sayText, sizeof( sayText ),
- "%s: " S_COLOR_WHITE S_COLOR_CYAN "%s" S_COLOR_WHITE "\n",
+ "%s: " S_COLOR_CYAN "%s" S_COLOR_WHITE "\n",
ci->name, text );
-
- CG_RemoveChatEscapeChar( sayText );
+
if( BG_ClientListTest( &cgs.ignoreList, clientNum ) )
CG_Printf( "[skipnotify]%s", sayText );
else
@@ -1160,7 +1136,6 @@ static void CG_Chat_f( void )
trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND );
}
- CG_RemoveChatEscapeChar( text );
CG_Printf( "%s\n", text );
}