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

Method PreInputClients

src/game/server/gamecontext.cpp:1421–1453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1419}
1420
1421void CGameContext::PreInputClients(int ClientId, bool *pClients)
1422{
1423 if(!pClients || !m_apPlayers[ClientId])
1424 return;
1425
1426 if(m_apPlayers[ClientId]->GetTeam() == TEAM_SPECTATORS || !m_apPlayers[ClientId]->GetCharacter() || m_apPlayers[ClientId]->IsAfk())
1427 return;
1428
1429 for(int Id = 0; Id < MAX_CLIENTS; Id++)
1430 {
1431 if(ClientId == Id)
1432 continue;
1433
1434 CPlayer *pPlayer = m_apPlayers[Id];
1435 if(!pPlayer)
1436 continue;
1437
1438 if(Server()->GetClientVersion(Id) < VERSION_DDNET_PREINPUT)
1439 continue;
1440
1441 if(pPlayer->GetTeam() == TEAM_SPECTATORS || GetDDRaceTeam(ClientId) != GetDDRaceTeam(Id) || pPlayer->IsAfk())
1442 continue;
1443
1444 CCharacter *pChr = pPlayer->GetCharacter();
1445 if(!pChr)
1446 continue;
1447
1448 if(!pChr->CanSnapCharacter(ClientId) || pChr->NetworkClipped(ClientId))
1449 continue;
1450
1451 pClients[Id] = true;
1452 }
1453}
1454
1455// Server hooks
1456void CGameContext::OnClientPrepareInput(int ClientId, void *pInput)

Callers 1

ProcessClientPacketMethod · 0.80

Calls 7

GetTeamMethod · 0.80
GetCharacterMethod · 0.80
CanSnapCharacterMethod · 0.80
NetworkClippedMethod · 0.80
ServerClass · 0.50
IsAfkMethod · 0.45
GetClientVersionMethod · 0.45

Tested by

no test coverage detected