MCPcopy Create free account
hub / github.com/ddnet/ddnet / OnClientDDNetVersionKnown

Method OnClientDDNetVersionKnown

src/game/server/gamecontext.cpp:1977–2025  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1975}
1976
1977bool CGameContext::OnClientDDNetVersionKnown(int ClientId)
1978{
1979 IServer::CClientInfo Info;
1980 dbg_assert(Server()->GetClientInfo(ClientId, &Info), "failed to get client info");
1981 int ClientVersion = Info.m_DDNetVersion;
1982 dbg_msg("ddnet", "cid=%d version=%d", ClientId, ClientVersion);
1983
1984 if(m_TeeHistorianActive)
1985 {
1986 if(Info.m_pConnectionId && Info.m_pDDNetVersionStr)
1987 {
1988 m_TeeHistorian.RecordDDNetVersion(ClientId, *Info.m_pConnectionId, ClientVersion, Info.m_pDDNetVersionStr);
1989 }
1990 else
1991 {
1992 m_TeeHistorian.RecordDDNetVersionOld(ClientId, ClientVersion);
1993 }
1994 }
1995
1996 // Autoban known bot versions.
1997 if(g_Config.m_SvBannedVersions[0] != '\0' && IsVersionBanned(ClientVersion))
1998 {
1999 Server()->Kick(ClientId, "unsupported client");
2000 return true;
2001 }
2002
2003 CPlayer *pPlayer = m_apPlayers[ClientId];
2004 if(ClientVersion >= VERSION_DDNET_GAMETICK)
2005 pPlayer->m_TimerType = g_Config.m_SvDefaultTimerType;
2006
2007 // First update the teams state.
2008 m_pController->Teams().SendTeamsState(ClientId);
2009
2010 // Then send records.
2011 SendRecord(ClientId);
2012
2013 // And report correct tunings.
2014 if(ClientVersion < VERSION_DDNET_EARLY_VERSION)
2015 SendTuningParams(ClientId, pPlayer->m_TuneZone);
2016
2017 // Tell old clients to update.
2018 if(ClientVersion < VERSION_DDNET_UPDATER_FIXED && g_Config.m_SvClientSuggestionOld[0] != '\0')
2019 SendBroadcast(g_Config.m_SvClientSuggestionOld, ClientId);
2020 // Tell known bot clients that they're botting and we know it.
2021 if(((ClientVersion >= 15 && ClientVersion < 100) || ClientVersion == 502) && g_Config.m_SvClientSuggestionBot[0] != '\0')
2022 SendBroadcast(g_Config.m_SvClientSuggestionBot, ClientId);
2023
2024 return false;
2025}
2026
2027void *CGameContext::PreProcessMsg(int *pMsgId, CUnpacker *pUnpacker, int ClientId)
2028{

Callers

nothing calls this directly

Calls 8

dbg_msgFunction · 0.85
GetClientInfoMethod · 0.80
RecordDDNetVersionMethod · 0.80
RecordDDNetVersionOldMethod · 0.80
SendTeamsStateMethod · 0.80
ServerClass · 0.50
KickMethod · 0.45
TeamsMethod · 0.45

Tested by

no test coverage detected