summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Millwood <thebenmachine@gmail.com>2009-10-03 12:09:54 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:43 +0000
commit0e34d54908e7d50611a5acfedcb93a778a1bbe3f (patch)
tree1fdf6c39697a9e88fa98d65149fc11f7fee9f9e2
parent186b84bec1705d8288beb043dbb9f94e378eff74 (diff)
Ready code probably fixed
-rw-r--r--src/cgame/cg_main.c19
-rw-r--r--src/game/g_main.c2
2 files changed, 16 insertions, 5 deletions
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index d8683d9e..55396704 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -1428,14 +1428,25 @@ 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
- // because of this 1:4 ratio we only need one character for a given client
+ // so we only need one character for a given client
int val = clientNum / 4;
const char *s = CG_ConfigString( CS_CLIENTS_READY );
- while( *s && val-- > 0 )
- s++;
+
+ while( *s && val > 0 )
+ s++, val--;
+
if( !*s )
return qfalse;
- sscanf( s, "%1x", &val );
+
+ if( isdigit( *s ) )
+ val = *s - '0';
+ else if( isxlower( *s ) )
+ val = 10 + *s - 'a';
+ else if( isxupper( *s ) )
+ val = 10 + *s - 'A';
+ else
+ return qfalse;
+
return ( ( val & 1 << ( 3 - clientNum % 4 ) ) != 0 );
}
diff --git a/src/game/g_main.c b/src/game/g_main.c
index b4d3974e..5fbdd4c5 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -1862,7 +1862,7 @@ void CheckIntermissionExit( void )
int i;
gclient_t *cl;
byte readyMasks[ ( MAX_CLIENTS + 7 ) / 8 ];
- char readyString[ 2 * sizeof( readyMasks ) + 1 ];
+ char readyString[ 2 * sizeof( readyMasks ) + 1 ]; // a byte is 00 - ff
//if no clients are connected, just exit
if( !level.numConnectedClients )