summaryrefslogtreecommitdiff
path: root/src/client/cl_main.c
diff options
context:
space:
mode:
authorZack Middleton <zturtleman@gmail.com>2012-12-14 07:32:07 +0000
committerTim Angus <tim@ngus.net>2013-01-12 21:26:40 +0000
commitdf12163f441f9c10955645ef8fdfe99f5f68d182 (patch)
treed3194343309fcdd53674a0e3d671456a0bdad11f /src/client/cl_main.c
parentf0ccdf74ef8234be1d8c067515933cbc6be524ac (diff)
- Allow changing cl_voip without restarting. - Fix assert failing in CL_ParseVoip() while flipping cl_voip off and on.
Diffstat (limited to 'src/client/cl_main.c')
-rw-r--r--src/client/cl_main.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/client/cl_main.c b/src/client/cl_main.c
index 942c99f0..a9574d79 100644
--- a/src/client/cl_main.c
+++ b/src/client/cl_main.c
@@ -120,6 +120,8 @@ cvar_t *cl_guidServerUniq;
cvar_t *cl_consoleKeys;
+cvar_t *cl_rate;
+
clientActive_t cl;
clientConnection_t clc;
clientStatic_t cls;
@@ -409,6 +411,22 @@ void CL_CaptureVoip(void)
return;
#endif
+ // If your data rate is too low, you'll get Connection Interrupted warnings
+ // when VoIP packets arrive, even if you have a broadband connection.
+ // This might work on rates lower than 25000, but for safety's sake, we'll
+ // just demand it. Who doesn't have at least a DSL line now, anyhow? If
+ // you don't, you don't need VoIP. :)
+ if (cl_voip->modified || cl_rate->modified) {
+ if ((cl_voip->integer) && (cl_rate->integer < 25000)) {
+ Com_Printf(S_COLOR_YELLOW "Your network rate is too slow for VoIP.\n");
+ Com_Printf("Set 'Data Rate' to 'LAN/Cable/xDSL' in 'Setup/System/Network'.\n");
+ Com_Printf("Until then, VoIP is disabled.\n");
+ Cvar_Set("cl_voip", "0");
+ }
+ cl_voip->modified = qfalse;
+ cl_rate->modified = qfalse;
+ }
+
if (!clc.speexInitialized)
return; // just in case this gets called at a bad time.
@@ -3573,7 +3591,7 @@ void CL_Init( void ) {
// userinfo
Cvar_Get ("name", Sys_GetCurrentUser( ), CVAR_USERINFO | CVAR_ARCHIVE );
- Cvar_Get ("rate", "25000", CVAR_USERINFO | CVAR_ARCHIVE );
+ cl_rate = Cvar_Get ("rate", "25000", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get ("snaps", "20", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get ("color1", "4", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get ("color2", "5", CVAR_USERINFO | CVAR_ARCHIVE );
@@ -3597,20 +3615,8 @@ void CL_Init( void ) {
cl_voipShowMeter = Cvar_Get ("cl_voipShowMeter", "1", CVAR_ARCHIVE);
// This is a protocol version number.
- cl_voip = Cvar_Get ("cl_voip", "1", CVAR_USERINFO | CVAR_ARCHIVE | CVAR_LATCH);
+ cl_voip = Cvar_Get ("cl_voip", "1", CVAR_USERINFO | CVAR_ARCHIVE);
Cvar_CheckRange( cl_voip, 0, 1, qtrue );
-
- // If your data rate is too low, you'll get Connection Interrupted warnings
- // when VoIP packets arrive, even if you have a broadband connection.
- // This might work on rates lower than 25000, but for safety's sake, we'll
- // just demand it. Who doesn't have at least a DSL line now, anyhow? If
- // you don't, you don't need VoIP. :)
- if ((cl_voip->integer) && (Cvar_VariableIntegerValue("rate") < 25000)) {
- Com_Printf(S_COLOR_YELLOW "Your network rate is too slow for VoIP.\n");
- Com_Printf("Set 'Data Rate' to 'LAN/Cable/xDSL' in 'Setup/System/Network' and restart.\n");
- Com_Printf("Until then, VoIP is disabled.\n");
- Cvar_Set("cl_voip", "0");
- }
#endif