From 1e0133c375f71ab57351e44e0f311ddabb3469b4 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Tue, 15 Mar 2016 12:25:20 +0100 Subject: [PATCH] Fix firing OnShutdown with wrong instance index on mapchange Prehook RemoveHLTVServer, so we can still find the instance in the director when trying to figure out the instance index. --- extension.cpp | 6 +++--- extension.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extension.cpp b/extension.cpp index d80d19b..94a8ffc 100644 --- a/extension.cpp +++ b/extension.cpp @@ -109,7 +109,7 @@ void SourceTVManager::SDK_OnAllLoaded() { #if SOURCE_ENGINE == SE_CSGO SH_ADD_HOOK(IHLTVDirector, AddHLTVServer, hltvdirector, SH_MEMBER(this, &SourceTVManager::OnAddHLTVServer_Post), true); - SH_ADD_HOOK(IHLTVDirector, RemoveHLTVServer, hltvdirector, SH_MEMBER(this, &SourceTVManager::OnRemoveHLTVServer_Post), true); + SH_ADD_HOOK(IHLTVDirector, RemoveHLTVServer, hltvdirector, SH_MEMBER(this, &SourceTVManager::OnRemoveHLTVServer), false); #else SH_ADD_HOOK(IHLTVDirector, SetHLTVServer, hltvdirector, SH_MEMBER(this, &SourceTVManager::OnSetHLTVServer_Post), true); #endif @@ -166,7 +166,7 @@ void SourceTVManager::SDK_OnUnload() { #if SOURCE_ENGINE == SE_CSGO SH_REMOVE_HOOK(IHLTVDirector, AddHLTVServer, hltvdirector, SH_MEMBER(this, &SourceTVManager::OnAddHLTVServer_Post), true); - SH_REMOVE_HOOK(IHLTVDirector, RemoveHLTVServer, hltvdirector, SH_MEMBER(this, &SourceTVManager::OnRemoveHLTVServer_Post), true); + SH_REMOVE_HOOK(IHLTVDirector, RemoveHLTVServer, hltvdirector, SH_MEMBER(this, &SourceTVManager::OnRemoveHLTVServer), false); #else SH_REMOVE_HOOK(IHLTVDirector, SetHLTVServer, hltvdirector, SH_MEMBER(this, &SourceTVManager::OnSetHLTVServer_Post), true); #endif @@ -218,7 +218,7 @@ void SourceTVManager::OnAddHLTVServer_Post(IHLTVServer *hltv) RETURN_META(MRES_IGNORED); } -void SourceTVManager::OnRemoveHLTVServer_Post(IHLTVServer *hltv) +void SourceTVManager::OnRemoveHLTVServer(IHLTVServer *hltv) { HLTVServerWrapper *wrapper = g_HLTVServers.GetWrapper(hltv); if (!wrapper) diff --git a/extension.h b/extension.h index 0520261..fa35dad 100644 --- a/extension.h +++ b/extension.h @@ -143,7 +143,7 @@ public: private: #if SOURCE_ENGINE == SE_CSGO void OnAddHLTVServer_Post(IHLTVServer *hltv); - void OnRemoveHLTVServer_Post(IHLTVServer *hltv); + void OnRemoveHLTVServer(IHLTVServer *hltv); #else void OnSetHLTVServer_Post(IHLTVServer *hltv); #endif