- console code fixes from GZDoom.

This commit is contained in:
Christoph Oelckers 2020-04-19 21:56:25 +02:00
parent 4523ad5f7e
commit 2e8566c6eb
2 changed files with 14 additions and 17 deletions

View file

@ -720,6 +720,7 @@ void C_SetDefaultKeys(const char* baseconfig)
ReadBindings(lump, true); ReadBindings(lump, true);
} }
lastlump = 0;
while ((lump = fileSystem.FindLump("DEFBINDS", &lastlump)) != -1) while ((lump = fileSystem.FindLump("DEFBINDS", &lastlump)) != -1)
{ {
ReadBindings(lump, false); ReadBindings(lump, false);

View file

@ -172,7 +172,7 @@ void FBaseCVar::SetGenericRep (UCVarValue value, ECVarType type)
{ {
return; return;
} }
else if ((Flags & CVAR_LATCH) && callbacks && callbacks->MustLatch()) if ((Flags & CVAR_LATCH) && callbacks && callbacks->MustLatch())
{ {
FLatchedValue latch; FLatchedValue latch;
@ -186,16 +186,14 @@ void FBaseCVar::SetGenericRep (UCVarValue value, ECVarType type)
LatchedValues.Push (latch); LatchedValues.Push (latch);
Flags &= ~CVAR_UNSAFECONTEXT; Flags &= ~CVAR_UNSAFECONTEXT;
return;
} }
else if ((Flags & CVAR_SERVERINFO) && callbacks && callbacks->SendServerInfoChange) if ((Flags & CVAR_SERVERINFO) && callbacks && callbacks->SendServerInfoChange)
{ {
callbacks->SendServerInfoChange (this, value, type); if (callbacks->SendServerInfoChange(this, value, type)) return;
} }
else
{
ForceSet (value, type); ForceSet (value, type);
} }
}
bool FBaseCVar::ToBool (UCVarValue value, ECVarType type) bool FBaseCVar::ToBool (UCVarValue value, ECVarType type)
{ {
@ -969,10 +967,8 @@ void FFlagCVar::DoSet (UCVarValue value, ECVarType type)
// another flag might have made to the same cvar earlier in the script. // another flag might have made to the same cvar earlier in the script.
if (ValueVar.GetFlags() && callbacks && callbacks->SendServerFlagChange) if (ValueVar.GetFlags() && callbacks && callbacks->SendServerFlagChange)
{ {
callbacks->SendServerFlagChange(&ValueVar, BitNum, newval, false); if (callbacks->SendServerFlagChange(&ValueVar, BitNum, newval, false)) return;
} }
else
{
int val = *ValueVar; int val = *ValueVar;
if (newval) if (newval)
val |= BitVal; val |= BitVal;
@ -980,7 +976,6 @@ void FFlagCVar::DoSet (UCVarValue value, ECVarType type)
val &= ~BitVal; val &= ~BitVal;
ValueVar = val; ValueVar = val;
} }
}
// //
// Mask cvar implementation // Mask cvar implementation
@ -1072,13 +1067,14 @@ void FMaskCVar::DoSet (UCVarValue value, ECVarType type)
{ {
if (BitVal & (1<<i)) if (BitVal & (1<<i))
{ {
callbacks->SendServerFlagChange (&ValueVar, i, !!(val & (1<<i)), silent); if (!callbacks->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. silent = true; // only warn once if SendServerFlagChange needs to.
} }
} }
} }
else else
{ {
fallback:
int vval = *ValueVar; int vval = *ValueVar;
vval &= ~BitVal; vval &= ~BitVal;
vval |= val; vval |= val;