void userinfo_t::Reset() { // Clear this player's userinfo. TMapIterator<FName, FBaseCVar *> it(*this); TMap<FName, FBaseCVar *>::Pair *pair; while (it.NextPair(pair)) { delete pair->Value; } Clear(); // Create userinfo vars for this player, initialized to their defaults. for (FBaseCVar *cvar = CVars; cvar != NULL; cvar = cvar->GetNext()) { if ((cvar->GetFlags() & (CVAR_USERINFO|CVAR_IGNORE)) == CVAR_USERINFO) { ECVarType type; FName cvarname(cvar->GetName()); FBaseCVar *newcvar; // Some cvars have different types for their shadow copies. switch (cvarname.GetIndex()) { case NAME_Skin: type = CVAR_Int; break; case NAME_Gender: type = CVAR_Int; break; case NAME_PlayerClass: type = CVAR_Int; break; default: type = cvar->GetRealType(); break; } newcvar = C_CreateCVar(NULL, type, cvar->GetFlags() & CVAR_MOD); newcvar->SetGenericRepDefault(cvar->GetGenericRepDefault(CVAR_String), CVAR_String); Insert(cvarname, newcvar); } } }
void FBaseCVar::ResetColors () { FBaseCVar *var = CVars; while (var) { if (var->GetRealType () == CVAR_Color) { var->DoSet (var->GetGenericRep (CVAR_Int), CVAR_Int); } var = var->m_Next; } }