From f3ba2e86cab3a5bcc5698d4f9758834758d64dd8 Mon Sep 17 00:00:00 2001 From: def Date: Thu, 27 Nov 2014 01:59:55 +0100 Subject: [PATCH] Send timeout code later (fixes timeout code entering issues, fixes timeout protection not working realiably with dummy) --- src/engine/client/client.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 82ec6338a..137f532fb 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -1458,22 +1458,6 @@ void CClient::ProcessConnlessPacket(CNetChunk *pPacket) mem_copy(&m_CurrentServerInfo, &Info, sizeof(m_CurrentServerInfo)); m_CurrentServerInfo.m_NetAddr = m_ServerAddress; m_CurrentServerInfoRequestTime = -1; - - if(State() == IClient::STATE_ONLINE && !m_TimeoutCodeSent[g_Config.m_ClDummy]) - { - if(str_find_nocase(Info.m_aGameType, "ddracenetw") || str_find_nocase(Info.m_aGameType, "ddnet")) - { - m_TimeoutCodeSent[g_Config.m_ClDummy] = true; - CNetMsg_Cl_Say Msg; - Msg.m_Team = 0; - char aBuf[256]; - str_format(aBuf, sizeof(aBuf), "/timeout %s", g_Config.m_ClDummy ? g_Config.m_ClDummyTimeoutCode : g_Config.m_ClTimeoutCode); - Msg.m_pMessage = aBuf; - CMsgPacker Packer(Msg.MsgID()); - Msg.Pack(&Packer); - SendMsgExY(&Packer, MSGFLAG_VITAL, false, g_Config.m_ClDummy); - } - } } } } @@ -1872,6 +1856,23 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket) m_GameTime[g_Config.m_ClDummy].Update(&m_GametimeMarginGraph, (GameTick-1)*time_freq()/50, TimeLeft, 0); } + if(m_RecivedSnapshots[g_Config.m_ClDummy] > 50 && !m_TimeoutCodeSent[g_Config.m_ClDummy]) + { + if(str_find_nocase(m_CurrentServerInfo.m_aGameType, "ddracenetw") + || str_find_nocase(m_CurrentServerInfo.m_aGameType, "ddnet")) + { + m_TimeoutCodeSent[g_Config.m_ClDummy] = true; + CNetMsg_Cl_Say Msg; + Msg.m_Team = 0; + char aBuf[256]; + str_format(aBuf, sizeof(aBuf), "/timeout %s", g_Config.m_ClDummy ? g_Config.m_ClDummyTimeoutCode : g_Config.m_ClTimeoutCode); + Msg.m_pMessage = aBuf; + CMsgPacker Packer(Msg.MsgID()); + Msg.Pack(&Packer); + SendMsgExY(&Packer, MSGFLAG_VITAL, false, g_Config.m_ClDummy); + } + } + // ack snapshot m_AckGameTick[g_Config.m_ClDummy] = GameTick; }