diff --git a/source/common/console/c_bind.cpp b/source/common/console/c_bind.cpp index f4802b1e5..609f2bf86 100644 --- a/source/common/console/c_bind.cpp +++ b/source/common/console/c_bind.cpp @@ -720,6 +720,7 @@ void C_SetDefaultKeys(const char* baseconfig) ReadBindings(lump, true); } + lastlump = 0; while ((lump = fileSystem.FindLump("DEFBINDS", &lastlump)) != -1) { ReadBindings(lump, false); diff --git a/source/common/console/c_cvars.cpp b/source/common/console/c_cvars.cpp index 20a0119f7..5b15a7ebc 100644 --- a/source/common/console/c_cvars.cpp +++ b/source/common/console/c_cvars.cpp @@ -172,7 +172,7 @@ void FBaseCVar::SetGenericRep (UCVarValue value, ECVarType type) { return; } - else if ((Flags & CVAR_LATCH) && callbacks && callbacks->MustLatch()) + if ((Flags & CVAR_LATCH) && callbacks && callbacks->MustLatch()) { FLatchedValue latch; @@ -186,15 +186,13 @@ void FBaseCVar::SetGenericRep (UCVarValue value, ECVarType type) LatchedValues.Push (latch); Flags &= ~CVAR_UNSAFECONTEXT; + return; } - else if ((Flags & CVAR_SERVERINFO) && callbacks && callbacks->SendServerInfoChange) + if ((Flags & CVAR_SERVERINFO) && callbacks && callbacks->SendServerInfoChange) { - callbacks->SendServerInfoChange (this, value, type); - } - else - { - ForceSet (value, type); + if (callbacks->SendServerInfoChange(this, value, type)) return; } + ForceSet (value, type); } bool FBaseCVar::ToBool (UCVarValue value, ECVarType type) @@ -969,17 +967,14 @@ void FFlagCVar::DoSet (UCVarValue value, ECVarType type) // another flag might have made to the same cvar earlier in the script. if (ValueVar.GetFlags() && callbacks && callbacks->SendServerFlagChange) { - callbacks->SendServerFlagChange(&ValueVar, BitNum, newval, false); + if (callbacks->SendServerFlagChange(&ValueVar, BitNum, newval, false)) return; } + int val = *ValueVar; + if (newval) + val |= BitVal; else - { - int val = *ValueVar; - if (newval) - val |= BitVal; - else - val &= ~BitVal; - ValueVar = val; - } + val &= ~BitVal; + ValueVar = val; } // @@ -1072,13 +1067,14 @@ void FMaskCVar::DoSet (UCVarValue value, ECVarType type) { if (BitVal & (1<SendServerFlagChange (&ValueVar, i, !!(val & (1<SendServerFlagChange(&ValueVar, i, !!(val & (1 << i)), silent)) goto fallback; // the failure case here is either always or never. silent = true; // only warn once if SendServerFlagChange needs to. } } } else { + fallback: int vval = *ValueVar; vval &= ~BitVal; vval |= val;