本文整理汇总了C++中FBaseCVar::GetGenericRep方法的典型用法代码示例。如果您正苦于以下问题:C++ FBaseCVar::GetGenericRep方法的具体用法?C++ FBaseCVar::GetGenericRep怎么用?C++ FBaseCVar::GetGenericRep使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FBaseCVar
的用法示例。
在下文中一共展示了FBaseCVar::GetGenericRep方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: C_GetMassCVarString
FString C_GetMassCVarString (DWORD filter, bool compact)
{
FBaseCVar *cvar;
FString dump;
if (compact)
{
TArray<FBaseCVar *> cvars;
dump.AppendFormat("\\\\%ux", filter);
FilterCompactCVars(cvars, filter);
while (cvars.Pop (cvar))
{
UCVarValue val = cvar->GetGenericRep(CVAR_String);
dump << '\\' << val.String;
}
}
else
{
for (cvar = CVars; cvar != NULL; cvar = cvar->m_Next)
{
if ((cvar->Flags & filter) && !(cvar->Flags & (CVAR_NOSAVE|CVAR_IGNORE)))
{
UCVarValue val = cvar->GetGenericRep(CVAR_String);
dump << '\\' << cvar->GetName() << '\\' << val.String;
}
}
}
return dump;
}
示例2: C_WriteCVars
void C_WriteCVars (BYTE **demo_p, DWORD filter, bool compact)
{
FBaseCVar *cvar = CVars;
BYTE *ptr = *demo_p;
if (compact)
{
TArray<FBaseCVar *> cvars;
ptr += sprintf ((char *)ptr, "\\\\%ux", filter);
FilterCompactCVars (cvars, filter);
while (cvars.Pop (cvar))
{
UCVarValue val = cvar->GetGenericRep (CVAR_String);
ptr += sprintf ((char *)ptr, "\\%s", val.String);
}
}
else
{
cvar = CVars;
while (cvar)
{
if ((cvar->Flags & filter) && !(cvar->Flags & (CVAR_NOSAVE|CVAR_IGNORE)))
{
UCVarValue val = cvar->GetGenericRep (CVAR_String);
ptr += sprintf ((char *)ptr, "\\%s\\%s",
cvar->GetName (), val.String);
}
cvar = cvar->m_Next;
}
}
*demo_p = ptr + 1;
}
示例3: C_ArchiveCVars
void C_ArchiveCVars (FConfigFile *f, uint32 filter)
{
FBaseCVar *cvar = CVars;
while (cvar)
{
if ((cvar->Flags &
(CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_MOD|CVAR_AUTO|CVAR_USERINFO|CVAR_SERVERINFO|CVAR_NOSAVE))
== filter)
{
UCVarValue val;
val = cvar->GetGenericRep (CVAR_String);
// [BB] This is ancient code from Skulltag...
if ( filter == (CVAR_ARCHIVE|CVAR_USERINFO) )
{
char szString[64];
strncpy( szString, val.String, 63 );
szString[63] = 0;
V_UnColorizeString( szString, 64 );
f->SetValueForKey (cvar->GetName (), szString);
}
else
f->SetValueForKey (cvar->GetName (), val.String);
}
cvar = cvar->m_Next;
}
}
示例4: ListVars
void FBaseCVar::ListVars (const char *filter, bool plain)
{
FBaseCVar *var = CVars;
int count = 0;
while (var)
{
if (CheckWildcards (filter, var->GetName()))
{
DWORD flags = var->GetFlags();
UCVarValue val;
val = var->GetGenericRep (CVAR_String);
if (plain)
{ // plain formatting does not include user-defined cvars
if (!(flags & CVAR_UNSETTABLE))
{
++count;
Printf ("%s : %s\n", var->GetName(), var->GetGenericRep(CVAR_String).String);
}
}
else
{
++count;
Printf ("%c%c%c%c%c %s = %s\n",
flags & CVAR_ARCHIVE ? 'A' : ' ',
flags & CVAR_USERINFO ? 'U' :
flags & CVAR_SERVERINFO ? 'S' :
flags & CVAR_AUTO ? 'C' : ' ',
flags & CVAR_NOSET ? '-' :
flags & CVAR_LATCH ? 'L' :
flags & CVAR_UNSETTABLE ? '*' : ' ',
flags & CVAR_MOD ? 'M' : ' ',
flags & CVAR_IGNORE ? 'X' : ' ',
var->GetName(),
var->GetGenericRep (CVAR_String).String);
}
}
var = var->m_Next;
}
Printf ("%d cvars\n", count);
}
示例5: ResetColors
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;
}
}
示例6: AddAutoexec
void FGameConfigFile::AddAutoexec (DArgs *list, const char *game)
{
char section[64];
const char *key;
const char *value;
mysnprintf (section, countof(section), "%s.AutoExec", game);
if (bMigrating)
{
FBaseCVar *autoexec = FindCVar ("autoexec", NULL);
if (autoexec != NULL)
{
UCVarValue val;
char *path;
val = autoexec->GetGenericRep (CVAR_String);
path = copystring (val.String);
delete autoexec;
SetSection (section, true);
SetValueForKey ("Path", path);
list->AppendArg (path);
delete[] path;
}
}
else
{
// If <game>.AutoExec section does not exist, create it
// with a default autoexec.cfg file present.
CreateStandardAutoExec(section, false);
// Run any files listed in the <game>.AutoExec section
if (!SectionIsEmpty())
{
while (NextInSection (key, value))
{
if (stricmp (key, "Path") == 0 && *value != '\0')
{
FString expanded_path = ExpandEnvVars(value);
if (FileExists(expanded_path))
{
list->AppendArg (ExpandEnvVars(value));
}
}
}
}
}
}
示例7: C_BackupCVars
void C_BackupCVars (void)
{
assert(CVarBackups.Size() == 0);
CVarBackups.Clear();
FCVarBackup backup;
for (FBaseCVar *cvar = CVars; cvar != NULL; cvar = cvar->m_Next)
{
if ((cvar->Flags & (CVAR_SERVERINFO|CVAR_DEMOSAVE)) && !(cvar->Flags & CVAR_LATCH))
{
backup.Name = cvar->GetName();
backup.String = cvar->GetGenericRep(CVAR_String).String;
CVarBackups.Push(backup);
}
}
}
示例8: C_ArchiveCVars
void C_ArchiveCVars (FConfigFile *f, uint32 filter)
{
FBaseCVar *cvar = CVars;
while (cvar)
{
if ((cvar->Flags &
(CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_MOD|CVAR_AUTO|CVAR_USERINFO|CVAR_SERVERINFO|CVAR_NOSAVE))
== filter)
{
UCVarValue val;
val = cvar->GetGenericRep (CVAR_String);
f->SetValueForKey (cvar->GetName (), val.String);
}
cvar = cvar->m_Next;
}
}
示例9: D_SetupUserInfo
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, players[consoleplayer].CurrentPlayerClass);
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);
}
示例10: C_BackupCVars
void C_BackupCVars (void)
{
struct backup_s *backup = CVarBackups;
FBaseCVar *cvar = CVars;
while (cvar)
{
if ((cvar->Flags & (CVAR_SERVERINFO|CVAR_DEMOSAVE))
&& !(cvar->Flags & CVAR_LATCH))
{
if (backup == &CVarBackups[MAX_DEMOCVARS])
I_Error ("C_BackupDemoCVars: Too many cvars to save (%d)", MAX_DEMOCVARS);
backup->name = copystring (cvar->GetName());
backup->string = copystring (cvar->GetGenericRep (CVAR_String).String);
backup++;
}
cvar = cvar->m_Next;
}
numbackedup = int(backup - CVarBackups);
}
示例11: FindCVar
static const char *SetServerVar (char *name, ECVarType type, BYTE **stream, bool singlebit)
{
FBaseCVar *var = FindCVar (name, NULL);
UCVarValue value;
if (singlebit)
{
if (var != NULL)
{
int bitdata;
int mask;
value = var->GetFavoriteRep (&type);
if (type != CVAR_Int)
{
return NULL;
}
bitdata = ReadByte (stream);
mask = 1 << (bitdata & 31);
if (bitdata & 32)
{
value.Int |= mask;
}
else
{
value.Int &= ~mask;
}
}
}
else
{
switch (type)
{
case CVAR_Bool: value.Bool = ReadByte (stream) ? 1 : 0; break;
case CVAR_Int: value.Int = ReadLong (stream); break;
case CVAR_Float: value.Float = ReadFloat (stream); break;
case CVAR_String: value.String = ReadString (stream); break;
default: break; // Silence GCC
}
}
if (var)
{
var->ForceSet (value, type);
}
if (type == CVAR_String)
{
delete[] value.String;
}
if (var == &teamplay)
{
// Put players on teams if teamplay turned on
for (int i = 0; i < MAXPLAYERS; ++i)
{
if (playeringame[i])
{
UpdateTeam (i, players[i].userinfo.GetTeam(), true);
}
}
}
if (var)
{
value = var->GetGenericRep (CVAR_String);
return value.String;
}
return NULL;
}
示例12: DoGlobalSetup
//.........这里部分代码省略.........
{
more = DeleteCurrentSection();
}
else
{
more = SetNextSection();
}
}
}
if (last < 209)
{
// menu dimming is now a gameinfo option so switch user override off
FBaseCVar *dim = FindCVar ("dimamount", NULL);
if (dim != NULL)
{
dim->ResetToDefault ();
}
}
if (last < 210)
{
if (SetSection ("Hexen.Bindings"))
{
// These 2 were misnamed in earlier versions
SetValueForKey ("6", "use ArtiPork");
SetValueForKey ("5", "use ArtiInvulnerability2");
}
}
if (last < 213)
{
auto var = FindCVar("snd_channels", NULL);
if (var != NULL)
{
// old settings were default 32, minimum 8, new settings are default 128, minimum 64.
UCVarValue v = var->GetGenericRep(CVAR_Int);
if (v.Int < 64) var->ResetToDefault();
}
}
if (last < 214)
{
FBaseCVar *var = FindCVar("hud_scale", NULL);
if (var != NULL) var->ResetToDefault();
var = FindCVar("st_scale", NULL);
if (var != NULL) var->ResetToDefault();
var = FindCVar("hud_althudscale", NULL);
if (var != NULL) var->ResetToDefault();
var = FindCVar("con_scale", NULL);
if (var != NULL) var->ResetToDefault();
var = FindCVar("con_scaletext", NULL);
if (var != NULL) var->ResetToDefault();
var = FindCVar("uiscale", NULL);
if (var != NULL) var->ResetToDefault();
}
if (last < 215)
{
// Previously a true/false boolean. Now an on/off/auto tri-state with auto as the default.
FBaseCVar *var = FindCVar("snd_hrtf", NULL);
if (var != NULL) var->ResetToDefault();
}
if (last < 216)
{
FBaseCVar *var = FindCVar("gl_texture_hqresize", NULL);
if (var != NULL)
{
auto v = var->GetGenericRep(CVAR_Int);
switch (v.Int)
{