Let custom CVar handlers to be called on cloned cvars
This commit is contained in:
parent
82b7e93d26
commit
b50d7f4db5
4 changed files with 184 additions and 31 deletions
|
|
@ -458,8 +458,17 @@ void userinfo_t::Reset()
|
|||
case NAME_PlayerClass: type = CVAR_Int; break;
|
||||
default: type = cvar->GetRealType(); break;
|
||||
}
|
||||
newcvar = C_CreateCVar(NULL, type, cvar->GetFlags() & CVAR_MOD);
|
||||
|
||||
int flags = cvar->GetFlags();
|
||||
|
||||
newcvar = C_CreateCVar(NULL, type, (flags & CVAR_MOD) | ((flags & CVAR_ZS_CUSTOM) << 1) );
|
||||
newcvar->SetGenericRepDefault(cvar->GetGenericRepDefault(CVAR_String), CVAR_String);
|
||||
|
||||
if(flags & CVAR_ZS_CUSTOM)
|
||||
{
|
||||
newcvar->SetExtraDataPointer(cvar); // store backing cvar
|
||||
}
|
||||
|
||||
Insert(cvarname, newcvar);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue