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

Method DoTeamChange

src/game/server/gamecontroller.cpp:758–781  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

756}
757
758void IGameController::DoTeamChange(CPlayer *pPlayer, int Team, bool DoChatMsg)
759{
760 if(!IsValidTeam(Team))
761 return;
762
763 if(Team == pPlayer->GetTeam())
764 return;
765
766 pPlayer->SetTeam(Team);
767 int ClientId = pPlayer->GetCid();
768
769 char aBuf[128];
770 DoChatMsg = false;
771 if(DoChatMsg)
772 {
773 str_format(aBuf, sizeof(aBuf), "'%s' joined the %s", Server()->ClientName(ClientId), GameServer()->m_pController->GetTeamName(Team));
774 GameServer()->SendChat(-1, TEAM_ALL, aBuf);
775 }
776
777 str_format(aBuf, sizeof(aBuf), "team_join player='%d:%s' m_Team=%d", ClientId, Server()->ClientName(ClientId), Team);
778 GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
779
780 // OnPlayerInfoChange(pPlayer);
781}
782
783int IGameController::TileFlagsToPickupFlags(int TileFlags) const
784{

Callers 3

OnSetTeamNetMessageMethod · 0.45
ConSetTeamMethod · 0.45
ConSetTeamAllMethod · 0.45

Calls 10

str_formatFunction · 0.85
GetTeamMethod · 0.80
SetTeamMethod · 0.80
ClientNameMethod · 0.80
ServerClass · 0.50
GetCidMethod · 0.45
GetTeamNameMethod · 0.45
SendChatMethod · 0.45
PrintMethod · 0.45
ConsoleMethod · 0.45

Tested by

no test coverage detected