From c4c4cf008525ab93fde9b22160684e008c91e9b0 Mon Sep 17 00:00:00 2001 From: Kyle Sanderson Date: Wed, 4 Sep 2019 11:49:53 -0700 Subject: [PATCH] flip to serials. --- core/PlayerManager.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index 17d17355..503e3adf 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -860,14 +860,14 @@ void PlayerManager::OnClientPrintf(edict_t *pEdict, const char *szMsg) { int client = IndexOfEdict(pEdict); - INetChannel *pNetChan = static_cast(engine->GetPlayerNetInfo(client)); - if (pNetChan == NULL) - RETURN_META(MRES_IGNORED); - CPlayer &player = m_Players[client]; if (!player.IsConnected()) RETURN_META(MRES_IGNORED); + INetChannel *pNetChan = static_cast(engine->GetPlayerNetInfo(client)); + if (pNetChan == NULL) + RETURN_META(MRES_IGNORED); + size_t nMsgLen = strlen(szMsg); #if SOURCE_ENGINE == SE_EPISODEONE int nNumBitsWritten = 0; @@ -888,7 +888,7 @@ void PlayerManager::OnClientPrintf(edict_t *pEdict, const char *szMsg) // Don't send any more messages for this player until the buffer is empty. // Queue up a gameframe hook to empty the buffer (if we haven't already) if (player.m_PrintfBuffer.empty()) - g_SourceMod.AddFrameAction(PrintfBuffer_FrameAction, (void *)(intptr_t)client); + g_SourceMod.AddFrameAction(PrintfBuffer_FrameAction, (void *)(uintptr_t)player.GetSerial()); player.m_PrintfBuffer.append(szMsg); @@ -898,8 +898,9 @@ void PlayerManager::OnClientPrintf(edict_t *pEdict, const char *szMsg) RETURN_META(MRES_IGNORED); } -void PlayerManager::OnPrintfFrameAction(int client) +void PlayerManager::OnPrintfFrameAction(unsigned int serial) { + int client = GetClientFromSerial(serial); CPlayer &player = m_Players[client]; if (!player.IsConnected()) {