the mismatching initial values developer cvar warning only gets printed once

This commit is contained in:
myT 2017-05-04 18:30:06 +02:00
parent 172b6a0e9a
commit 998ad98511
2 changed files with 4 additions and 1 deletions

View File

@ -273,9 +273,11 @@ cvar_t* Cvar_Get( const char *var_name, const char *var_value, int flags )
if ((flags & CVAR_ROM) || !var->resetString[0]) {
Z_Free( var->resetString );
var->resetString = CopyString( var_value );
} else if ( var_value[0] && strcmp( var->resetString, var_value ) ) {
} else if ( com_developer && com_developer->integer && !var->mismatchPrinted &&
var_value[0] && strcmp( var->resetString, var_value ) ) {
Com_DPrintf( "Warning: cvar \"%s\" given initial values: \"%s\" and \"%s\"\n",
var_name, var->resetString, var_value );
var->mismatchPrinted = qtrue;
}
// if we have a latched string, take that value now

View File

@ -420,6 +420,7 @@ typedef struct cvar_s {
int modificationCount; // incremented each time the cvar is changed
float value; // atof( string )
int integer; // atoi( string )
qbool mismatchPrinted; // have we already notified of mismatching initial values?
struct cvar_s *next;
struct cvar_s *hashNext;
} cvar_t;