| 631 | } |
| 632 | |
| 633 | void 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 | |
| 663 | void CServerBrowser::RemoveRequest(CServerEntry *pEntry) |
| 664 | { |