5404: Always send all tunings r=def- a=heinrich5991

It doesn't hurt since tunings after the last one are simply ignored.
This also stops future coders from introducing more and more cases in
this `if` chain.

## Checklist

- [ ] Tested the change ingame
- [ ] 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: heinrich5991 <heinrich5991@gmail.com>
This commit is contained in:
bors[bot] 2022-06-13 22:10:51 +00:00 committed by GitHub
commit 28ce480baa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 17 deletions

View file

@ -108,13 +108,11 @@ enum
VERSION_DDNET_OLD = 2,
VERSION_DDNET_WHISPER = 217,
VERSION_DDNET_GOODHOOK = 221,
VERSION_DDNET_EXTRATUNES = 302,
VERSION_DDNET_RCONPROTECT = 408,
VERSION_DDNET_ANTIPING_PROJECTILE = 604,
VERSION_DDNET_HOOKDURATION_TUNE = 607,
VERSION_DDNET_FIREDELAY_TUNE = 701,
VERSION_DDNET_UPDATER_FIXED = 707,
VERSION_DDNET_GAMETICK = 10042,
VERSION_DDNET_EARLY_VERSION = 13020,
VERSION_DDNET_MSG_LEGACY = 15040,
VERSION_DDNET_SWITCH = 15060,
VERSION_DDNET_INDEPENDENT_SPECTATORS_TEAM = 16000,

View file

@ -758,19 +758,7 @@ void CGameContext::SendTuningParams(int ClientID, int Zone)
else
pParams = (int *)&(m_aTuningList[Zone]);
unsigned int Last = sizeof(m_Tuning) / sizeof(int);
if(m_apPlayers[ClientID])
{
int ClientVersion = m_apPlayers[ClientID]->GetClientVersion();
if(ClientVersion < VERSION_DDNET_EXTRATUNES)
Last = 33;
else if(ClientVersion < VERSION_DDNET_HOOKDURATION_TUNE)
Last = 37;
else if(ClientVersion < VERSION_DDNET_FIREDELAY_TUNE)
Last = 38;
}
for(unsigned i = 0; i < Last; i++)
for(unsigned i = 0; i < sizeof(m_Tuning) / sizeof(int); i++)
{
if(m_apPlayers[ClientID] && m_apPlayers[ClientID]->GetCharacter())
{
@ -1599,7 +1587,7 @@ bool CGameContext::OnClientDDNetVersionKnown(int ClientID)
SendRecord(ClientID);
// And report correct tunings.
if(ClientVersion >= VERSION_DDNET_EXTRATUNES)
if(ClientVersion < VERSION_DDNET_EARLY_VERSION)
SendTuningParams(ClientID, pPlayer->m_TuneZone);
// Tell old clients to update.