3693: Rank not sending r=def- a=houseme-kyle

- Fixes the message for loop not sending all messages
- Still calls SpamProtection method for each message to count towards users spam chat score
*** If the above isn't relevant, then the spam check can move outside the for loop
- Tested with normal and a muted user

![image](https://user-images.githubusercontent.com/25198124/110751526-a3132b80-824c-11eb-9a9a-6ac507bb87b4.png)
![image](https://user-images.githubusercontent.com/25198124/110751829-14eb7500-824d-11eb-9f23-3aca11af428b.png)

## Checklist

- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] 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: houseme-kyle <kyle@houseme.co.za>
Co-authored-by: Kyle Bradley <kyle@house.me>
This commit is contained in:
bors[bot] 2021-03-11 07:58:51 +00:00 committed by GitHub
commit 9b17e52d5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -933,13 +933,21 @@ void CPlayer::ProcessScoreResult(CScorePlayerResult &Result)
}
break;
case CScorePlayerResult::ALL:
{
bool PrimaryMessage = true;
for(auto &aMessage : Result.m_Data.m_aaMessages)
{
if(aMessage[0] == 0)
break;
GameServer()->SendChat(-1, CGameContext::CHAT_ALL, aMessage, m_ClientID);
if(GameServer()->ProcessSpamProtection(m_ClientID) && PrimaryMessage)
break;
GameServer()->SendChat(-1, CGameContext::CHAT_ALL, aMessage, -1);
PrimaryMessage = false;
}
break;
}
case CScorePlayerResult::BROADCAST:
if(Result.m_Data.m_Broadcast[0] != 0)
GameServer()->SendBroadcast(Result.m_Data.m_Broadcast, -1);