FBaseCVar *FindCVar (const char *var_name, FBaseCVar **prev) { FBaseCVar *var; FBaseCVar *dummy; if (var_name == NULL) return NULL; if (prev == NULL) prev = &dummy; var = CVars; *prev = NULL; while (var) { if (stricmp (var->GetName (), var_name) == 0) break; *prev = var; var = var->m_Next; } return var; }
void D_SetupUserInfo () { int i; userinfo_t *coninfo; // Reset everybody's userinfo to a default state. for (i = 0; i < MAXPLAYERS; i++) { players[i].userinfo.Reset(); } // Initialize the console player's user info coninfo = &players[consoleplayer].userinfo; for (FBaseCVar *cvar = CVars; cvar != NULL; cvar = cvar->GetNext()) { if ((cvar->GetFlags() & (CVAR_USERINFO|CVAR_IGNORE)) == CVAR_USERINFO) { FBaseCVar **newcvar; FName cvarname(cvar->GetName()); switch (cvarname.GetIndex()) { // Some cvars don't copy their original value directly. case NAME_Team: coninfo->TeamChanged(team); break; case NAME_Skin: coninfo->SkinChanged(skin); break; case NAME_Gender: coninfo->GenderChanged(gender); break; case NAME_PlayerClass: coninfo->PlayerClassChanged(playerclass); break; // The rest do. default: newcvar = coninfo->CheckKey(cvarname); (*newcvar)->SetGenericRep(cvar->GetGenericRep(CVAR_String), CVAR_String); break; } } } R_BuildPlayerTranslation(consoleplayer); }