6606: Only run `KillTeam()` when team has more than 1 tee r=def- a=VoxelDoesCode

I also put the `aBuf` segment in there, because why should it even write if it's not going to be sent?

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [x] 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
- [x] 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: VoxelDoesCode <dante_n_cedroni@hotmail.com>
This commit is contained in:
bors[bot] 2023-05-17 20:14:35 +00:00 committed by GitHub
commit 4091d394df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1061,14 +1061,15 @@ void CGameTeams::OnCharacterDeath(int ClientID, int Weapon)
{
ChangeTeamState(Team, CGameTeams::TEAMSTATE_OPEN);
char aBuf[512];
str_format(aBuf, sizeof(aBuf), "Everyone in your locked team was killed because '%s' %s.", Server()->ClientName(ClientID), Weapon == WEAPON_SELF ? "killed" : "died");
m_aPractice[Team] = false;
KillTeam(Team, Weapon == WEAPON_SELF ? ClientID : -1, ClientID);
if(Count(Team) > 1)
{
KillTeam(Team, Weapon == WEAPON_SELF ? ClientID : -1, ClientID);
char aBuf[512];
str_format(aBuf, sizeof(aBuf), "Everyone in your locked team was killed because '%s' %s.", Server()->ClientName(ClientID), Weapon == WEAPON_SELF ? "killed" : "died");
GameServer()->SendChatTeam(Team, aBuf);
}
}