added some levelchange functions to SMGlobalClass to get rid of some messy crap
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40679
This commit is contained in:
parent
c7f1f04246
commit
dee3a2b3cf
@ -84,6 +84,12 @@ void AdminCache::OnSourceModShutdown()
|
|||||||
m_pCacheFwd = NULL;
|
m_pCacheFwd = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdminCache::OnSourceModPluginsLoaded()
|
||||||
|
{
|
||||||
|
DumpAdminCache(AdminCache_Overrides, true);
|
||||||
|
DumpAdminCache(AdminCache_Groups, true);
|
||||||
|
}
|
||||||
|
|
||||||
void AdminCache::AddCommandOverride(const char *cmd, OverrideType type, FlagBits flags)
|
void AdminCache::AddCommandOverride(const char *cmd, OverrideType type, FlagBits flags)
|
||||||
{
|
{
|
||||||
Trie *pTrie = NULL;
|
Trie *pTrie = NULL;
|
||||||
|
@ -88,6 +88,7 @@ public: //SMGlobalClass
|
|||||||
void OnSourceModStartup(bool late);
|
void OnSourceModStartup(bool late);
|
||||||
void OnSourceModAllInitialized();
|
void OnSourceModAllInitialized();
|
||||||
void OnSourceModShutdown();
|
void OnSourceModShutdown();
|
||||||
|
void OnSourceModPluginsLoaded();
|
||||||
public: //IAdminSystem
|
public: //IAdminSystem
|
||||||
/** Command cache stuff */
|
/** Command cache stuff */
|
||||||
void AddCommandOverride(const char *cmd, OverrideType type, FlagBits flags);
|
void AddCommandOverride(const char *cmd, OverrideType type, FlagBits flags);
|
||||||
|
@ -83,6 +83,11 @@ void Logger::OnSourceModAllShutdown()
|
|||||||
CloseLogger();
|
CloseLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Logger::OnSourceModLevelChange(const char *mapName)
|
||||||
|
{
|
||||||
|
MapChange(mapName);
|
||||||
|
}
|
||||||
|
|
||||||
void Logger::_NewMapFile()
|
void Logger::_NewMapFile()
|
||||||
{
|
{
|
||||||
if (!m_Active)
|
if (!m_Active)
|
||||||
|
@ -49,6 +49,7 @@ public: //SMGlobalClass
|
|||||||
size_t maxlength);
|
size_t maxlength);
|
||||||
void OnSourceModStartup(bool late);
|
void OnSourceModStartup(bool late);
|
||||||
void OnSourceModAllShutdown();
|
void OnSourceModAllShutdown();
|
||||||
|
void OnSourceModLevelChange(const char *mapName);
|
||||||
public:
|
public:
|
||||||
void InitLogger(LoggingMode mode);
|
void InitLogger(LoggingMode mode);
|
||||||
void CloseLogger();
|
void CloseLogger();
|
||||||
|
@ -42,6 +42,11 @@ void TimerSystem::OnSourceModAllInitialized()
|
|||||||
g_ShareSys.AddInterface(NULL, this);
|
g_ShareSys.AddInterface(NULL, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TimerSystem::OnSourceModLevelChange(const char *mapName)
|
||||||
|
{
|
||||||
|
MapChange();
|
||||||
|
}
|
||||||
|
|
||||||
void TimerSystem::RunFrame()
|
void TimerSystem::RunFrame()
|
||||||
{
|
{
|
||||||
ITimer *pTimer;
|
ITimer *pTimer;
|
||||||
|
@ -48,6 +48,7 @@ public:
|
|||||||
~TimerSystem();
|
~TimerSystem();
|
||||||
public: //SMGlobalClass
|
public: //SMGlobalClass
|
||||||
void OnSourceModAllInitialized();
|
void OnSourceModAllInitialized();
|
||||||
|
void OnSourceModLevelChange(const char *mapName);
|
||||||
public: //ITimerSystem
|
public: //ITimerSystem
|
||||||
ITimer *CreateTimer(ITimedEvent *pCallbacks, float fInterval, void *pData, int flags);
|
ITimer *CreateTimer(ITimedEvent *pCallbacks, float fInterval, void *pData, int flags);
|
||||||
void KillTimer(ITimer *pTimer);
|
void KillTimer(ITimer *pTimer);
|
||||||
|
@ -632,6 +632,14 @@ ConfigResult Translator::OnSourceModConfigChanged(const char *key,
|
|||||||
return ConfigResult_Ignore;
|
return ConfigResult_Ignore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Translator::OnSourceModLevelChange(const char *mapName)
|
||||||
|
{
|
||||||
|
/* Refresh language stuff */
|
||||||
|
char path[PLATFORM_MAX_PATH];
|
||||||
|
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "configs/languages.cfg");
|
||||||
|
RebuildLanguageDatabase(path);
|
||||||
|
}
|
||||||
|
|
||||||
void Translator::OnSourceModAllInitialized()
|
void Translator::OnSourceModAllInitialized()
|
||||||
{
|
{
|
||||||
AddLanguage("en", "English");
|
AddLanguage("en", "English");
|
||||||
|
@ -108,6 +108,7 @@ public: // SMGlobalClass
|
|||||||
char *error,
|
char *error,
|
||||||
size_t maxlength);
|
size_t maxlength);
|
||||||
void OnSourceModAllInitialized();
|
void OnSourceModAllInitialized();
|
||||||
|
void OnSourceModLevelChange(const char *mapName);
|
||||||
public: // ITextListener_SMC
|
public: // ITextListener_SMC
|
||||||
void ReadSMC_ParseStart();
|
void ReadSMC_ParseStart();
|
||||||
SMCParseResult ReadSMC_NewSection(const char *name, bool opt_quotes);
|
SMCParseResult ReadSMC_NewSection(const char *name, bool opt_quotes);
|
||||||
|
@ -97,6 +97,20 @@ public:
|
|||||||
{
|
{
|
||||||
return ConfigResult_Ignore;
|
return ConfigResult_Ignore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Called when the level changes.
|
||||||
|
*/
|
||||||
|
virtual void OnSourceModLevelChange(const char *mapName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Called after plugins are loaded on mapchange.
|
||||||
|
*/
|
||||||
|
virtual void OnSourceModPluginsLoaded()
|
||||||
|
{
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
SMGlobalClass *m_pGlobalClassNext;
|
SMGlobalClass *m_pGlobalClassNext;
|
||||||
static SMGlobalClass *head;
|
static SMGlobalClass *head;
|
||||||
|
@ -233,20 +233,25 @@ bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, ch
|
|||||||
g_LastTime = 0.0f;
|
g_LastTime = 0.0f;
|
||||||
g_LastAuthCheck = 0.0f;
|
g_LastAuthCheck = 0.0f;
|
||||||
|
|
||||||
g_Logger.MapChange(pMapName);
|
/* Notify! */
|
||||||
g_Timers.MapChange();
|
SMGlobalClass *pBase = SMGlobalClass::head;
|
||||||
|
while (pBase)
|
||||||
/* Refresh language stuff */
|
{
|
||||||
char path[PLATFORM_MAX_PATH];
|
pBase->OnSourceModLevelChange(pMapName);
|
||||||
BuildPath(Path_SM, path, sizeof(path), "configs/languages.cfg");
|
pBase = pBase->m_pGlobalClassNext;
|
||||||
g_Translator.RebuildLanguageDatabase(path);
|
}
|
||||||
|
|
||||||
DoGlobalPluginLoads();
|
DoGlobalPluginLoads();
|
||||||
|
|
||||||
m_IsMapLoading = false;
|
m_IsMapLoading = false;
|
||||||
|
|
||||||
g_Admins.DumpAdminCache(AdminCache_Overrides, true);
|
/* Notify! */
|
||||||
g_Admins.DumpAdminCache(AdminCache_Groups, true);
|
pBase = SMGlobalClass::head;
|
||||||
|
while (pBase)
|
||||||
|
{
|
||||||
|
pBase->OnSourceModPluginsLoaded();
|
||||||
|
pBase = pBase->m_pGlobalClassNext;
|
||||||
|
}
|
||||||
|
|
||||||
if (!g_pOnGameFrame)
|
if (!g_pOnGameFrame)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user