flip to queue - fix serial on resched.

This commit is contained in:
Kyle Sanderson 2019-09-06 10:07:54 -07:00 committed by BotoX
parent 291b83ed74
commit 026678d182

View File

@ -919,8 +919,7 @@ void PlayerManager::OnPrintfFrameAction(unsigned int serial)
int nNumBitsWritten = pNetChan->GetNumBitsWritten(false); // SVC_Print uses unreliable netchan int nNumBitsWritten = pNetChan->GetNumBitsWritten(false); // SVC_Print uses unreliable netchan
#endif #endif
ke::LinkedList<ke::AString>::iterator iter = player.m_PrintfBuffer.begin(); ke::AString &string = player.m_PrintfBuffer.front();
ke::AString &string = (*iter);
// stop if we'd overflow the SVC_Print buffer (+7 as ceil) // stop if we'd overflow the SVC_Print buffer (+7 as ceil)
if ((nNumBitsWritten + NETMSG_TYPE_BITS + 7) / 8 + string.length() >= SVC_Print_BufferSize) if ((nNumBitsWritten + NETMSG_TYPE_BITS + 7) / 8 + string.length() >= SVC_Print_BufferSize)
@ -928,13 +927,13 @@ void PlayerManager::OnPrintfFrameAction(unsigned int serial)
SH_CALL(engine, &IVEngineServer::ClientPrintf)(player.m_pEdict, string.chars()); SH_CALL(engine, &IVEngineServer::ClientPrintf)(player.m_pEdict, string.chars());
player.m_PrintfBuffer.erase(iter); player.m_PrintfBuffer.popFront();
} }
if (!player.m_PrintfBuffer.empty()) if (!player.m_PrintfBuffer.empty())
{ {
// continue processing it on the next gameframe as buffer is not empty // continue processing it on the next gameframe as buffer is not empty
g_SourceMod.AddFrameAction(PrintfBuffer_FrameAction, (void *)(intptr_t)client); g_SourceMod.AddFrameAction(PrintfBuffer_FrameAction, (void *)(uintptr_t)player.GetSerial());
} }
} }