Renamed CConVarManager to ConVarManager
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40586
This commit is contained in:
parent
70ec3db66c
commit
c256741488
@ -11,7 +11,7 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CConVarManager.h"
|
#include "ConVarManager.h"
|
||||||
#include "PluginSys.h"
|
#include "PluginSys.h"
|
||||||
#include "ForwardSys.h"
|
#include "ForwardSys.h"
|
||||||
#include "HandleSys.h"
|
#include "HandleSys.h"
|
||||||
@ -19,31 +19,31 @@
|
|||||||
#include "sm_stringutil.h"
|
#include "sm_stringutil.h"
|
||||||
#include <sh_vector.h>
|
#include <sh_vector.h>
|
||||||
|
|
||||||
CConVarManager g_ConVarManager;
|
ConVarManager g_ConVarManager;
|
||||||
|
|
||||||
CConVarManager::CConVarManager() : m_ConVarType(0)
|
ConVarManager::ConVarManager() : m_ConVarType(0)
|
||||||
{
|
{
|
||||||
// Create a convar lookup trie
|
// Create a convar lookup trie
|
||||||
m_ConVarCache = sm_trie_create();
|
m_ConVarCache = sm_trie_create();
|
||||||
}
|
}
|
||||||
|
|
||||||
CConVarManager::~CConVarManager()
|
ConVarManager::~ConVarManager()
|
||||||
{
|
{
|
||||||
List<ConVarInfo *>::iterator i;
|
List<ConVarInfo *>::iterator iter;
|
||||||
|
|
||||||
// Destroy our convar lookup trie
|
// Destroy our convar lookup trie
|
||||||
sm_trie_destroy(m_ConVarCache);
|
sm_trie_destroy(m_ConVarCache);
|
||||||
|
|
||||||
// Destroy all the ConVarInfo structures
|
// Destroy all the ConVarInfo structures
|
||||||
for (i = m_ConVars.begin(); i != m_ConVars.end(); i++)
|
for (iter = m_ConVars.begin(); iter != m_ConVars.end(); iter++)
|
||||||
{
|
{
|
||||||
delete (*i);
|
delete (*iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ConVars.clear();
|
m_ConVars.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConVarManager::OnSourceModAllInitialized()
|
void ConVarManager::OnSourceModAllInitialized()
|
||||||
{
|
{
|
||||||
HandleAccess sec;
|
HandleAccess sec;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ void CConVarManager::OnSourceModAllInitialized()
|
|||||||
g_RootMenu.AddRootConsoleCommand("convars", "View convars created by a plugin", this);
|
g_RootMenu.AddRootConsoleCommand("convars", "View convars created by a plugin", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConVarManager::OnSourceModShutdown()
|
void ConVarManager::OnSourceModShutdown()
|
||||||
{
|
{
|
||||||
IChangeableForward *fwd;
|
IChangeableForward *fwd;
|
||||||
List<ConVarInfo *>::iterator i;
|
List<ConVarInfo *>::iterator i;
|
||||||
@ -83,7 +83,7 @@ void CConVarManager::OnSourceModShutdown()
|
|||||||
g_HandleSys.RemoveType(m_ConVarType, g_pCoreIdent);
|
g_HandleSys.RemoveType(m_ConVarType, g_pCoreIdent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConVarManager::OnPluginDestroyed(IPlugin *plugin)
|
void ConVarManager::OnPluginDestroyed(IPlugin *plugin)
|
||||||
{
|
{
|
||||||
CVector<ConVar *> *cvarList;
|
CVector<ConVar *> *cvarList;
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ void CConVarManager::OnPluginDestroyed(IPlugin *plugin)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConVarManager::OnHandleDestroy(HandleType_t type, void *object)
|
void ConVarManager::OnHandleDestroy(HandleType_t type, void *object)
|
||||||
{
|
{
|
||||||
ConVarInfo *info;
|
ConVarInfo *info;
|
||||||
ConVar *pConVar = static_cast<ConVar *>(object);
|
ConVar *pConVar = static_cast<ConVar *>(object);
|
||||||
@ -115,7 +115,7 @@ void CConVarManager::OnHandleDestroy(HandleType_t type, void *object)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConVarManager::OnRootConsoleCommand(const char *command, unsigned int argcount)
|
void ConVarManager::OnRootConsoleCommand(const char *command, unsigned int argcount)
|
||||||
{
|
{
|
||||||
if (argcount >= 3)
|
if (argcount >= 3)
|
||||||
{
|
{
|
||||||
@ -162,7 +162,7 @@ void CConVarManager::OnRootConsoleCommand(const char *command, unsigned int argc
|
|||||||
g_RootMenu.ConsolePrint("[SM] Usage: sm convars <plugin #>");
|
g_RootMenu.ConsolePrint("[SM] Usage: sm convars <plugin #>");
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle_t CConVarManager::CreateConVar(IPluginContext *pContext, const char *name, const char *defaultVal, const char *helpText, int flags, bool hasMin, float min, bool hasMax, float max)
|
Handle_t ConVarManager::CreateConVar(IPluginContext *pContext, const char *name, const char *defaultVal, const char *helpText, int flags, bool hasMin, float min, bool hasMax, float max)
|
||||||
{
|
{
|
||||||
ConVar *pConVar = NULL;
|
ConVar *pConVar = NULL;
|
||||||
ConVarInfo *info = NULL;
|
ConVarInfo *info = NULL;
|
||||||
@ -246,7 +246,7 @@ Handle_t CConVarManager::CreateConVar(IPluginContext *pContext, const char *name
|
|||||||
return hndl;
|
return hndl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle_t CConVarManager::FindConVar(const char *name)
|
Handle_t ConVarManager::FindConVar(const char *name)
|
||||||
{
|
{
|
||||||
ConVar *pConVar = NULL;
|
ConVar *pConVar = NULL;
|
||||||
ConVarInfo *info = NULL;
|
ConVarInfo *info = NULL;
|
||||||
@ -285,7 +285,7 @@ Handle_t CConVarManager::FindConVar(const char *name)
|
|||||||
return hndl;
|
return hndl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConVarManager::HookConVarChange(IPluginContext *pContext, ConVar *pConVar, funcid_t funcid)
|
void ConVarManager::HookConVarChange(IPluginContext *pContext, ConVar *pConVar, funcid_t funcid)
|
||||||
{
|
{
|
||||||
IPluginFunction *func = pContext->GetFunctionById(funcid);
|
IPluginFunction *func = pContext->GetFunctionById(funcid);
|
||||||
IChangeableForward *fwd = NULL;
|
IChangeableForward *fwd = NULL;
|
||||||
@ -329,7 +329,7 @@ void CConVarManager::HookConVarChange(IPluginContext *pContext, ConVar *pConVar,
|
|||||||
fwd->AddFunction(func);
|
fwd->AddFunction(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConVarManager::UnhookConVarChange(IPluginContext *pContext, ConVar *pConVar, funcid_t funcid)
|
void ConVarManager::UnhookConVarChange(IPluginContext *pContext, ConVar *pConVar, funcid_t funcid)
|
||||||
{
|
{
|
||||||
IPluginFunction *func = pContext->GetFunctionById(funcid);
|
IPluginFunction *func = pContext->GetFunctionById(funcid);
|
||||||
IChangeableForward *fwd = NULL;
|
IChangeableForward *fwd = NULL;
|
||||||
@ -375,7 +375,7 @@ void CConVarManager::UnhookConVarChange(IPluginContext *pContext, ConVar *pConVa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue)
|
void ConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue)
|
||||||
{
|
{
|
||||||
// If the values are the same...
|
// If the values are the same...
|
||||||
if (strcmp(pConVar->GetString(), oldValue) == 0)
|
if (strcmp(pConVar->GetString(), oldValue) == 0)
|
@ -11,8 +11,8 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _INCLUDE_SOURCEMOD_CCONVARMANAGER_H_
|
#ifndef _INCLUDE_SOURCEMOD_CONVARMANAGER_H_
|
||||||
#define _INCLUDE_SOURCEMOD_CCONVARMANAGER_H_
|
#define _INCLUDE_SOURCEMOD_CONVARMANAGER_H_
|
||||||
|
|
||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include "sourcemm_api.h"
|
#include "sourcemm_api.h"
|
||||||
@ -36,15 +36,15 @@ struct ConVarInfo
|
|||||||
FnChangeCallback origCallback; /**< The original callback function */
|
FnChangeCallback origCallback; /**< The original callback function */
|
||||||
};
|
};
|
||||||
|
|
||||||
class CConVarManager :
|
class ConVarManager :
|
||||||
public SMGlobalClass,
|
public SMGlobalClass,
|
||||||
public IHandleTypeDispatch,
|
public IHandleTypeDispatch,
|
||||||
public IPluginsListener,
|
public IPluginsListener,
|
||||||
public IRootConsoleCommand
|
public IRootConsoleCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CConVarManager();
|
ConVarManager();
|
||||||
~CConVarManager();
|
~ConVarManager();
|
||||||
public: // SMGlobalClass
|
public: // SMGlobalClass
|
||||||
void OnSourceModAllInitialized();
|
void OnSourceModAllInitialized();
|
||||||
void OnSourceModShutdown();
|
void OnSourceModShutdown();
|
||||||
@ -102,7 +102,7 @@ private:
|
|||||||
Trie *m_ConVarCache;
|
Trie *m_ConVarCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CConVarManager g_ConVarManager;
|
extern ConVarManager g_ConVarManager;
|
||||||
|
|
||||||
#endif // _INCLUDE_SOURCEMOD_CCONVARMANAGER_H_
|
#endif // _INCLUDE_SOURCEMOD_CONVARMANAGER_H_
|
||||||
|
|
@ -183,10 +183,6 @@
|
|||||||
RelativePath="..\AdminCache.cpp"
|
RelativePath="..\AdminCache.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\CConVarManager.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\CDataPack.cpp"
|
RelativePath="..\CDataPack.cpp"
|
||||||
>
|
>
|
||||||
@ -211,6 +207,10 @@
|
|||||||
RelativePath="..\ConCmdManager.cpp"
|
RelativePath="..\ConCmdManager.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\ConVarManager.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\CPlayerManager.cpp"
|
RelativePath="..\CPlayerManager.cpp"
|
||||||
>
|
>
|
||||||
@ -269,10 +269,6 @@
|
|||||||
RelativePath="..\AdminCache.h"
|
RelativePath="..\AdminCache.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\CConVarManager.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\CDataPack.h"
|
RelativePath="..\CDataPack.h"
|
||||||
>
|
>
|
||||||
@ -305,6 +301,10 @@
|
|||||||
RelativePath="..\ConCmdManager.h"
|
RelativePath="..\ConCmdManager.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\ConVarManager.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\CPlayerManager.h"
|
RelativePath="..\CPlayerManager.h"
|
||||||
>
|
>
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include "sourcemm_api.h"
|
#include "sourcemm_api.h"
|
||||||
#include "HandleSys.h"
|
#include "HandleSys.h"
|
||||||
#include "CConVarManager.h"
|
#include "ConVarManager.h"
|
||||||
#include "ConCmdManager.h"
|
#include "ConCmdManager.h"
|
||||||
#include "PluginSys.h"
|
#include "PluginSys.h"
|
||||||
#include "sm_stringutil.h"
|
#include "sm_stringutil.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user