diff --git a/engine/server/server.h b/engine/server/server.h index 1bc3d19a..80fa597a 100644 --- a/engine/server/server.h +++ b/engine/server/server.h @@ -218,7 +218,6 @@ typedef struct sv_client_s char useragent[MAX_INFO_STRING]; byte ignorecmdtime_warned; // did we warn our server operator in the log for this batch of commands? - byte m_bLoopback; // does this client want to hear his own voice? uint listeners; // which other clients does this guy's voice stream go to? int ignorecmdtime_warns; // how many times client time was faster than server during this session diff --git a/engine/server/sv_client.c b/engine/server/sv_client.c index cbc2ecdf..7785ce93 100644 --- a/engine/server/sv_client.c +++ b/engine/server/sv_client.c @@ -3540,16 +3540,12 @@ SV_ParseVoiceData static void SV_ParseVoiceData( sv_client_t *cl, sizebuf_t *msg ) { char received[4096]; - sv_client_t *cur; - int i, client; - uint length, size, frames; + int i; - cl->m_bLoopback = MSG_ReadByte( msg ); - - frames = MSG_ReadByte( msg ); - - size = MSG_ReadShort( msg ); - client = cl - svs.clients; + const qboolean loopback = !!MSG_ReadByte( msg ); + const uint frames = MSG_ReadByte( msg ); + const uint size = MSG_ReadShort( msg ); + const int client = cl - svs.clients; if( size > sizeof( received )) { @@ -3563,9 +3559,13 @@ static void SV_ParseVoiceData( sv_client_t *cl, sizebuf_t *msg ) if( !sv_voiceenable.value || svs.maxclients <= 1 || cl->state != cs_spawned ) return; - for( i = 0, cur = svs.clients; i < svs.maxclients; i++, cur++ ) + for( i = 0; i < svs.maxclients; i++ ) { - if( cl != cur ) + sv_client_t *cur = &svs.clients[i]; + const qboolean local = cl == cur; + uint length = size; + + if( !local ) { if( cur->state < cs_connected ) continue; @@ -3574,13 +3574,11 @@ static void SV_ParseVoiceData( sv_client_t *cl, sizebuf_t *msg ) continue; } - length = size; - // 6 is a number of bytes for other parts of message if( MSG_GetNumBytesLeft( &cur->datagram ) < length + 6 ) continue; - if( cl == cur && !cur->m_bLoopback ) + if( cl == cur && !loopback ) length = 0; MSG_BeginServerCmd( &cur->datagram, svc_voicedata );