mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-13 03:28:19 +00:00
limit the number of chat messages a player can queue to 3
This commit is contained in:
parent
5de2763f82
commit
76d7569e15
|
@ -112,14 +112,26 @@ bool CChat::OnInput(IInput::CEvent Event)
|
||||||
{
|
{
|
||||||
if(m_Input.GetString()[0])
|
if(m_Input.GetString()[0])
|
||||||
{
|
{
|
||||||
|
bool AddEntry = false;
|
||||||
|
|
||||||
if(m_LastChatSend+time_freq() < time_get())
|
if(m_LastChatSend+time_freq() < time_get())
|
||||||
|
{
|
||||||
Say(m_Mode == MODE_ALL ? 0 : 1, m_Input.GetString());
|
Say(m_Mode == MODE_ALL ? 0 : 1, m_Input.GetString());
|
||||||
else
|
AddEntry = true;
|
||||||
|
}
|
||||||
|
else if(m_PendingChatCounter < 3)
|
||||||
|
{
|
||||||
++m_PendingChatCounter;
|
++m_PendingChatCounter;
|
||||||
|
AddEntry = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(AddEntry)
|
||||||
|
{
|
||||||
CHistoryEntry *pEntry = m_History.Allocate(sizeof(CHistoryEntry)+m_Input.GetLength());
|
CHistoryEntry *pEntry = m_History.Allocate(sizeof(CHistoryEntry)+m_Input.GetLength());
|
||||||
pEntry->m_Team = m_Mode == MODE_ALL ? 0 : 1;
|
pEntry->m_Team = m_Mode == MODE_ALL ? 0 : 1;
|
||||||
mem_copy(pEntry->m_aText, m_Input.GetString(), m_Input.GetLength()+1);
|
mem_copy(pEntry->m_aText, m_Input.GetString(), m_Input.GetLength()+1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
m_pHistoryEntry = 0x0;
|
m_pHistoryEntry = 0x0;
|
||||||
m_Mode = MODE_NONE;
|
m_Mode = MODE_NONE;
|
||||||
m_pClient->OnRelease();
|
m_pClient->OnRelease();
|
||||||
|
|
Loading…
Reference in a new issue