Fix hooking server and client twice on map change
The engine sets the same server again after mapchanges.
This commit is contained in:
parent
1c7058bbec
commit
ced005af38
@ -205,6 +205,9 @@ void SourceTVManager::SelectSourceTVServer(IHLTVServer *hltv)
|
|||||||
#if SOURCE_ENGINE == SE_CSGO
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
void SourceTVManager::OnAddHLTVServer_Post(IHLTVServer *hltv)
|
void SourceTVManager::OnAddHLTVServer_Post(IHLTVServer *hltv)
|
||||||
{
|
{
|
||||||
|
// Only hook this server if it's a new one.
|
||||||
|
HLTVServerWrapper *wrapper = g_HLTVServers.GetWrapper(hltv);
|
||||||
|
if (!wrapper)
|
||||||
g_HLTVServers.AddServer(hltv);
|
g_HLTVServers.AddServer(hltv);
|
||||||
|
|
||||||
// We already selected some SourceTV server. Keep it.
|
// We already selected some SourceTV server. Keep it.
|
||||||
@ -256,7 +259,8 @@ void SourceTVManager::OnSetHLTVServer_Post(IHLTVServer *hltv)
|
|||||||
// Doesn't hurt either..
|
// Doesn't hurt either..
|
||||||
g_HLTVServers.RemoveServer(hltvserver->GetHLTVServer(), true);
|
g_HLTVServers.RemoveServer(hltvserver->GetHLTVServer(), true);
|
||||||
}
|
}
|
||||||
else
|
// Only hook this server if it's a new one.
|
||||||
|
else if (!hltvserver || g_HLTVServers.GetWrapper(hltv) != hltvserver)
|
||||||
{
|
{
|
||||||
g_HLTVServers.AddServer(hltv);
|
g_HLTVServers.AddServer(hltv);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user