From bb914126f2f867ad0041af64a7e8c5b5d11af149 Mon Sep 17 00:00:00 2001 From: Pavlo Ilin Date: Fri, 3 May 2019 18:02:48 +0200 Subject: [PATCH] !B (System) Fix cvar overrides for const float cvars Copied from Perforce Change: 1967753 --- Code/CryEngine/Cry3DEngine/cvars.h | 6 +----- Code/CryEngine/CryCommon/CrySystem/ConsoleRegistration.h | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Code/CryEngine/Cry3DEngine/cvars.h b/Code/CryEngine/Cry3DEngine/cvars.h index 6d2fd13de..01351c5cd 100644 --- a/Code/CryEngine/Cry3DEngine/cvars.h +++ b/Code/CryEngine/Cry3DEngine/cvars.h @@ -4,11 +4,7 @@ #include -#if defined(CONSOLE_CONST_CVAR_MODE) - #define GetFloatCVar(name) name ## Default -#else - #define GetFloatCVar(name) (Cry3DEngineBase::GetCVars())->name -#endif +#define GetFloatCVar(name) (Cry3DEngineBase::GetCVars())->name // console variables struct CVars : public Cry3DEngineBase diff --git a/Code/CryEngine/CryCommon/CrySystem/ConsoleRegistration.h b/Code/CryEngine/CryCommon/CrySystem/ConsoleRegistration.h index f8af72885..d50335f18 100644 --- a/Code/CryEngine/CryCommon/CrySystem/ConsoleRegistration.h +++ b/Code/CryEngine/CryCommon/CrySystem/ConsoleRegistration.h @@ -260,9 +260,9 @@ struct SDummyCVar : ICVar #define DefineConstIntCVar3(name, _var_, defaultValue, flags, help) { static_assert(static_cast(GetCVarOverride( # name, defaultValue)) == static_cast(_var_), "Unexpected value!"); REGISTER_DUMMY_CVAR(int, name, GetCVarOverride( # name, defaultValue)); } #define AllocateConstIntCVar(scope, name) - #define DefineConstFloatCVar(name, flags, help) { REGISTER_DUMMY_CVAR(float, ( # name), name ## Default); } - #define DeclareConstFloatCVar(name) - #define DeclareStaticConstFloatCVar(name) + #define DefineConstFloatCVar(name, flags, help) { REGISTER_DUMMY_CVAR(float, ( # name), GetCVarOverride( # name, name ## Default) ); } + #define DeclareConstFloatCVar(name) static constexpr float name = GetCVarOverride( # name, name ## Default) + #define DeclareStaticConstFloatCVar(name) DeclareConstFloatCVar(name) #define AllocateConstFloatCVar(scope, name) #else -- 2.11.4.GIT