mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-20 12:36:05 +08:00
Added most recent version of unmodified HL2 SDK for Episode 1 engine
This commit is contained in:
43
utils/serverplugin_sample/serverplugin_convar.cpp
Normal file
43
utils/serverplugin_sample/serverplugin_convar.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#include "icvar.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
static ICvar *s_pCVar;
|
||||
|
||||
class CPluginConVarAccessor : public IConCommandBaseAccessor
|
||||
{
|
||||
public:
|
||||
virtual bool RegisterConCommandBase( ConCommandBase *pCommand )
|
||||
{
|
||||
pCommand->AddFlags( FCVAR_PLUGIN );
|
||||
|
||||
// Unlink from plugin only list
|
||||
pCommand->SetNext( 0 );
|
||||
|
||||
// Link to engine's list instead
|
||||
s_pCVar->RegisterConCommandBase( pCommand );
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPluginConVarAccessor g_ConVarAccessor;
|
||||
|
||||
void InitCVars( CreateInterfaceFn cvarFactory )
|
||||
{
|
||||
s_pCVar = (ICvar*)cvarFactory( VENGINE_CVAR_INTERFACE_VERSION, NULL );
|
||||
if ( s_pCVar )
|
||||
{
|
||||
ConCommandBaseMgr::OneTimeInit( &g_ConVarAccessor );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user