MCPcopy Create free account
hub / github.com/ddnet/ddnet / Sort

Method Sort

src/engine/client/serverbrowser.cpp:633–661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

631}
632
633void CServerBrowser::Sort()
634{
635 // update number of filtered players
636 for(CServerEntry *pEntry : m_vpServerlist)
637 {
638 UpdateServerFilteredPlayers(&pEntry->m_Info);
639 }
640
641 // create filtered list
642 Filter();
643
644 // sort
645 if(g_Config.m_BrSortOrder == 2 && (g_Config.m_BrSort == IServerBrowser::SORT_NUMPLAYERS || g_Config.m_BrSort == IServerBrowser::SORT_PING))
646 std::stable_sort(m_vSortedServerlist.begin(), m_vSortedServerlist.end(), CSortWrap(this, &CServerBrowser::SortCompareNumPlayersAndPing));
647 else if(g_Config.m_BrSort == IServerBrowser::SORT_NAME)
648 std::stable_sort(m_vSortedServerlist.begin(), m_vSortedServerlist.end(), CSortWrap(this, &CServerBrowser::SortCompareName));
649 else if(g_Config.m_BrSort == IServerBrowser::SORT_PING)
650 std::stable_sort(m_vSortedServerlist.begin(), m_vSortedServerlist.end(), CSortWrap(this, &CServerBrowser::SortComparePing));
651 else if(g_Config.m_BrSort == IServerBrowser::SORT_MAP)
652 std::stable_sort(m_vSortedServerlist.begin(), m_vSortedServerlist.end(), CSortWrap(this, &CServerBrowser::SortCompareMap));
653 else if(g_Config.m_BrSort == IServerBrowser::SORT_NUMFRIENDS)
654 std::stable_sort(m_vSortedServerlist.begin(), m_vSortedServerlist.end(), CSortWrap(this, &CServerBrowser::SortCompareNumFriends));
655 else if(g_Config.m_BrSort == IServerBrowser::SORT_NUMPLAYERS)
656 std::stable_sort(m_vSortedServerlist.begin(), m_vSortedServerlist.end(), CSortWrap(this, &CServerBrowser::SortCompareNumPlayers));
657 else if(g_Config.m_BrSort == IServerBrowser::SORT_GAMETYPE)
658 std::stable_sort(m_vSortedServerlist.begin(), m_vSortedServerlist.end(), CSortWrap(this, &CServerBrowser::SortCompareGametype));
659
660 m_Sorthash = SortHash();
661}
662
663void CServerBrowser::RemoveRequest(CServerEntry *pEntry)
664{

Callers

nothing calls this directly

Calls 3

CSortWrapClass · 0.85
beginMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected