diff options
author | Zack Middleton <zturtleman@gmail.com> | 2013-04-06 01:06:34 -0500 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-05-03 16:07:36 +0100 |
commit | caf9c3c4feb6e65963e82a6b4c87895732de79f2 (patch) | |
tree | 9155a895d1f002f0c1fc907592060725dd922158 /src/qcommon | |
parent | 4bc0dc5594ae2744090d27a5cea10a4f8e8b928d (diff) |
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.
Diffstat (limited to 'src/qcommon')
-rw-r--r-- | src/qcommon/cvar.c | 24 |
1 files 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) { |