- added a bit of hackery so that compatmode CVAR can be set up on startup

This commit is contained in:
Christoph Oelckers 2022-04-12 00:31:31 +02:00
parent dfdf330722
commit c4408d8536
3 changed files with 10 additions and 6 deletions

View file

@ -55,9 +55,6 @@ struct FLatchedValue
static TArray<FLatchedValue> LatchedValues;
bool FBaseCVar::m_DoNoSet = false;
bool FBaseCVar::m_UseCallback = false;
FBaseCVar *CVars = NULL;
int cvar_defflags;
@ -523,6 +520,7 @@ void FBaseCVar::EnableNoSet ()
void FBaseCVar::EnableCallbacks ()
{
m_inEnable = true;
m_UseCallback = true;
FBaseCVar *cvar = CVars;
@ -534,6 +532,7 @@ void FBaseCVar::EnableCallbacks ()
}
cvar = cvar->m_Next;
}
m_inEnable = false;
}
void FBaseCVar::DisableCallbacks ()

View file

@ -210,14 +210,17 @@ protected:
uint32_t Flags;
bool inCallback = false;
public:
static inline bool m_inEnable = false;
private:
FBaseCVar (const FBaseCVar &var) = delete;
FBaseCVar (const char *name, uint32_t flags);
void (*m_Callback)(FBaseCVar &);
FBaseCVar *m_Next;
static bool m_UseCallback;
static bool m_DoNoSet;
static inline bool m_UseCallback = false;
static inline bool m_DoNoSet = false;
void *m_ExtraDataPointer;

View file

@ -569,6 +569,7 @@ EXTERN_CVAR(Int, compatmode)
CUSTOM_CVAR (Int, compatflags, 0, CVAR_ARCHIVE|CVAR_SERVERINFO | CVAR_NOINITCALL)
{
if (FBaseCVar::m_inEnable) return;
for (auto Level : AllLevels())
{
Level->ApplyCompatibility();
@ -577,6 +578,7 @@ CUSTOM_CVAR (Int, compatflags, 0, CVAR_ARCHIVE|CVAR_SERVERINFO | CVAR_NOINITCALL
CUSTOM_CVAR (Int, compatflags2, 0, CVAR_ARCHIVE|CVAR_SERVERINFO | CVAR_NOINITCALL)
{
if (FBaseCVar::m_inEnable) return;
for (auto Level : AllLevels())
{
Level->ApplyCompatibility2();
@ -584,7 +586,7 @@ CUSTOM_CVAR (Int, compatflags2, 0, CVAR_ARCHIVE|CVAR_SERVERINFO | CVAR_NOINITCAL
}
}
CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL)
CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE)
{
int v, w = 0;