mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #6455
6455: Fix dummy tee being able to ping main tee in chat r=def- a=Robyt3 Main and dummy tee cannot ping each other anymore. Other main and dummy tees can still ping your own main and dummy tees. We must ensure to only use `m_aLocalIDs[1]` when the dummy is connected, as this ID is not updated when no dummy is connected, so it can refer to another client if you disconnect your dummy and another client subsequently takes its client ID. Closes #3699. ## Checklist - [X] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test (especially base/) or added coverage to integration test - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: Robert Müller <robytemueller@gmail.com>
This commit is contained in:
commit
4c07e76d12
|
@ -761,22 +761,19 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
|
|||
// check for highlighted name
|
||||
if(Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||
{
|
||||
if(ClientID >= 0 && ClientID != m_pClient->m_aLocalIDs[0])
|
||||
if(ClientID >= 0 && ClientID != m_pClient->m_aLocalIDs[0] && (!m_pClient->Client()->DummyConnected() || ClientID != m_pClient->m_aLocalIDs[1]))
|
||||
{
|
||||
// main character
|
||||
if(LineShouldHighlight(pLine, m_pClient->m_aClients[m_pClient->m_aLocalIDs[0]].m_aName))
|
||||
Highlighted = true;
|
||||
Highlighted |= LineShouldHighlight(pLine, m_pClient->m_aClients[m_pClient->m_aLocalIDs[0]].m_aName);
|
||||
// dummy
|
||||
if(m_pClient->Client()->DummyConnected() && LineShouldHighlight(pLine, m_pClient->m_aClients[m_pClient->m_aLocalIDs[1]].m_aName))
|
||||
Highlighted = true;
|
||||
Highlighted |= m_pClient->Client()->DummyConnected() && LineShouldHighlight(pLine, m_pClient->m_aClients[m_pClient->m_aLocalIDs[1]].m_aName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// on demo playback use local id from snap directly,
|
||||
// since m_aLocalIDs isn't valid there
|
||||
if(m_pClient->m_Snap.m_LocalClientID >= 0 && LineShouldHighlight(pLine, m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientID].m_aName))
|
||||
Highlighted = true;
|
||||
Highlighted |= m_pClient->m_Snap.m_LocalClientID >= 0 && LineShouldHighlight(pLine, m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientID].m_aName);
|
||||
}
|
||||
|
||||
pCurrentLine->m_Highlighted = Highlighted;
|
||||
|
|
Loading…
Reference in a new issue