diff --git a/core/DebugReporter.cpp b/core/DebugReporter.cpp index 20657b9b..f9eb027f 100644 --- a/core/DebugReporter.cpp +++ b/core/DebugReporter.cpp @@ -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(); diff --git a/core/DebugReporter.h b/core/DebugReporter.h index 020438c4..1fda4bc0 100644 --- a/core/DebugReporter.h +++ b/core/DebugReporter.h @@ -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_ diff --git a/core/GameConfigs.cpp b/core/GameConfigs.cpp index 66036e41..249b32f3 100644 --- a/core/GameConfigs.cpp +++ b/core/GameConfigs.cpp @@ -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; diff --git a/core/GameConfigs.h b/core/GameConfigs.h index 5b55cfb6..c6b93d8f 100644 --- a/core/GameConfigs.h +++ b/core/GameConfigs.h @@ -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_ diff --git a/core/Logger.cpp b/core/Logger.cpp index 5b0c7e60..d6b15308 100644 --- a/core/Logger.cpp +++ b/core/Logger.cpp @@ -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) { diff --git a/core/Logger.h b/core/Logger.h index df4d77a0..5dd95e78 100644 --- a/core/Logger.h +++ b/core/Logger.h @@ -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_ diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index 53a528f2..d1575139 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -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++) { diff --git a/core/PlayerManager.h b/core/PlayerManager.h index 87632aa5..1b8f31cb 100644 --- a/core/PlayerManager.h +++ b/core/PlayerManager.h @@ -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_ diff --git a/core/TextParsers.cpp b/core/TextParsers.cpp index 521d1c1c..d16fee3e 100644 --- a/core/TextParsers.cpp +++ b/core/TextParsers.cpp @@ -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[] = { diff --git a/core/TextParsers.h b/core/TextParsers.h index 6150fccc..a4078923 100644 --- a/core/TextParsers.h +++ b/core/TextParsers.h @@ -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_ diff --git a/core/TimerSys.cpp b/core/TimerSys.cpp index d110f41d..8c90a3ea 100644 --- a/core/TimerSys.cpp +++ b/core/TimerSys.cpp @@ -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; diff --git a/core/TimerSys.h b/core/TimerSys.h index 520a33f1..96576004 100644 --- a/core/TimerSys.h +++ b/core/TimerSys.h @@ -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_ diff --git a/core/Translator.cpp b/core/Translator.cpp index cea55b40..c9827e5e 100644 --- a/core/Translator.cpp +++ b/core/Translator.cpp @@ -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()) { @@ -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, diff --git a/core/Translator.h b/core/Translator.h index 3138e91c..04ca914c 100644 --- a/core/Translator.h +++ b/core/Translator.h @@ -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_ diff --git a/core/UserMessages.cpp b/core/UserMessages.cpp index 6e0b6f23..5687d504 100644 --- a/core/UserMessages.cpp +++ b/core/UserMessages.cpp @@ -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(&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) { diff --git a/core/UserMessages.h b/core/UserMessages.h index 5f833f7b..f900f07f 100644 --- a/core/UserMessages.h +++ b/core/UserMessages.h @@ -36,13 +36,13 @@ struct ListenerInfo typedef List MsgList; typedef List::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_