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

Method OnPlayerDisconnect

src/game/server/gamecontroller.cpp:435–451  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

433}
434
435void IGameController::OnPlayerDisconnect(class CPlayer *pPlayer, const char *pReason)
436{
437 pPlayer->OnDisconnect();
438 int ClientId = pPlayer->GetCid();
439 if(Server()->ClientIngame(ClientId))
440 {
441 char aBuf[512];
442 if(pReason && *pReason)
443 str_format(aBuf, sizeof(aBuf), "'%s' has left the game (%s)", Server()->ClientName(ClientId), pReason);
444 else
445 str_format(aBuf, sizeof(aBuf), "'%s' has left the game", Server()->ClientName(ClientId));
446 GameServer()->SendChat(-1, TEAM_ALL, aBuf, -1, CGameContext::FLAG_SIX);
447
448 str_format(aBuf, sizeof(aBuf), "leave player='%d:%s'", ClientId, Server()->ClientName(ClientId));
449 GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "game", aBuf);
450 }
451}
452
453void IGameController::EndRound()
454{

Callers 1

OnClientDropMethod · 0.45

Calls 9

str_formatFunction · 0.85
OnDisconnectMethod · 0.80
ClientIngameMethod · 0.80
ClientNameMethod · 0.80
ServerClass · 0.50
GetCidMethod · 0.45
SendChatMethod · 0.45
PrintMethod · 0.45
ConsoleMethod · 0.45

Tested by

no test coverage detected