Cleanly remove all hooks on extension unload
Allows to e.g. reload sdktools during runtime without crashing. Useful for fast development cycles.
This commit is contained in:
@@ -63,11 +63,7 @@ bool g_forcedChange = false;
|
||||
|
||||
void NextMapManager::OnSourceModAllInitialized_Post()
|
||||
{
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
SH_ADD_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
|
||||
#else
|
||||
SH_ADD_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
|
||||
#endif
|
||||
|
||||
ConCommand *pCmd = FindCommand("changelevel");
|
||||
if (pCmd != NULL)
|
||||
@@ -79,11 +75,7 @@ void NextMapManager::OnSourceModAllInitialized_Post()
|
||||
|
||||
void NextMapManager::OnSourceModShutdown()
|
||||
{
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
SH_REMOVE_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
|
||||
#else
|
||||
SH_REMOVE_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
|
||||
#endif
|
||||
|
||||
if (changeLevelCmd != NULL)
|
||||
{
|
||||
|
||||
@@ -846,11 +846,7 @@ CPluginManager::~CPluginManager()
|
||||
|
||||
void CPluginManager::Shutdown()
|
||||
{
|
||||
List<CPlugin *>::iterator iter;
|
||||
|
||||
for (PluginIter iter(m_plugins); !iter.done(); iter.next()) {
|
||||
UnloadPlugin(*iter);
|
||||
}
|
||||
UnloadAll();
|
||||
}
|
||||
|
||||
void CPluginManager::LoadAll(const char *config_path, const char *plugins_path)
|
||||
@@ -2208,7 +2204,6 @@ void CPluginManager::UnloadAll()
|
||||
int CPluginManager::GetOrderOfPlugin(IPlugin *pl)
|
||||
{
|
||||
int id = 1;
|
||||
List<CPlugin *>::iterator iter;
|
||||
|
||||
for (PluginIter iter(m_plugins); !iter.done(); iter.next()) {
|
||||
if ((*iter) == pl)
|
||||
|
||||
Reference in New Issue
Block a user