mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
the server shows the disconnect reason of clients now
This commit is contained in:
parent
8cd7dec179
commit
b6fa69cedb
|
@ -77,7 +77,7 @@ public:
|
|||
|
||||
virtual void OnClientConnected(int ClientID) = 0;
|
||||
virtual void OnClientEnter(int ClientID) = 0;
|
||||
virtual void OnClientDrop(int ClientID) = 0;
|
||||
virtual void OnClientDrop(int ClientID, const char *pReason) = 0;
|
||||
virtual void OnClientDirectInput(int ClientID, void *pInput) = 0;
|
||||
virtual void OnClientPredictedInput(int ClientID, void *pInput) = 0;
|
||||
|
||||
|
|
|
@ -597,7 +597,7 @@ int CServer::DelClientCallback(int ClientID, const char *pReason, void *pUser)
|
|||
|
||||
// notify the mod about the drop
|
||||
if(pThis->m_aClients[ClientID].m_State >= CClient::STATE_READY)
|
||||
pThis->GameServer()->OnClientDrop(ClientID);
|
||||
pThis->GameServer()->OnClientDrop(ClientID, pReason);
|
||||
|
||||
pThis->m_aClients[ClientID].m_State = CClient::STATE_EMPTY;
|
||||
pThis->m_aClients[ClientID].m_aName[0] = 0;
|
||||
|
|
|
@ -546,10 +546,10 @@ void CGameContext::OnClientConnected(int ClientID)
|
|||
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientID);
|
||||
}
|
||||
|
||||
void CGameContext::OnClientDrop(int ClientID)
|
||||
void CGameContext::OnClientDrop(int ClientID, const char *pReason)
|
||||
{
|
||||
AbortVoteKickOnDisconnect(ClientID);
|
||||
m_apPlayers[ClientID]->OnDisconnect();
|
||||
m_apPlayers[ClientID]->OnDisconnect(pReason);
|
||||
delete m_apPlayers[ClientID];
|
||||
m_apPlayers[ClientID] = 0;
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ public:
|
|||
|
||||
virtual void OnClientConnected(int ClientID);
|
||||
virtual void OnClientEnter(int ClientID);
|
||||
virtual void OnClientDrop(int ClientID);
|
||||
virtual void OnClientDrop(int ClientID, const char *pReason);
|
||||
virtual void OnClientDirectInput(int ClientID, void *pInput);
|
||||
virtual void OnClientPredictedInput(int ClientID, void *pInput);
|
||||
|
||||
|
|
|
@ -140,14 +140,17 @@ void CPlayer::Snap(int SnappingClient)
|
|||
}
|
||||
}
|
||||
|
||||
void CPlayer::OnDisconnect()
|
||||
void CPlayer::OnDisconnect(const char *pReason)
|
||||
{
|
||||
KillCharacter();
|
||||
|
||||
if(Server()->ClientIngame(m_ClientID))
|
||||
{
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf), "'%s' has left the game", Server()->ClientName(m_ClientID));
|
||||
if(pReason && *pReason)
|
||||
str_format(aBuf, sizeof(aBuf), "'%s' has left the game (%s)", Server()->ClientName(m_ClientID), pReason);
|
||||
else
|
||||
str_format(aBuf, sizeof(aBuf), "'%s' has left the game", Server()->ClientName(m_ClientID));
|
||||
GameServer()->SendChat(-1, CGameContext::CHAT_ALL, aBuf);
|
||||
|
||||
str_format(aBuf, sizeof(aBuf), "leave player='%d:%s'", m_ClientID, Server()->ClientName(m_ClientID));
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
void OnDirectInput(CNetObj_PlayerInput *NewInput);
|
||||
void OnPredictedInput(CNetObj_PlayerInput *NewInput);
|
||||
void OnDisconnect();
|
||||
void OnDisconnect(const char *pReason);
|
||||
|
||||
void KillCharacter(int Weapon = WEAPON_GAME);
|
||||
CCharacter *GetCharacter();
|
||||
|
|
Loading…
Reference in a new issue