mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge pull request #194 from timgame/DDRace64
resend player/dummy info that filtered the server
This commit is contained in:
commit
b0085aef55
|
@ -406,7 +406,6 @@ void CGameClient::OnConnected()
|
||||||
Client()->GetServerInfo(&CurrentServerInfo);
|
Client()->GetServerInfo(&CurrentServerInfo);
|
||||||
|
|
||||||
m_ServerMode = SERVERMODE_PURE;
|
m_ServerMode = SERVERMODE_PURE;
|
||||||
m_LastSendInfo = 0;
|
|
||||||
|
|
||||||
// send the inital info
|
// send the inital info
|
||||||
SendInfo(true);
|
SendInfo(true);
|
||||||
|
@ -580,23 +579,45 @@ void CGameClient::OnRender()
|
||||||
if(g_Config.m_ClDummy && !Client()->DummyConnected())
|
if(g_Config.m_ClDummy && !Client()->DummyConnected())
|
||||||
g_Config.m_ClDummy = 0;
|
g_Config.m_ClDummy = 0;
|
||||||
|
|
||||||
// check if client info has to be resent
|
// resend player and dummy info if it was filtered by server
|
||||||
if(m_LastSendInfo && Client()->State() == IClient::STATE_ONLINE && m_Snap.m_LocalClientID >= 0 && !m_pMenus->IsActive() && m_LastSendInfo+time_freq()*6 < time_get())
|
if(Client()->State() == IClient::STATE_ONLINE && !m_pMenus->IsActive()) {
|
||||||
{
|
if(m_CheckInfo == 0) {
|
||||||
// resend if client info differs
|
if(
|
||||||
if(str_comp(g_Config.m_PlayerName, m_aClients[m_Snap.m_LocalClientID].m_aName) ||
|
str_comp(m_aClients[Client()->m_LocalIDs[0]].m_aName, g_Config.m_PlayerName) ||
|
||||||
str_comp(g_Config.m_PlayerClan, m_aClients[m_Snap.m_LocalClientID].m_aClan) ||
|
str_comp(m_aClients[Client()->m_LocalIDs[0]].m_aClan, g_Config.m_PlayerClan) ||
|
||||||
g_Config.m_PlayerCountry != m_aClients[m_Snap.m_LocalClientID].m_Country ||
|
m_aClients[Client()->m_LocalIDs[0]].m_Country != g_Config.m_PlayerCountry ||
|
||||||
str_comp(g_Config.m_PlayerSkin, m_aClients[m_Snap.m_LocalClientID].m_aSkinName) ||
|
str_comp(m_aClients[Client()->m_LocalIDs[0]].m_aSkinName, g_Config.m_PlayerSkin) ||
|
||||||
(m_Snap.m_pGameInfoObj && !(m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_TEAMS) && // no teamgame?
|
m_aClients[Client()->m_LocalIDs[0]].m_UseCustomColor != g_Config.m_PlayerUseCustomColor ||
|
||||||
(g_Config.m_PlayerUseCustomColor != m_aClients[m_Snap.m_LocalClientID].m_UseCustomColor ||
|
m_aClients[Client()->m_LocalIDs[0]].m_ColorBody != g_Config.m_PlayerColorBody ||
|
||||||
g_Config.m_PlayerColorBody != m_aClients[m_Snap.m_LocalClientID].m_ColorBody ||
|
m_aClients[Client()->m_LocalIDs[0]].m_ColorFeet != g_Config.m_PlayerColorFeet
|
||||||
g_Config.m_PlayerColorFeet != m_aClients[m_Snap.m_LocalClientID].m_ColorFeet)))
|
)
|
||||||
{
|
|
||||||
if (!g_Config.m_ClDummy)
|
|
||||||
SendInfo(false);
|
SendInfo(false);
|
||||||
|
else
|
||||||
|
m_CheckInfo = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_CheckInfo > 0)
|
||||||
|
m_CheckInfo--;
|
||||||
|
|
||||||
|
if(Client()->DummyConnected()) {
|
||||||
|
if(m_CheckDummyInfo == 0) {
|
||||||
|
if(
|
||||||
|
str_comp(m_aClients[Client()->m_LocalIDs[1]].m_aName, g_Config.m_DummyName) ||
|
||||||
|
str_comp(m_aClients[Client()->m_LocalIDs[1]].m_aClan, g_Config.m_DummyClan) ||
|
||||||
|
m_aClients[Client()->m_LocalIDs[1]].m_Country != g_Config.m_DummyCountry ||
|
||||||
|
str_comp(m_aClients[Client()->m_LocalIDs[1]].m_aSkinName, g_Config.m_DummySkin) ||
|
||||||
|
m_aClients[Client()->m_LocalIDs[1]].m_UseCustomColor != g_Config.m_DummyUseCustomColor ||
|
||||||
|
m_aClients[Client()->m_LocalIDs[1]].m_ColorBody != g_Config.m_DummyColorBody ||
|
||||||
|
m_aClients[Client()->m_LocalIDs[1]].m_ColorFeet != g_Config.m_DummyColorFeet
|
||||||
|
)
|
||||||
|
SendDummyInfo(false);
|
||||||
|
else
|
||||||
|
m_CheckDummyInfo = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_CheckDummyInfo > 0)
|
||||||
|
m_CheckDummyInfo--;
|
||||||
}
|
}
|
||||||
m_LastSendInfo = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1700,6 +1721,7 @@ void CGameClient::SendInfo(bool Start)
|
||||||
CMsgPacker Packer(Msg.MsgID());
|
CMsgPacker Packer(Msg.MsgID());
|
||||||
Msg.Pack(&Packer);
|
Msg.Pack(&Packer);
|
||||||
Client()->SendMsgExY(&Packer, MSGFLAG_VITAL, false, 0);
|
Client()->SendMsgExY(&Packer, MSGFLAG_VITAL, false, 0);
|
||||||
|
m_CheckInfo = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1714,10 +1736,7 @@ void CGameClient::SendInfo(bool Start)
|
||||||
CMsgPacker Packer(Msg.MsgID());
|
CMsgPacker Packer(Msg.MsgID());
|
||||||
Msg.Pack(&Packer);
|
Msg.Pack(&Packer);
|
||||||
Client()->SendMsgExY(&Packer, MSGFLAG_VITAL, false, 0);
|
Client()->SendMsgExY(&Packer, MSGFLAG_VITAL, false, 0);
|
||||||
|
m_CheckInfo = Client()->GameTickSpeed();
|
||||||
// activate timer to resend the info if it gets filtered
|
|
||||||
if(!m_LastSendInfo || m_LastSendInfo+time_freq()*5 < time_get())
|
|
||||||
m_LastSendInfo = time_get();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1736,6 +1755,7 @@ void CGameClient::SendDummyInfo(bool Start)
|
||||||
CMsgPacker Packer(Msg.MsgID());
|
CMsgPacker Packer(Msg.MsgID());
|
||||||
Msg.Pack(&Packer);
|
Msg.Pack(&Packer);
|
||||||
Client()->SendMsgExY(&Packer, MSGFLAG_VITAL, false, 1);
|
Client()->SendMsgExY(&Packer, MSGFLAG_VITAL, false, 1);
|
||||||
|
m_CheckDummyInfo = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1750,10 +1770,7 @@ void CGameClient::SendDummyInfo(bool Start)
|
||||||
CMsgPacker Packer(Msg.MsgID());
|
CMsgPacker Packer(Msg.MsgID());
|
||||||
Msg.Pack(&Packer);
|
Msg.Pack(&Packer);
|
||||||
Client()->SendMsgExY(&Packer, MSGFLAG_VITAL,false, 1);
|
Client()->SendMsgExY(&Packer, MSGFLAG_VITAL,false, 1);
|
||||||
|
m_CheckDummyInfo = Client()->GameTickSpeed();
|
||||||
// activate timer to resend the info if it gets filtered
|
|
||||||
//if(!m_LastSendInfo || m_LastSendInfo+time_freq()*5 < time_get())
|
|
||||||
// m_LastSendInfo = time_get();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,8 @@ class CGameClient : public IGameClient
|
||||||
int m_PredictedTick;
|
int m_PredictedTick;
|
||||||
int m_LastNewPredictedTick[2];
|
int m_LastNewPredictedTick[2];
|
||||||
|
|
||||||
int64 m_LastSendInfo;
|
int m_CheckInfo;
|
||||||
|
int m_CheckDummyInfo;
|
||||||
|
|
||||||
static void ConTeam(IConsole::IResult *pResult, void *pUserData);
|
static void ConTeam(IConsole::IResult *pResult, void *pUserData);
|
||||||
static void ConKill(IConsole::IResult *pResult, void *pUserData);
|
static void ConKill(IConsole::IResult *pResult, void *pUserData);
|
||||||
|
|
Loading…
Reference in a new issue