VoIP: Only update from cl_voipSendTarget if sending data.

This commit is contained in:
Ryan C. Gordon 2008-06-07 14:40:30 +00:00
parent c50799fcf7
commit 8028fc042c

View file

@ -759,11 +759,13 @@ void CL_WritePacket( void ) {
} }
#if USE_VOIP #if USE_VOIP
// Move cl_voipSendTarget from a string to a if (clc.voipOutgoingDataSize > 0) { // only send if data.
// Move cl_voipSendTarget from a string to the bitmasks if needed.
if (cl_voipSendTarget->modified) { if (cl_voipSendTarget->modified) {
const char *target = cl_voipSendTarget->string; const char *target = cl_voipSendTarget->string;
if ((*target == '\0') || (Q_stricmp(target, "all") == 0)) { if ((*target == '\0') || (Q_stricmp(target, "all") == 0)) {
clc.voipTarget1 = clc.voipTarget2 = clc.voipTarget3 = 0x7FFFFFFF; const int all = 0x7FFFFFFF;
clc.voipTarget1 = clc.voipTarget2 = clc.voipTarget3 = all;
} else if (Q_stricmp(target, "none") == 0) { } else if (Q_stricmp(target, "none") == 0) {
clc.voipTarget1 = clc.voipTarget2 = clc.voipTarget3 = 0; clc.voipTarget1 = clc.voipTarget2 = clc.voipTarget3 = 0;
} else { } else {
@ -786,7 +788,6 @@ void CL_WritePacket( void ) {
cl_voipSendTarget->modified = qfalse; cl_voipSendTarget->modified = qfalse;
} }
if (clc.voipOutgoingDataSize > 0) { // only send if data.
MSG_WriteByte (&buf, clc_EOF); // placate legacy servers. MSG_WriteByte (&buf, clc_EOF); // placate legacy servers.
MSG_WriteByte (&buf, clc_extension); MSG_WriteByte (&buf, clc_extension);
MSG_WriteByte (&buf, clc_voip); MSG_WriteByte (&buf, clc_voip);