mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
added the possibility to have silent enter/leave messages. closes #1539
This commit is contained in:
parent
b9ea02d13f
commit
4584c16935
|
@ -322,6 +322,7 @@ Messages = [
|
|||
NetArray(NetStringStrict("m_apSkinPartNames"), 6),
|
||||
NetArray(NetBool("m_aUseCustomColors"), 6),
|
||||
NetArray(NetIntAny("m_aSkinPartColors"), 6),
|
||||
NetBool("m_Silent"),
|
||||
]),
|
||||
|
||||
NetMessage("Sv_GameInfo", [
|
||||
|
@ -337,6 +338,7 @@ Messages = [
|
|||
NetMessage("Sv_ClientDrop", [
|
||||
NetIntRange("m_ClientID", 0, 'MAX_CLIENTS-1'),
|
||||
NetStringStrict("m_pReason"),
|
||||
NetBool("m_Silent"),
|
||||
]),
|
||||
|
||||
NetMessage("Sv_GameMsg", []),
|
||||
|
|
|
@ -627,7 +627,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
|
|||
return;
|
||||
}
|
||||
|
||||
if(m_LocalClientID != -1)
|
||||
if(m_LocalClientID != -1 && !pMsg->m_Silent)
|
||||
{
|
||||
DoEnterMessage(pMsg->m_pName, pMsg->m_ClientID, pMsg->m_Team);
|
||||
|
||||
|
@ -676,13 +676,16 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
|
|||
return;
|
||||
}
|
||||
|
||||
DoLeaveMessage(m_aClients[pMsg->m_ClientID].m_aName, pMsg->m_ClientID, pMsg->m_pReason);
|
||||
if(!pMsg->m_Silent)
|
||||
{
|
||||
DoLeaveMessage(m_aClients[pMsg->m_ClientID].m_aName, pMsg->m_ClientID, pMsg->m_pReason);
|
||||
|
||||
CNetMsg_De_ClientLeave Msg;
|
||||
Msg.m_pName = m_aClients[pMsg->m_ClientID].m_aName;
|
||||
Msg.m_ClientID = pMsg->m_ClientID;
|
||||
Msg.m_pReason = pMsg->m_pReason;
|
||||
Client()->SendPackMsg(&Msg, MSGFLAG_NOSEND|MSGFLAG_RECORD);
|
||||
CNetMsg_De_ClientLeave Msg;
|
||||
Msg.m_pName = m_aClients[pMsg->m_ClientID].m_aName;
|
||||
Msg.m_ClientID = pMsg->m_ClientID;
|
||||
Msg.m_pReason = pMsg->m_pReason;
|
||||
Client()->SendPackMsg(&Msg, MSGFLAG_NOSEND | MSGFLAG_RECORD);
|
||||
}
|
||||
|
||||
m_GameInfo.m_NumPlayers--;
|
||||
// calculate team-balance
|
||||
|
|
|
@ -594,6 +594,7 @@ void CGameContext::OnClientEnter(int ClientID)
|
|||
NewClientInfoMsg.m_pName = Server()->ClientName(ClientID);
|
||||
NewClientInfoMsg.m_pClan = Server()->ClientClan(ClientID);
|
||||
NewClientInfoMsg.m_Country = Server()->ClientCountry(ClientID);
|
||||
NewClientInfoMsg.m_Silent = false;
|
||||
for(int p = 0; p < 6; p++)
|
||||
{
|
||||
NewClientInfoMsg.m_apSkinPartNames[p] = m_apPlayers[ClientID]->m_TeeInfos.m_aaSkinPartNames[p];
|
||||
|
@ -619,6 +620,7 @@ void CGameContext::OnClientEnter(int ClientID)
|
|||
ClientInfoMsg.m_pName = Server()->ClientName(i);
|
||||
ClientInfoMsg.m_pClan = Server()->ClientClan(i);
|
||||
ClientInfoMsg.m_Country = Server()->ClientCountry(i);
|
||||
ClientInfoMsg.m_Silent = false;
|
||||
for(int p = 0; p < 6; p++)
|
||||
{
|
||||
ClientInfoMsg.m_apSkinPartNames[p] = m_apPlayers[i]->m_TeeInfos.m_aaSkinPartNames[p];
|
||||
|
@ -681,6 +683,7 @@ void CGameContext::OnClientDrop(int ClientID, const char *pReason)
|
|||
CNetMsg_Sv_ClientDrop Msg;
|
||||
Msg.m_ClientID = ClientID;
|
||||
Msg.m_pReason = pReason;
|
||||
Msg.m_Silent = false;
|
||||
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_NORECORD, -1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue