refactored singleton class names

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40622
This commit is contained in:
David Anderson 2007-03-15 04:45:17 +00:00
parent 043b8f255f
commit 2c70ec1a8c
16 changed files with 157 additions and 157 deletions

View File

@ -15,14 +15,14 @@
#include "Logger.h"
#include "PluginSys.h"
CDbgReporter g_DbgReporter;
DebugReport g_DbgReporter;
void CDbgReporter::OnSourceModAllInitialized()
void DebugReport::OnSourceModAllInitialized()
{
g_pSourcePawn->SetDebugListener(this);
}
void CDbgReporter::OnContextExecuteError(IPluginContext *ctx, IContextTrace *error)
void DebugReport::OnContextExecuteError(IPluginContext *ctx, IContextTrace *error)
{
const char *lastname;
const char *plname = g_PluginSys.FindPluginByContext(ctx->GetContext())->GetFilename();
@ -68,7 +68,7 @@ void CDbgReporter::OnContextExecuteError(IPluginContext *ctx, IContextTrace *err
}
}
int CDbgReporter::_GetPluginIndex(IPluginContext *ctx)
int DebugReport::_GetPluginIndex(IPluginContext *ctx)
{
int id = 1;
IPluginIterator *iter = g_PluginSys.GetPluginIterator();

View File

@ -17,7 +17,7 @@
#include "sp_vm_api.h"
#include "sm_globals.h"
class CDbgReporter :
class DebugReport :
public SMGlobalClass,
public IDebugListener
{
@ -29,7 +29,7 @@ private:
int _GetPluginIndex(IPluginContext *ctx);
};
extern CDbgReporter g_DbgReporter;
extern DebugReport g_DbgReporter;
#endif // _INCLUDE_SOURCEMOD_CDBGREPORTER_H_

View File

@ -22,7 +22,7 @@
#include "Logger.h"
#include "ShareSys.h"
CGameConfigManager g_GameConfigs;
GameConfigManager g_GameConfigs;
IGameConfig *g_pGameConf = NULL;
char g_mod[255];
@ -285,17 +285,17 @@ unsigned int CGameConfig::DecRefCount()
return m_RefCount;
}
CGameConfigManager::CGameConfigManager()
GameConfigManager::GameConfigManager()
{
m_pLookup = sm_trie_create();
}
CGameConfigManager::~CGameConfigManager()
GameConfigManager::~GameConfigManager()
{
sm_trie_destroy(m_pLookup);
}
void CGameConfigManager::OnSourceModStartup(bool late)
void GameConfigManager::OnSourceModStartup(bool late)
{
LoadGameConfigFile("core.games", &g_pGameConf, NULL, 0);
@ -323,7 +323,7 @@ void CGameConfigManager::OnSourceModStartup(bool late)
}
}
void CGameConfigManager::OnSourceModAllInitialized()
void GameConfigManager::OnSourceModAllInitialized()
{
/* NOW initialize the game file */
CGameConfig *pGameConf = (CGameConfig *)g_pGameConf;
@ -337,12 +337,12 @@ void CGameConfigManager::OnSourceModAllInitialized()
g_ShareSys.AddInterface(NULL, this);
}
void CGameConfigManager::OnSourceModAllShutdown()
void GameConfigManager::OnSourceModAllShutdown()
{
CloseGameConfigFile(g_pGameConf);
}
bool CGameConfigManager::LoadGameConfigFile(const char *file, IGameConfig **_pConfig, char *error, size_t maxlength)
bool GameConfigManager::LoadGameConfigFile(const char *file, IGameConfig **_pConfig, char *error, size_t maxlength)
{
CGameConfig *pConfig;
@ -372,7 +372,7 @@ bool CGameConfigManager::LoadGameConfigFile(const char *file, IGameConfig **_pCo
return retval;
}
void CGameConfigManager::CloseGameConfigFile(IGameConfig *cfg)
void GameConfigManager::CloseGameConfigFile(IGameConfig *cfg)
{
CGameConfig *pConfig = (CGameConfig *)cfg;

View File

@ -63,13 +63,13 @@ private:
char m_mod[255];
};
class CGameConfigManager :
class GameConfigManager :
public IGameConfigManager,
public SMGlobalClass
{
public:
CGameConfigManager();
~CGameConfigManager();
GameConfigManager();
~GameConfigManager();
public: //IGameConfigManager
bool LoadGameConfigFile(const char *file, IGameConfig **pConfig, char *error, size_t maxlength);
void CloseGameConfigFile(IGameConfig *cfg);
@ -82,7 +82,7 @@ private:
Trie *m_pLookup;
};
extern CGameConfigManager g_GameConfigs;
extern GameConfigManager g_GameConfigs;
extern IGameConfig *g_pGameConf;
#endif //_INCLUDE_SOURCEMOD_CGAMECONFIGS_H_

View File

@ -18,24 +18,24 @@
#include "systems/LibrarySys.h"
#include "sm_version.h"
CLogger g_Logger;
Logger g_Logger;
/**
* :TODO: This should be creating the log folder if it doesn't exist
*/
void CLogger::OnSourceModStartup(bool late)
void Logger::OnSourceModStartup(bool late)
{
//:TODO: read these options from a file, dont hardcode them
InitLogger(LoggingMode_Daily, true);
}
void CLogger::OnSourceModAllShutdown()
void Logger::OnSourceModAllShutdown()
{
CloseLogger();
}
void CLogger::_NewMapFile()
void Logger::_NewMapFile()
{
if (!m_Active)
{
@ -76,7 +76,7 @@ void CLogger::_NewMapFile()
}
}
void CLogger::_CloseFile()
void Logger::_CloseFile()
{
if (!m_Active)
{
@ -110,7 +110,7 @@ void CLogger::_CloseFile()
m_ErrFileName.clear();
}
void CLogger::InitLogger(LoggingMode mode, bool startlogging)
void Logger::InitLogger(LoggingMode mode, bool startlogging)
{
m_mode = mode;
m_Active = startlogging;
@ -149,12 +149,12 @@ void CLogger::InitLogger(LoggingMode mode, bool startlogging)
}
}
void CLogger::CloseLogger()
void Logger::CloseLogger()
{
_CloseFile();
}
void CLogger::LogMessage(const char *vafmt, ...)
void Logger::LogMessage(const char *vafmt, ...)
{
if (!m_Active)
{
@ -233,7 +233,7 @@ print_error:
m_Active = false;
}
void CLogger::LogError(const char *vafmt, ...)
void Logger::LogError(const char *vafmt, ...)
{
if (!m_Active)
{
@ -282,7 +282,7 @@ void CLogger::LogError(const char *vafmt, ...)
g_SMAPI->ConPrintf("L %s: %s\n", date, msg);
}
void CLogger::MapChange(const char *mapname)
void Logger::MapChange(const char *mapname)
{
m_CurMapName.assign(mapname);
@ -312,7 +312,7 @@ void CLogger::MapChange(const char *mapname)
m_ErrMapStart = false;
}
void CLogger::_PrintToHL2Log(const char *fmt, va_list ap)
void Logger::_PrintToHL2Log(const char *fmt, va_list ap)
{
char msg[3072];
size_t len;
@ -326,7 +326,7 @@ void CLogger::_PrintToHL2Log(const char *fmt, va_list ap)
engine->LogPrint(msg);
}
const char *CLogger::GetLogFileName(LogType type) const
const char *Logger::GetLogFileName(LogType type) const
{
switch (type)
{
@ -345,12 +345,12 @@ const char *CLogger::GetLogFileName(LogType type) const
}
}
LoggingMode CLogger::GetLoggingMode() const
LoggingMode Logger::GetLoggingMode() const
{
return m_mode;
}
void CLogger::EnableLogging()
void Logger::EnableLogging()
{
if (m_Active)
{
@ -360,7 +360,7 @@ void CLogger::EnableLogging()
LogMessage("Logging enabled manually by user.");
}
void CLogger::DisableLogging()
void Logger::DisableLogging()
{
if (!m_Active)
{

View File

@ -32,10 +32,10 @@ enum LoggingMode
LoggingMode_HL2
};
class CLogger : public SMGlobalClass
class Logger : public SMGlobalClass
{
public:
CLogger() : m_ErrMapStart(false), m_Active(false), m_DelayedStart(false), m_DailyPrintHdr(false) {}
Logger() : m_ErrMapStart(false), m_Active(false), m_DelayedStart(false), m_DailyPrintHdr(false) {}
public: //SMGlobalClass
void OnSourceModStartup(bool late);
void OnSourceModAllShutdown();
@ -65,6 +65,6 @@ private:
bool m_DailyPrintHdr;
};
extern CLogger g_Logger;
extern Logger g_Logger;
#endif // _INCLUDE_SOURCEMOD_CLOGGER_H_

View File

@ -17,7 +17,7 @@
#include "AdminCache.h"
#include "ConCmdManager.h"
CPlayerManager g_Players;
PlayerManager g_Players;
SH_DECL_HOOK5(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, edict_t *, const char *, const char *, char *, int);
SH_DECL_HOOK2_void(IServerGameClients, ClientPutInServer, SH_NOATTRIB, 0, edict_t *, const char *);
@ -26,27 +26,27 @@ SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *)
SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, edict_t *);
SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, int, int);
CPlayerManager::CPlayerManager()
PlayerManager::PlayerManager()
{
m_AuthQueue = NULL;
m_FirstPass = true;
}
CPlayerManager::~CPlayerManager()
PlayerManager::~PlayerManager()
{
delete [] m_AuthQueue;
}
void CPlayerManager::OnSourceModAllInitialized()
void PlayerManager::OnSourceModAllInitialized()
{
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientConnect, serverClients, this, &CPlayerManager::OnClientConnect, false);
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientConnect, serverClients, this, &CPlayerManager::OnClientConnect_Post, true);
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientPutInServer, serverClients, this, &CPlayerManager::OnClientPutInServer, true);
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverClients, this, &CPlayerManager::OnClientDisconnect, false);
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverClients, this, &CPlayerManager::OnClientDisconnect_Post, true);
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientCommand, serverClients, this, &CPlayerManager::OnClientCommand, false);
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientSettingsChanged, serverClients, this, &CPlayerManager::OnClientSettingsChanged, true);
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, ServerActivate, gamedll, this, &CPlayerManager::OnServerActivate, true);
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientConnect, serverClients, this, &PlayerManager::OnClientConnect, false);
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientConnect, serverClients, this, &PlayerManager::OnClientConnect_Post, true);
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientPutInServer, serverClients, this, &PlayerManager::OnClientPutInServer, true);
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverClients, this, &PlayerManager::OnClientDisconnect, false);
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverClients, this, &PlayerManager::OnClientDisconnect_Post, true);
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientCommand, serverClients, this, &PlayerManager::OnClientCommand, false);
SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientSettingsChanged, serverClients, this, &PlayerManager::OnClientSettingsChanged, true);
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, ServerActivate, gamedll, this, &PlayerManager::OnServerActivate, true);
g_ShareSys.AddInterface(NULL, this);
@ -62,15 +62,15 @@ void CPlayerManager::OnSourceModAllInitialized()
m_clauth = g_Forwards.CreateForward("OnClientAuthorized", ET_Ignore, 2, NULL, Param_Cell, Param_String);
}
void CPlayerManager::OnSourceModShutdown()
void PlayerManager::OnSourceModShutdown()
{
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientConnect, serverClients, this, &CPlayerManager::OnClientConnect, false);
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientPutInServer, serverClients, this, &CPlayerManager::OnClientPutInServer, true);
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverClients, this, &CPlayerManager::OnClientDisconnect, false);
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverClients, this, &CPlayerManager::OnClientDisconnect_Post, true);
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientCommand, serverClients, this, &CPlayerManager::OnClientCommand, false);
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientSettingsChanged, serverClients, this, &CPlayerManager::OnClientSettingsChanged, true);
SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, ServerActivate, gamedll, this, &CPlayerManager::OnServerActivate, true);
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientConnect, serverClients, this, &PlayerManager::OnClientConnect, false);
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientPutInServer, serverClients, this, &PlayerManager::OnClientPutInServer, true);
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverClients, this, &PlayerManager::OnClientDisconnect, false);
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverClients, this, &PlayerManager::OnClientDisconnect_Post, true);
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientCommand, serverClients, this, &PlayerManager::OnClientCommand, false);
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientSettingsChanged, serverClients, this, &PlayerManager::OnClientSettingsChanged, true);
SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, ServerActivate, gamedll, this, &PlayerManager::OnServerActivate, true);
/* Release forwards */
g_Forwards.ReleaseForward(m_clconnect);
@ -84,7 +84,7 @@ void CPlayerManager::OnSourceModShutdown()
delete [] m_Players;
}
void CPlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
{
if (m_FirstPass)
{
@ -99,7 +99,7 @@ void CPlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int c
}
}
void CPlayerManager::RunAuthChecks()
void PlayerManager::RunAuthChecks()
{
CPlayer *pPlayer;
const char *authstr;
@ -168,7 +168,7 @@ void CPlayerManager::RunAuthChecks()
}
}
bool CPlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
{
int client = engine->IndexOfEdict(pEntity);
@ -202,7 +202,7 @@ bool CPlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, cons
return true;
}
bool CPlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
{
int client = engine->IndexOfEdict(pEntity);
bool orig_value = META_RESULT_ORIG_RET(bool);
@ -220,7 +220,7 @@ bool CPlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
return true;
}
void CPlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername)
void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername)
{
cell_t res;
int client = engine->IndexOfEdict(pEntity);
@ -258,7 +258,7 @@ void CPlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playernam
m_clputinserver->Execute(&res, NULL);
}
void CPlayerManager::OnClientDisconnect(edict_t *pEntity)
void PlayerManager::OnClientDisconnect(edict_t *pEntity)
{
cell_t res;
int client = engine->IndexOfEdict(pEntity);
@ -306,7 +306,7 @@ void CPlayerManager::OnClientDisconnect(edict_t *pEntity)
m_Players[client].Disconnect();
}
void CPlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
{
cell_t res;
int client = engine->IndexOfEdict(pEntity);
@ -323,7 +323,7 @@ void CPlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
}
}
void CPlayerManager::OnClientCommand(edict_t *pEntity)
void PlayerManager::OnClientCommand(edict_t *pEntity)
{
cell_t res = Pl_Continue;
int client = engine->IndexOfEdict(pEntity);
@ -347,7 +347,7 @@ void CPlayerManager::OnClientCommand(edict_t *pEntity)
}
}
void CPlayerManager::OnClientSettingsChanged(edict_t *pEntity)
void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
{
cell_t res;
int client = engine->IndexOfEdict(pEntity);
@ -357,12 +357,12 @@ void CPlayerManager::OnClientSettingsChanged(edict_t *pEntity)
m_Players[client].SetName(engine->GetClientConVarValue(client, "name"));
}
int CPlayerManager::GetMaxClients()
int PlayerManager::GetMaxClients()
{
return m_maxClients;
}
CPlayer *CPlayerManager::GetPlayerByIndex(int client) const
CPlayer *PlayerManager::GetPlayerByIndex(int client) const
{
if (client > m_maxClients || client < 1)
{
@ -371,33 +371,33 @@ CPlayer *CPlayerManager::GetPlayerByIndex(int client) const
return &m_Players[client];
}
int CPlayerManager::GetNumPlayers()
int PlayerManager::GetNumPlayers()
{
return m_PlayerCount;
}
void CPlayerManager::AddClientListener(IClientListener *listener)
void PlayerManager::AddClientListener(IClientListener *listener)
{
m_hooks.push_back(listener);
}
void CPlayerManager::RemoveClientListener(IClientListener *listener)
void PlayerManager::RemoveClientListener(IClientListener *listener)
{
m_hooks.remove(listener);
}
IGamePlayer *CPlayerManager::GetGamePlayer(edict_t *pEdict)
IGamePlayer *PlayerManager::GetGamePlayer(edict_t *pEdict)
{
int index = engine->IndexOfEdict(pEdict);
return GetGamePlayer(index);
}
IGamePlayer *CPlayerManager::GetGamePlayer(int client)
IGamePlayer *PlayerManager::GetGamePlayer(int client)
{
return GetPlayerByIndex(client);
}
void CPlayerManager::ClearAdminId(AdminId id)
void PlayerManager::ClearAdminId(AdminId id)
{
for (int i=1; i<=m_maxClients; i++)
{
@ -408,7 +408,7 @@ void CPlayerManager::ClearAdminId(AdminId id)
}
}
void CPlayerManager::ClearAllAdmins()
void PlayerManager::ClearAllAdmins()
{
for (int i=1; i<=m_maxClients; i++)
{

View File

@ -28,7 +28,7 @@ using namespace SourceHook;
class CPlayer : public IGamePlayer
{
friend class CPlayerManager;
friend class PlayerManager;
public:
CPlayer();
public:
@ -61,13 +61,13 @@ private:
edict_t *m_pEdict;
};
class CPlayerManager :
class PlayerManager :
public SMGlobalClass,
public IPlayerManager
{
public:
CPlayerManager();
~CPlayerManager();
PlayerManager();
~PlayerManager();
public: //SMGlobalClass
void OnSourceModAllInitialized();
void OnSourceModShutdown();
@ -118,6 +118,6 @@ private:
unsigned int *m_AuthQueue;
};
extern CPlayerManager g_Players;
extern PlayerManager g_Players;
#endif //_INCLUDE_SOURCEMOD_CPLAYERMANAGER_H_

View File

@ -20,12 +20,12 @@
#include "TextParsers.h"
#include "ShareSys.h"
CTextParsers g_TextParser;
TextParsers g_TextParser;
static int g_ini_chartable1[255] = {0};
static int g_ws_chartable[255] = {0};
CTextParsers::CTextParsers()
TextParsers::TextParsers()
{
g_ini_chartable1[(unsigned)'_'] = 1;
g_ini_chartable1[(unsigned)'-'] = 1;
@ -43,12 +43,12 @@ CTextParsers::CTextParsers()
g_ws_chartable[(unsigned)' '] = 1;
}
void CTextParsers::OnSourceModAllInitialized()
void TextParsers::OnSourceModAllInitialized()
{
g_ShareSys.AddInterface(NULL, this);
}
unsigned int CTextParsers::GetUTF8CharBytes(const char *stream)
unsigned int TextParsers::GetUTF8CharBytes(const char *stream)
{
return _GetUTF8CharBytes(stream);
}
@ -83,7 +83,7 @@ bool CharStreamReader(void *stream, char *buffer, size_t maxlength, unsigned int
return true;
}
SMCParseError CTextParsers::ParseString_SMC(const char *stream,
SMCParseError TextParsers::ParseString_SMC(const char *stream,
ITextListener_SMC *smc,
unsigned int *line,
unsigned int *col)
@ -111,7 +111,7 @@ bool FileStreamReader(void *stream, char *buffer, size_t maxlength, unsigned int
return (ferror((FILE *)stream) == 0);
}
SMCParseError CTextParsers::ParseFile_SMC(const char *file, ITextListener_SMC *smc, unsigned int *line, unsigned int *col)
SMCParseError TextParsers::ParseFile_SMC(const char *file, ITextListener_SMC *smc, unsigned int *line, unsigned int *col)
{
FILE *fp = fopen(file, "rt");
@ -220,7 +220,7 @@ char *lowstring(StringInfo info[3])
return NULL;
}
SMCParseError CTextParsers::ParseStream_SMC(void *stream,
SMCParseError TextParsers::ParseStream_SMC(void *stream,
STREAMREADER srdr,
ITextListener_SMC *smc,
unsigned int *line,
@ -620,7 +620,7 @@ failed:
* INI parser
*/
bool CTextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listener, unsigned int *line, unsigned int *col)
bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listener, unsigned int *line, unsigned int *col)
{
FILE *fp = fopen(file, "rt");
unsigned int curline = 0;
@ -918,7 +918,7 @@ event_failed:
return false;
}
const char *CTextParsers::GetSMCErrorString(SMCParseError err)
const char *TextParsers::GetSMCErrorString(SMCParseError err)
{
static const char *s_errors[] =
{

View File

@ -46,12 +46,12 @@ inline unsigned int _GetUTF8CharBytes(const char *stream)
*/
typedef bool (*STREAMREADER)(void *, char *, size_t, unsigned int *);
class CTextParsers :
class TextParsers :
public ITextParsers,
public SMGlobalClass
{
public:
CTextParsers();
TextParsers();
public: //SMGlobalClass
void OnSourceModAllInitialized();
public:
@ -81,6 +81,6 @@ private:
};
extern CTextParsers g_TextParser;
extern TextParsers g_TextParser;
#endif //_INCLUDE_SOURCEMOD_TEXTPARSERS_H_

View File

@ -14,7 +14,7 @@
#include "TimerSys.h"
CTimerSystem g_Timers;
TimerSystem g_Timers;
void ITimer::Initialize(ITimedEvent *pCallbacks, float fInterval, float fToExec, void *pData, int flags)
{
@ -27,12 +27,12 @@ void ITimer::Initialize(ITimedEvent *pCallbacks, float fInterval, float fToExec,
m_KillMe = false;
}
void CTimerSystem::OnSourceModAllInitialized()
void TimerSystem::OnSourceModAllInitialized()
{
g_ShareSys.AddInterface(NULL, this);
}
void CTimerSystem::RunFrame()
void TimerSystem::RunFrame()
{
ITimer *pTimer;
TimerIter iter;
@ -76,7 +76,7 @@ void CTimerSystem::RunFrame()
m_LastExecTime = gpGlobals->curtime;
}
ITimer *CTimerSystem::CreateTimer(ITimedEvent *pCallbacks, float fInterval, void *pData, int flags)
ITimer *TimerSystem::CreateTimer(ITimedEvent *pCallbacks, float fInterval, void *pData, int flags)
{
ITimer *pTimer;
TimerIter iter;
@ -123,7 +123,7 @@ return_timer:
return pTimer;
}
void CTimerSystem::FireTimerOnce(ITimer *pTimer, bool delayExec)
void TimerSystem::FireTimerOnce(ITimer *pTimer, bool delayExec)
{
ResultType res;
@ -156,7 +156,7 @@ void CTimerSystem::FireTimerOnce(ITimer *pTimer, bool delayExec)
}
}
void CTimerSystem::KillTimer(ITimer *pTimer)
void TimerSystem::KillTimer(ITimer *pTimer)
{
TimerList *pList;
@ -180,7 +180,7 @@ void CTimerSystem::KillTimer(ITimer *pTimer)
m_FreeTimers.push(pTimer);
}
void CTimerSystem::MapChange()
void TimerSystem::MapChange()
{
ITimer *pTimer;
TimerIter iter;

View File

@ -40,7 +40,7 @@ public:
bool m_KillMe;
};
class CTimerSystem :
class TimerSystem :
public ITimerSystem,
public SMGlobalClass
{
@ -60,6 +60,6 @@ private:
float m_LastExecTime;
};
extern CTimerSystem g_Timers;
extern TimerSystem g_Timers;
#endif //_INCLUDE_SOURCEMOD_CTIMERSYS_H_

View File

@ -21,7 +21,7 @@
#include "sm_stringutil.h"
#include "sourcemod.h"
CTranslator g_Translator;
Translator g_Translator;
CPhraseFile *g_pCorePhrases = NULL;
struct trans_t
@ -39,7 +39,7 @@ struct phrase_t
unsigned int translations;
};
CPhraseFile::CPhraseFile(CTranslator *pTranslator, const char *file)
CPhraseFile::CPhraseFile(Translator *pTranslator, const char *file)
{
m_pStringTab = pTranslator->GetStringTable();
m_pMemory = m_pStringTab->GetMemTable();
@ -579,13 +579,13 @@ const char *CPhraseFile::GetFilename()
** MAIN TRANSLATOR CODE **
**************************/
CTranslator::CTranslator()
Translator::Translator()
{
m_pStringTab = new BaseStringTable(2048);
m_pLCodeLookup = sm_trie_create();
}
CTranslator::~CTranslator()
Translator::~Translator()
{
for (size_t i=0; i<m_Files.size(); i++)
{
@ -602,14 +602,14 @@ CTranslator::~CTranslator()
delete m_pStringTab;
}
void CTranslator::OnSourceModAllInitialized()
void Translator::OnSourceModAllInitialized()
{
AddLanguage("en", "English");
unsigned int id = FindOrAddPhraseFile("core.cfg");
g_pCorePhrases = GetFileByIndex(id);
}
bool CTranslator::GetLanguageByCode(const char *code, unsigned int *index)
bool Translator::GetLanguageByCode(const char *code, unsigned int *index)
{
void *_index;
@ -626,17 +626,17 @@ bool CTranslator::GetLanguageByCode(const char *code, unsigned int *index)
return true;
}
unsigned int CTranslator::GetLanguageCount()
unsigned int Translator::GetLanguageCount()
{
return (unsigned int)m_Languages.size();
}
BaseStringTable *CTranslator::GetStringTable()
BaseStringTable *Translator::GetStringTable()
{
return m_pStringTab;
}
unsigned int CTranslator::FindOrAddPhraseFile(const char *phrase_file)
unsigned int Translator::FindOrAddPhraseFile(const char *phrase_file)
{
for (size_t i=0; i<m_Files.size(); i++)
{
@ -656,7 +656,7 @@ unsigned int CTranslator::FindOrAddPhraseFile(const char *phrase_file)
return idx;
}
void CTranslator::RebuildLanguageDatabase(const char *lang_header_file)
void Translator::RebuildLanguageDatabase(const char *lang_header_file)
{
/* Erase everything we have */
sm_trie_destroy(m_pLCodeLookup);
@ -695,13 +695,13 @@ void CTranslator::RebuildLanguageDatabase(const char *lang_header_file)
}
}
void CTranslator::ReadSMC_ParseStart()
void Translator::ReadSMC_ParseStart()
{
m_InLanguageSection = false;
m_CustomError.clear();
}
SMCParseResult CTranslator::ReadSMC_NewSection(const char *name, bool opt_quotes)
SMCParseResult Translator::ReadSMC_NewSection(const char *name, bool opt_quotes)
{
if (!m_InLanguageSection)
{
@ -719,14 +719,14 @@ SMCParseResult CTranslator::ReadSMC_NewSection(const char *name, bool opt_quotes
return SMCParse_Continue;
}
SMCParseResult CTranslator::ReadSMC_LeavingSection()
SMCParseResult Translator::ReadSMC_LeavingSection()
{
m_InLanguageSection = false;
return SMCParse_Continue;
}
SMCParseResult CTranslator::ReadSMC_KeyValue(const char *key, const char *value, bool key_quotes, bool value_quotes)
SMCParseResult Translator::ReadSMC_KeyValue(const char *key, const char *value, bool key_quotes, bool value_quotes)
{
size_t len = strlen(key);
@ -741,7 +741,7 @@ SMCParseResult CTranslator::ReadSMC_KeyValue(const char *key, const char *value,
return SMCParse_Continue;
}
bool CTranslator::AddLanguage(const char *langcode, const char *description)
bool Translator::AddLanguage(const char *langcode, const char *description)
{
if (sm_trie_retrieve(m_pLCodeLookup, langcode, NULL))
{
@ -763,7 +763,7 @@ bool CTranslator::AddLanguage(const char *langcode, const char *description)
return true;
}
CPhraseFile *CTranslator::GetFileByIndex(unsigned int index)
CPhraseFile *Translator::GetFileByIndex(unsigned int index)
{
if (index >= m_Files.size())
{
@ -773,7 +773,7 @@ CPhraseFile *CTranslator::GetFileByIndex(unsigned int index)
return m_Files[index];
}
size_t CTranslator::Translate(char *buffer, size_t maxlength, void **params, const Translation *pTrans)
size_t Translator::Translate(char *buffer, size_t maxlength, void **params, const Translation *pTrans)
{
void *new_params[MAX_TRANSLATE_PARAMS];
@ -786,7 +786,7 @@ size_t CTranslator::Translate(char *buffer, size_t maxlength, void **params, con
return gnprintf(buffer, maxlength, pTrans->szPhrase, new_params);
}
TransError CTranslator::CoreTrans(int client,
TransError Translator::CoreTrans(int client,
char *buffer,
size_t maxlength,
const char *phrase,

View File

@ -26,7 +26,7 @@
/* :TODO: write a templatized version of tries? */
using namespace SourceHook;
class CTranslator;
class Translator;
enum PhraseParseState
{
@ -60,7 +60,7 @@ enum TransError
class CPhraseFile : public ITextListener_SMC
{
public:
CPhraseFile(CTranslator *pTranslator, const char *file);
CPhraseFile(Translator *pTranslator, const char *file);
~CPhraseFile();
public:
void ReparseFile();
@ -79,7 +79,7 @@ private:
private:
Trie *m_pPhraseLookup;
String m_File;
CTranslator *m_pTranslator;
Translator *m_pTranslator;
PhraseParseState m_ParseState;
int m_CurPhrase;
BaseMemTable *m_pMemory;
@ -91,13 +91,13 @@ private:
bool m_FileLogged;
};
class CTranslator :
class Translator :
public ITextListener_SMC,
public SMGlobalClass
{
public:
CTranslator();
~CTranslator();
Translator();
~Translator();
public: //SMGlobalClass
void OnSourceModAllInitialized();
public: //ITextListener_SMC
@ -131,6 +131,6 @@ private:
};
extern CPhraseFile *g_pCorePhrases;
extern CTranslator g_Translator;
extern Translator g_Translator;
#endif //_INCLUDE_SOURCEMOD_TRANSLATOR_H_

View File

@ -14,14 +14,14 @@
#include "UserMessages.h"
CUserMessages g_UserMsgs;
UserMessages g_UserMsgs;
SH_DECL_HOOK2(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int);
SH_DECL_HOOK0_void(IVEngineServer, MessageEnd, SH_NOATTRIB, 0);
//:TODO: USE NEW MM IFACE TO SEARCH FOR MESSAGE NAMES ETC! faluco--> i'll do this when i have some spare time
CUserMessages::CUserMessages() : m_InterceptBuffer(m_pBase, 2500)
UserMessages::UserMessages() : m_InterceptBuffer(m_pBase, 2500)
{
m_Names = sm_trie_create();
m_HookCount = 0;
@ -31,29 +31,29 @@ CUserMessages::CUserMessages() : m_InterceptBuffer(m_pBase, 2500)
m_CurId = INVALID_MESSAGE_ID;
}
CUserMessages::~CUserMessages()
UserMessages::~UserMessages()
{
sm_trie_destroy(m_Names);
}
void CUserMessages::OnSourceModAllInitialized()
void UserMessages::OnSourceModAllInitialized()
{
g_ShareSys.AddInterface(NULL, this);
}
void CUserMessages::OnSourceModAllShutdown()
void UserMessages::OnSourceModAllShutdown()
{
if (m_HookCount)
{
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &CUserMessages::OnStartMessage_Pre, false);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &CUserMessages::OnStartMessage_Post, true);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &CUserMessages::OnMessageEnd_Pre, false);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &CUserMessages::OnMessageEnd_Post, true);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Pre, false);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Post, true);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Pre, false);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Post, true);
}
m_HookCount = 0;
}
int CUserMessages::GetMessageIndex(const char *msg)
int UserMessages::GetMessageIndex(const char *msg)
{
int msgid;
if (!sm_trie_retrieve(m_Names, msg, reinterpret_cast<void **>(&msgid)))
@ -78,14 +78,14 @@ int CUserMessages::GetMessageIndex(const char *msg)
return msgid;
}
bool CUserMessages::GetMessageName(int msgid, char *buffer, size_t maxlen) const
bool UserMessages::GetMessageName(int msgid, char *buffer, size_t maxlen) const
{
int dummy;
return gamedll->GetUserMessageInfo(msgid, buffer, maxlen, dummy);
}
bf_write *CUserMessages::StartMessage(int msg_id, cell_t players[], unsigned int playersNum, int flags)
bf_write *UserMessages::StartMessage(int msg_id, cell_t players[], unsigned int playersNum, int flags)
{
bf_write *buffer;
@ -122,7 +122,7 @@ bf_write *CUserMessages::StartMessage(int msg_id, cell_t players[], unsigned int
return buffer;
}
bool CUserMessages::EndMessage()
bool UserMessages::EndMessage()
{
if (!m_InExec)
{
@ -143,7 +143,7 @@ bool CUserMessages::EndMessage()
return true;
}
bool CUserMessages::HookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept)
bool UserMessages::HookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept)
{
if (msg_id < 0 || msg_id >= 255)
{
@ -165,10 +165,10 @@ bool CUserMessages::HookUserMessage(int msg_id, IUserMessageListener *pListener,
if (!m_HookCount++)
{
SH_ADD_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &CUserMessages::OnStartMessage_Pre, false);
SH_ADD_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &CUserMessages::OnStartMessage_Post, true);
SH_ADD_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &CUserMessages::OnMessageEnd_Pre, false);
SH_ADD_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &CUserMessages::OnMessageEnd_Post, true);
SH_ADD_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Pre, false);
SH_ADD_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Post, true);
SH_ADD_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Pre, false);
SH_ADD_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Post, true);
}
if (intercept)
@ -181,7 +181,7 @@ bool CUserMessages::HookUserMessage(int msg_id, IUserMessageListener *pListener,
return true;
}
bool CUserMessages::UnhookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept)
bool UserMessages::UnhookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept)
{
MsgList *pList;
MsgIter iter;
@ -218,18 +218,18 @@ bool CUserMessages::UnhookUserMessage(int msg_id, IUserMessageListener *pListene
return deleted;
}
void CUserMessages::_DecRefCounter()
void UserMessages::_DecRefCounter()
{
if (--m_HookCount == 0)
{
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &CUserMessages::OnStartMessage_Pre, false);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &CUserMessages::OnStartMessage_Post, true);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &CUserMessages::OnMessageEnd_Pre, false);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &CUserMessages::OnMessageEnd_Post, true);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Pre, false);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Post, true);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Pre, false);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Post, true);
}
}
bf_write *CUserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type)
bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type)
{
bool is_intercept_empty = m_msgIntercepts[msg_type].empty();
bool is_hook_empty = m_msgHooks[msg_type].empty();
@ -255,7 +255,7 @@ bf_write *CUserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_ty
RETURN_META_VALUE(MRES_IGNORED, NULL);
}
bf_write *CUserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type)
bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type)
{
if (!m_InHook)
{
@ -267,7 +267,7 @@ bf_write *CUserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_t
RETURN_META_VALUE(MRES_IGNORED, NULL);
}
void CUserMessages::OnMessageEnd_Post()
void UserMessages::OnMessageEnd_Post()
{
if (!m_InHook || m_BlockEndPost)
{
@ -319,7 +319,7 @@ void CUserMessages::OnMessageEnd_Post()
m_InHook = false;
}
void CUserMessages::OnMessageEnd_Pre()
void UserMessages::OnMessageEnd_Pre()
{
if (!m_InHook)
{

View File

@ -36,13 +36,13 @@ struct ListenerInfo
typedef List<ListenerInfo *> MsgList;
typedef List<ListenerInfo *>::iterator MsgIter;
class CUserMessages :
class UserMessages :
public IUserMessages,
public SMGlobalClass
{
public:
CUserMessages();
~CUserMessages();
UserMessages();
~UserMessages();
public: //SMGlobalClass
void OnSourceModAllInitialized();
void OnSourceModAllShutdown();
@ -80,6 +80,6 @@ private:
int m_CurId;
};
extern CUserMessages g_UserMsgs;
extern UserMessages g_UserMsgs;
#endif //_INCLUDE_SOURCEMOD_CUSERMESSAGES_H_