本文整理汇总了C++中ConVar::Revert方法的典型用法代码示例。如果您正苦于以下问题:C++ ConVar::Revert方法的具体用法?C++ ConVar::Revert怎么用?C++ ConVar::Revert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConVar
的用法示例。
在下文中一共展示了ConVar::Revert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sm_ResetConVar
static cell_t sm_ResetConVar(IPluginContext *pContext, const cell_t *params)
{
Handle_t hndl = static_cast<Handle_t>(params[1]);
HandleError err;
ConVar *pConVar;
if ((err=g_ConVarManager.ReadConVarHandle(hndl, &pConVar))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
}
pConVar->Revert();
#if SOURCE_ENGINE < SE_ORANGEBOX
/* Should we replicate it? */
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
{
ReplicateConVar(pConVar);
}
/* Should we notify clients? */
if (params[4] && IsFlagSet(pConVar, FCVAR_NOTIFY))
{
NotifyConVar(pConVar);
}
#endif
return 1;
}
示例2: RevertAll
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void ConVar::RevertAll( void )
{
ConCommandBase *p = s_pConCommandBases;
while ( p )
{
if ( !p->IsCommand() )
{
ConVar *var = ( ConVar * )p;
var->Revert();
}
p = p->m_pNext;
}
}
示例3: OnTick
void CVersionWarnPanel::OnTick()
{
BaseClass::OnTick();
if (Q_strcmp(cl_showversionwarnpanel.GetString(), cl_showversionwarnpanel.GetDefault()) != 0)
{
SetVisible(true);
HFont m_hfReleaseFont = m_pReleaseText->GetFont();
char m_cReleaseText[225];
m_pReleaseText->GetText(m_cReleaseText, sizeof(m_cReleaseText));
char m_cReleaseF[225];
Q_snprintf(m_cReleaseF, 225, m_cReleaseText, MOM_CURRENT_VERSION, cl_showversionwarnpanel.GetString());
cl_showversionwarnpanel.Revert();
m_pReleaseText->SetText(m_cReleaseF);
m_pReleaseText->SetURL("https://github.com/momentum-mod/game/releases");
SetSize(UTIL_ComputeStringWidth(m_hfReleaseFont, m_cReleaseF) + m_pReleaseText->GetXPos() * 2, GetTall());
m_pReleaseText->SetPos(m_pReleaseText->GetXPos(), GetTall() / 2);
}
}
示例4: RevertFlaggedCvars
void ConCommandBase::RevertFlaggedCvars( int flag )
{
for (const ConCommandBase *var= GetCommands() ; var ; var=var->GetNext())
{
if ( var->IsCommand() )
continue;
ConVar *cvar = ( ConVar * )var;
if ( !cvar->IsBitSet( flag ) )
continue;
// It's == to the default value, don't count
if ( !Q_strcasecmp( cvar->GetDefault(), cvar->GetString() ) )
continue;
cvar->Revert();
// DevMsg( "%s = \"%s\" (reverted)\n", cvar->GetName(), cvar->GetString() );
}
}
示例5: OnRootConsoleCommand
void ConVarManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs *command)
{
int argcount = command->ArgC();
if (argcount >= 3)
{
bool wantReset = false;
/* Get plugin index that was passed */
const char *arg = command->Arg(2);
if (argcount >= 4 && strcmp(arg, "reset") == 0)
{
wantReset = true;
arg = command->Arg(3);
}
/* Get plugin object */
IPlugin *plugin = scripts->FindPluginByConsoleArg(arg);
if (!plugin)
{
UTIL_ConsolePrint("[SM] Plugin \"%s\" was not found.", arg);
return;
}
/* Get plugin name */
const sm_plugininfo_t *plinfo = plugin->GetPublicInfo();
const char *plname = IS_STR_FILLED(plinfo->name) ? plinfo->name : plugin->GetFilename();
ConVarList *pConVarList;
ConVarList::iterator iter;
/* If no convar list... */
if (!plugin->GetProperty("ConVarList", (void **)&pConVarList))
{
UTIL_ConsolePrint("[SM] No convars found for: %s", plname);
return;
}
if (!wantReset)
{
UTIL_ConsolePrint("[SM] Listing %d convars for: %s", pConVarList->size(), plname);
UTIL_ConsolePrint(" %-32.31s %s", "[Name]", "[Value]");
}
/* Iterate convar list and display/reset each one */
for (iter = pConVarList->begin(); iter != pConVarList->end(); iter++)
{
/*const */ConVar *pConVar = const_cast<ConVar *>(*iter);
if (!wantReset)
{
UTIL_ConsolePrint(" %-32.31s %s", pConVar->GetName(), pConVar->GetString());
} else {
pConVar->Revert();
}
}
if (wantReset)
{
UTIL_ConsolePrint("[SM] Reset %d convars for: %s", pConVarList->size(), plname);
}
return;
}
/* Display usage of subcommand */
UTIL_ConsolePrint("[SM] Usage: sm cvars [reset] <plugin #>");
}