Merge pull request #16 from psychonic/client-disconnect-quirks

Fix inconsistencies with OnClientDisconnected calls (bug 5988, r=kyles)
This commit is contained in:
Nicholas Hastings 2014-05-30 19:09:50 -04:00
commit 76a589f689

View File

@ -746,8 +746,10 @@ void PlayerManager::OnSourceModLevelEnd()
{ {
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
OnClientDisconnect(m_Players[i].GetIndex(), 0); OnClientDisconnect(m_Players[i].GetIndex(), 0);
OnClientDisconnect_Post(m_Players[i].GetIndex(), 0);
#else #else
OnClientDisconnect(m_Players[i].GetEdict()); OnClientDisconnect(m_Players[i].GetEdict());
OnClientDisconnect_Post(m_Players[i].GetEdict());
#endif #endif
} }
} }
@ -791,13 +793,6 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
pListener = (*iter); pListener = (*iter);
pListener->OnClientDisconnecting(client); pListener->OnClientDisconnecting(client);
} }
InvalidatePlayer(pPlayer);
if (m_ListenClient == client)
{
m_ListenClient = 0;
}
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
@ -810,6 +805,19 @@ void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
{ {
int client = IndexOfEdict(pEntity); int client = IndexOfEdict(pEntity);
#endif #endif
CPlayer *pPlayer = &m_Players[client];
if (!pPlayer->IsConnected())
{
/* We don't care, prevent a double call */
return;
}
InvalidatePlayer(pPlayer);
if (m_ListenClient == client)
{
m_ListenClient = 0;
}
cell_t res; cell_t res;