]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added sv_disablenotify cvar (default 1) to suppress prints about
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 17 Oct 2011 17:07:41 +0000 (17:07 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 17 Oct 2011 17:07:41 +0000 (17:07 +0000)
CVAR_NOTIFY cvars changing

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11438 d7cf8633-e32d-0410-b094-e92efae38249

cvar.c
sv_main.c

diff --git a/cvar.c b/cvar.c
index f7cc77bbcade32d5de1b3e17b0efb36aaf546cd9..8cc14f0964396c91b48e1f5c8d707cc081d07108 100644 (file)
--- a/cvar.c
+++ b/cvar.c
@@ -318,6 +318,7 @@ void Cvar_UpdateAllAutoCvars(void)
 Cvar_Set
 ============
 */
 Cvar_Set
 ============
 */
+extern cvar_t sv_disablenotify;
 void Cvar_SetQuick_Internal (cvar_t *var, const char *value)
 {
        qboolean changed;
 void Cvar_SetQuick_Internal (cvar_t *var, const char *value)
 {
        qboolean changed;
@@ -341,7 +342,7 @@ void Cvar_SetQuick_Internal (cvar_t *var, const char *value)
        memcpy ((char *)var->string, value, valuelen + 1);
        var->value = atof (var->string);
        var->integer = (int) var->value;
        memcpy ((char *)var->string, value, valuelen + 1);
        var->value = atof (var->string);
        var->integer = (int) var->value;
-       if ((var->flags & CVAR_NOTIFY) && changed && sv.active)
+       if ((var->flags & CVAR_NOTIFY) && changed && sv.active && !sv_disablenotify.integer)
                SV_BroadcastPrintf("\"%s\" changed to \"%s\"\n", var->name, var->string);
 #if 0
        // TODO: add infostring support to the server?
                SV_BroadcastPrintf("\"%s\" changed to \"%s\"\n", var->name, var->string);
 #if 0
        // TODO: add infostring support to the server?
index db86c8f01d9e9131af11b3f9f9f0cfa5fb6b845f..a223b7c507eb041d7fa72cd2228925a79b47e88e 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -39,6 +39,7 @@ cvar_t sv_worldname = {CVAR_READONLY, "sv_worldname", "", "name of current world
 cvar_t sv_worldnamenoextension = {CVAR_READONLY, "sv_worldnamenoextension", "", "name of current worldmodel without extension"};
 cvar_t sv_worldbasename = {CVAR_READONLY, "sv_worldbasename", "", "name of current worldmodel without maps/ prefix or extension"};
 
 cvar_t sv_worldnamenoextension = {CVAR_READONLY, "sv_worldnamenoextension", "", "name of current worldmodel without extension"};
 cvar_t sv_worldbasename = {CVAR_READONLY, "sv_worldbasename", "", "name of current worldmodel without maps/ prefix or extension"};
 
+cvar_t sv_disablenotify = {0, "sv_disablenotify", "1", "suppress broadcast prints when certain cvars are changed (CVAR_NOTIFY flag in engine code)"};
 cvar_t coop = {0, "coop","0", "coop mode, 0 = no coop, 1 = coop mode, multiple players playing through the singleplayer game (coop mode also shuts off deathmatch)"};
 cvar_t deathmatch = {0, "deathmatch","0", "deathmatch mode, values depend on mod but typically 0 = no deathmatch, 1 = normal deathmatch with respawning weapons, 2 = weapons stay (players can only pick up new weapons)"};
 cvar_t fraglimit = {CVAR_NOTIFY, "fraglimit","0", "ends level if this many frags is reached by any player"};
 cvar_t coop = {0, "coop","0", "coop mode, 0 = no coop, 1 = coop mode, multiple players playing through the singleplayer game (coop mode also shuts off deathmatch)"};
 cvar_t deathmatch = {0, "deathmatch","0", "deathmatch mode, values depend on mod but typically 0 = no deathmatch, 1 = normal deathmatch with respawning weapons, 2 = weapons stay (players can only pick up new weapons)"};
 cvar_t fraglimit = {CVAR_NOTIFY, "fraglimit","0", "ends level if this many frags is reached by any player"};
@@ -449,6 +450,7 @@ void SV_Init (void)
        Cmd_AddCommand_WithClientCommand("sv_startdownload", NULL, SV_StartDownload_f, "begins sending a file to the client (network protocol use only)");
        Cmd_AddCommand_WithClientCommand("download", NULL, SV_Download_f, "downloads a specified file from the server");
 
        Cmd_AddCommand_WithClientCommand("sv_startdownload", NULL, SV_StartDownload_f, "begins sending a file to the client (network protocol use only)");
        Cmd_AddCommand_WithClientCommand("download", NULL, SV_Download_f, "downloads a specified file from the server");
 
+       Cvar_RegisterVariable (&sv_disablenotify);
        Cvar_RegisterVariable (&coop);
        Cvar_RegisterVariable (&deathmatch);
        Cvar_RegisterVariable (&fraglimit);
        Cvar_RegisterVariable (&coop);
        Cvar_RegisterVariable (&deathmatch);
        Cvar_RegisterVariable (&fraglimit);