Quote:
Originally Posted by impossible_cc
Edit:
if all of that is int, not convar, then do like this
PHP Code:
void SomeFunction()
{
g_cvSomeCvar.IntValue = g_iAnotherCvar + g_iYetAnotherCvar * g_iSomeConstant;
}
|
Thank you, impossible_cc. So the IntValue methodmap property can work like both GetConVarInt and SetConVarInt functions even in the same statement. Interesting...
Quote:
Originally Posted by asherkin
There is no difference pre- or post-methodmaps, convar handles have always been cached, and convars do the value conversions when they're set so getting values is just copying memory.
|
So there's no performance advantage to hooking cvar change and creating a var (bool, int, float) to track it over simply calling the cvar value? And...
PHP Code:
void SomeFunction()
{
g_cvSomeCvar.IntValue = g_iAnotherCvar.IntValue + g_iYetAnotherCvar.IntValue * g_iSomeConstant;
// and...
SetConVarInt(g_cvSomeCvar) = (GetConVarInt(g_iAnotherCvar) + GetConVarInt(g_iYetAnotherCvar) * g_iSomeConstant);
// are equivalent and one has no performance advantage over the other?
}
So, when and why would we use:
PHP Code:
g_cvMyCvar.AddChangeHook(MyCallback);
Thank you for the help,
PG