Fix VMs forcing engine latch cvar to update to latched value

A few commits ago I stopped VM's Cvar_Set() from instantly updating
latched values. Now VM can't call Cvar_Register() afterword to force
latched value to be used.

Reported by Noah Metzger (Chomenor).
This commit is contained in:
Zack Middleton 2018-01-21 19:49:16 -06:00
parent 3638f69dff
commit ed8d48cac3

View file

@ -1376,7 +1376,13 @@ void Cvar_Register(vmCvar_t *vmCvar, const char *varName, const char *defaultVal
if ( cv && ( cv->flags & CVAR_PROTECTED ) ) { if ( cv && ( cv->flags & CVAR_PROTECTED ) ) {
Com_DPrintf( S_COLOR_YELLOW "WARNING: VM tried to register protected cvar '%s' with value '%s'%s\n", Com_DPrintf( S_COLOR_YELLOW "WARNING: VM tried to register protected cvar '%s' with value '%s'%s\n",
varName, defaultValue, ( flags & ~cv->flags ) != 0 ? " and new flags" : "" ); varName, defaultValue, ( flags & ~cv->flags ) != 0 ? " and new flags" : "" );
} else { }
// Don't set engine latch cvar to latched value.
else if ( cv && ( cv->flags & CVAR_LATCH ) && !( cv->flags & CVAR_VM_CREATED ) ) {
cv->flags |= flags;
cvar_modifiedFlags |= flags;
}
else {
cv = Cvar_Get(varName, defaultValue, flags | CVAR_VM_CREATED); cv = Cvar_Get(varName, defaultValue, flags | CVAR_VM_CREATED);
} }