本文整理汇总了C++中FBaseCVar::ForceSet方法的典型用法代码示例。如果您正苦于以下问题:C++ FBaseCVar::ForceSet方法的具体用法?C++ FBaseCVar::ForceSet怎么用?C++ FBaseCVar::ForceSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FBaseCVar
的用法示例。
在下文中一共展示了FBaseCVar::ForceSet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
FBaseCVar *cvar_forceset (const char *var_name, const char *val)
{
FBaseCVar *var;
UCVarValue vval;
if ( (var = FindCVar (var_name, NULL)) )
{
vval.String = const_cast<char *>(val);
var->ForceSet (vval, CVAR_String);
}
return var;
}
示例2: C_ReadCVars
void C_ReadCVars (BYTE **demo_p)
{
char *ptr = *((char **)demo_p);
char *breakpt;
if (*ptr++ != '\\')
return;
if (*ptr == '\\')
{ // compact mode
TArray<FBaseCVar *> cvars;
FBaseCVar *cvar;
DWORD filter;
ptr++;
breakpt = strchr (ptr, '\\');
*breakpt = 0;
filter = strtoul (ptr, NULL, 16);
*breakpt = '\\';
ptr = breakpt + 1;
FilterCompactCVars (cvars, filter);
while (cvars.Pop (cvar))
{
UCVarValue val;
breakpt = strchr (ptr, '\\');
if (breakpt)
*breakpt = 0;
val.String = ptr;
cvar->ForceSet (val, CVAR_String);
if (breakpt)
{
*breakpt = '\\';
ptr = breakpt + 1;
}
else
break;
}
}
else
{
char *value;
while ( (breakpt = strchr (ptr, '\\')) )
{
*breakpt = 0;
value = breakpt + 1;
if ( (breakpt = strchr (value, '\\')) )
*breakpt = 0;
cvar_set (ptr, value);
*(value - 1) = '\\';
if (breakpt)
{
*breakpt = '\\';
ptr = breakpt + 1;
}
else
{
break;
}
}
}
*demo_p += strlen (*((char **)demo_p)) + 1;
}
示例3: 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;
}