4454: Don't clear client version on map change r=def- a=heinrich5991

Also still record client version on map changes into teehistorian.

Fixes #4445.

Thanks to `@Kaffeine` for noticing.

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
This commit is contained in:
bors[bot] 2021-12-14 07:47:44 +00:00 committed by GitHub
commit 5f9d8de818
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 15 deletions

View file

@ -279,9 +279,6 @@ void CServer::CClient::Reset()
m_Score = 0;
m_NextMapChunk = 0;
m_Flags = 0;
m_DDNetVersion = VERSION_NONE;
m_GotDDNetVersionPacket = false;
m_DDNetVersionSettled = false;
}
CServer::CServer() :
@ -984,6 +981,9 @@ int CServer::ClientRejoinCallback(int ClientID, void *pUser)
pThis->m_aClients[ClientID].m_Authed = AUTHED_NO;
pThis->m_aClients[ClientID].m_AuthKey = -1;
pThis->m_aClients[ClientID].m_pRconCmdToSend = 0;
pThis->m_aClients[ClientID].m_DDNetVersion = VERSION_NONE;
pThis->m_aClients[ClientID].m_GotDDNetVersionPacket = false;
pThis->m_aClients[ClientID].m_DDNetVersionSettled = false;
pThis->m_aClients[ClientID].Reset();
@ -999,7 +999,6 @@ int CServer::NewClientNoAuthCallback(int ClientID, void *pUser)
pThis->m_aClients[ClientID].m_DnsblState = CClient::DNSBL_STATE_NONE;
pThis->m_aClients[ClientID].m_State = CClient::STATE_CONNECTING;
pThis->m_aClients[ClientID].m_SupportsMapSha256 = false;
pThis->m_aClients[ClientID].m_aName[0] = 0;
pThis->m_aClients[ClientID].m_aClan[0] = 0;
pThis->m_aClients[ClientID].m_Country = -1;
@ -1008,6 +1007,9 @@ int CServer::NewClientNoAuthCallback(int ClientID, void *pUser)
pThis->m_aClients[ClientID].m_AuthTries = 0;
pThis->m_aClients[ClientID].m_pRconCmdToSend = 0;
pThis->m_aClients[ClientID].m_ShowIps = false;
pThis->m_aClients[ClientID].m_DDNetVersion = VERSION_NONE;
pThis->m_aClients[ClientID].m_GotDDNetVersionPacket = false;
pThis->m_aClients[ClientID].m_DDNetVersionSettled = false;
pThis->m_aClients[ClientID].Reset();
pThis->SendCapabilities(ClientID);
@ -1022,7 +1024,6 @@ int CServer::NewClientCallback(int ClientID, void *pUser, bool Sixup)
{
CServer *pThis = (CServer *)pUser;
pThis->m_aClients[ClientID].m_State = CClient::STATE_PREAUTH;
pThis->m_aClients[ClientID].m_SupportsMapSha256 = false;
pThis->m_aClients[ClientID].m_DnsblState = CClient::DNSBL_STATE_NONE;
pThis->m_aClients[ClientID].m_aName[0] = 0;
pThis->m_aClients[ClientID].m_aClan[0] = 0;
@ -1034,6 +1035,9 @@ int CServer::NewClientCallback(int ClientID, void *pUser, bool Sixup)
pThis->m_aClients[ClientID].m_Traffic = 0;
pThis->m_aClients[ClientID].m_TrafficSince = 0;
pThis->m_aClients[ClientID].m_ShowIps = false;
pThis->m_aClients[ClientID].m_DDNetVersion = VERSION_NONE;
pThis->m_aClients[ClientID].m_GotDDNetVersionPacket = false;
pThis->m_aClients[ClientID].m_DDNetVersionSettled = false;
memset(&pThis->m_aClients[ClientID].m_Addr, 0, sizeof(NETADDR));
pThis->m_aClients[ClientID].Reset();
@ -1107,7 +1111,6 @@ int CServer::DelClientCallback(int ClientID, const char *pReason, void *pUser)
pThis->GameServer()->OnClientDrop(ClientID, pReason);
pThis->m_aClients[ClientID].m_State = CClient::STATE_EMPTY;
pThis->m_aClients[ClientID].m_SupportsMapSha256 = false;
pThis->m_aClients[ClientID].m_aName[0] = 0;
pThis->m_aClients[ClientID].m_aClan[0] = 0;
pThis->m_aClients[ClientID].m_Country = -1;
@ -3730,6 +3733,9 @@ bool CServer::SetTimedOut(int ClientID, int OrigID)
DelClientCallback(OrigID, "Timeout Protection used", this);
m_aClients[ClientID].m_Authed = AUTHED_NO;
m_aClients[ClientID].m_Flags = m_aClients[OrigID].m_Flags;
m_aClients[ClientID].m_DDNetVersion = m_aClients[OrigID].m_DDNetVersion;
m_aClients[ClientID].m_GotDDNetVersionPacket = m_aClients[OrigID].m_GotDDNetVersionPacket;
m_aClients[ClientID].m_DDNetVersionSettled = m_aClients[OrigID].m_DDNetVersionSettled;
return true;
}

View file

@ -150,7 +150,6 @@ public:
// connection state info
int m_State;
bool m_SupportsMapSha256;
int m_Latency;
int m_SnapRate;

View file

@ -1271,19 +1271,19 @@ void CGameContext::OnClientEnter(int ClientID)
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_NORECORD, ClientID);
}
IServer::CClientInfo Info;
Server()->GetClientInfo(ClientID, &Info);
if(Info.m_GotDDNetVersion)
{
if(OnClientDDNetVersionKnown(ClientID))
return; // kicked
}
if(!Server()->ClientPrevIngame(ClientID))
{
if(g_Config.m_SvWelcome[0] != 0)
SendChatTarget(ClientID, g_Config.m_SvWelcome);
IServer::CClientInfo Info;
Server()->GetClientInfo(ClientID, &Info);
if(Info.m_GotDDNetVersion)
{
if(OnClientDDNetVersionKnown(ClientID))
return; // kicked
}
if(g_Config.m_SvShowOthersDefault > 0)
{
if(g_Config.m_SvShowOthers)