mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-10 23:02:01 +00:00
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.
This commit is contained in:
parent
6a763f0671
commit
0f62a565f9
1 changed files with 12 additions and 12 deletions
|
@ -334,6 +334,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)
|
||||
|
@ -354,18 +366,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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue