mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 06:58:20 +00:00
Merge #3181
3181: Fix combined player/ping sorting function r=def- a=trml Fixes #3109. ## 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 if it works standalone, system.c especially - [x] 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: trml <trml@users.noreply.github.com>
This commit is contained in:
commit
414f3d2ea4
|
@ -170,10 +170,10 @@ bool CServerBrowser::SortCompareNumPlayersAndPing(int Index1, int Index2) const
|
|||
|
||||
if(a->m_Info.m_NumFilteredPlayers == b->m_Info.m_NumFilteredPlayers)
|
||||
return a->m_Info.m_Latency > b->m_Info.m_Latency;
|
||||
if(a->m_Info.m_NumFilteredPlayers == 0 || b->m_Info.m_NumFilteredPlayers == 0)
|
||||
return a->m_Info.m_NumFilteredPlayers == 0;
|
||||
else if(a->m_Info.m_NumFilteredPlayers == 0 || b->m_Info.m_NumFilteredPlayers == 0 || a->m_Info.m_Latency / 100 == b->m_Info.m_Latency / 100)
|
||||
return a->m_Info.m_NumFilteredPlayers < b->m_Info.m_NumFilteredPlayers;
|
||||
else
|
||||
return a->m_Info.m_NumFilteredPlayers - (a->m_Info.m_Latency / 100) * MAX_CLIENTS < b->m_Info.m_NumFilteredPlayers - (b->m_Info.m_Latency / 100) * MAX_CLIENTS;
|
||||
return a->m_Info.m_Latency > b->m_Info.m_Latency;
|
||||
}
|
||||
|
||||
void CServerBrowser::Filter()
|
||||
|
|
Loading…
Reference in a new issue