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

Method SendVoteStatus

src/game/server/gamecontext.cpp:959–983  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

957}
958
959void CGameContext::SendVoteStatus(int ClientId, int Total, int Yes, int No)
960{
961 if(ClientId == -1)
962 {
963 for(int i = 0; i < MAX_CLIENTS; ++i)
964 if(Server()->ClientIngame(i))
965 SendVoteStatus(i, Total, Yes, No);
966 return;
967 }
968
969 if(Total > VANILLA_MAX_CLIENTS && m_apPlayers[ClientId] && m_apPlayers[ClientId]->GetClientVersion() <= VERSION_DDRACE)
970 {
971 Yes = (Yes * VANILLA_MAX_CLIENTS) / (float)Total;
972 No = (No * VANILLA_MAX_CLIENTS) / (float)Total;
973 Total = VANILLA_MAX_CLIENTS;
974 }
975
976 CNetMsg_Sv_VoteStatus Msg = {0};
977 Msg.m_Total = Total;
978 Msg.m_Yes = Yes;
979 Msg.m_No = No;
980 Msg.m_Pass = Total - (Yes + No);
981
982 Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientId);
983}
984
985void CGameContext::AbortVoteKickOnDisconnect(int ClientId)
986{

Callers

nothing calls this directly

Calls 4

ClientIngameMethod · 0.80
ServerClass · 0.50
GetClientVersionMethod · 0.45
SendPackMsgMethod · 0.45

Tested by

no test coverage detected