Send timeout code later (fixes timeout code entering issues, fixes timeout protection not working realiably with dummy)

This commit is contained in:
def 2014-11-27 01:59:55 +01:00
parent e4c4ba2d44
commit f3ba2e86ca

View file

@ -1458,22 +1458,6 @@ void CClient::ProcessConnlessPacket(CNetChunk *pPacket)
mem_copy(&m_CurrentServerInfo, &Info, sizeof(m_CurrentServerInfo)); mem_copy(&m_CurrentServerInfo, &Info, sizeof(m_CurrentServerInfo));
m_CurrentServerInfo.m_NetAddr = m_ServerAddress; m_CurrentServerInfo.m_NetAddr = m_ServerAddress;
m_CurrentServerInfoRequestTime = -1; 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); 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 // ack snapshot
m_AckGameTick[g_Config.m_ClDummy] = GameTick; m_AckGameTick[g_Config.m_ClDummy] = GameTick;
} }