From caf9c3c4feb6e65963e82a6b4c87895732de79f2 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sat, 6 Apr 2013 01:06:34 -0500 Subject: Fix setting CVAR_VM_CREATED flag on user created cvars Fix setting CVAR_VM_CREATED flag on cvars created using set[asu] commands (including archived cvars from cfg) and trap_Cvar_Set. trap_Cvar_Register called Cvar_Get which cleared CVAR_USER_CREATED flag, but CVAR_VM_CREATED wasn't set because the cvar already existed. --- src/qcommon/cvar.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/qcommon/cvar.c b/src/qcommon/cvar.c index 1ddac15a..84d6ac5a 100644 --- a/src/qcommon/cvar.c +++ b/src/qcommon/cvar.c @@ -335,6 +335,18 @@ cvar_t *Cvar_Get( const char *var_name, const char *var_value, int flags ) { { var_value = Cvar_Validate(var, var_value, qfalse); + // Make sure the game code cannot mark engine-added variables as gamecode vars + if(var->flags & CVAR_VM_CREATED) + { + if(!(flags & CVAR_VM_CREATED)) + var->flags &= ~CVAR_VM_CREATED; + } + else if (!(var->flags & CVAR_USER_CREATED)) + { + if(flags & CVAR_VM_CREATED) + flags &= ~CVAR_VM_CREATED; + } + // if the C code is now specifying a variable that the user already // set a value for, take the new value as the reset value if(var->flags & CVAR_USER_CREATED) @@ -355,18 +367,6 @@ cvar_t *Cvar_Get( const char *var_name, const char *var_value, int flags ) { } } - // Make sure the game code cannot mark engine-added variables as gamecode vars - if(var->flags & CVAR_VM_CREATED) - { - if(!(flags & CVAR_VM_CREATED)) - var->flags &= ~CVAR_VM_CREATED; - } - else - { - if(flags & CVAR_VM_CREATED) - flags &= ~CVAR_VM_CREATED; - } - // Make sure servers cannot mark engine-added variables as SERVER_CREATED if(var->flags & CVAR_SERVER_CREATED) { -- cgit