| 723 | } |
| 724 | |
| 725 | void CServerBrowser::SetInfo(CServerEntry *pEntry, const CServerInfo &Info) const |
| 726 | { |
| 727 | const CServerInfo TmpInfo = pEntry->m_Info; |
| 728 | pEntry->m_Info = Info; |
| 729 | pEntry->m_Info.m_Favorite = TmpInfo.m_Favorite; |
| 730 | pEntry->m_Info.m_FavoriteAllowPing = TmpInfo.m_FavoriteAllowPing; |
| 731 | pEntry->m_Info.m_ServerIndex = TmpInfo.m_ServerIndex; |
| 732 | mem_copy(pEntry->m_Info.m_aAddresses, TmpInfo.m_aAddresses, sizeof(pEntry->m_Info.m_aAddresses)); |
| 733 | pEntry->m_Info.m_NumAddresses = TmpInfo.m_NumAddresses; |
| 734 | ServerBrowserFormatAddresses(pEntry->m_Info.m_aAddress, sizeof(pEntry->m_Info.m_aAddress), pEntry->m_Info.m_aAddresses, pEntry->m_Info.m_NumAddresses); |
| 735 | str_copy(pEntry->m_Info.m_aCommunityId, TmpInfo.m_aCommunityId); |
| 736 | str_copy(pEntry->m_Info.m_aCommunityCountry, TmpInfo.m_aCommunityCountry); |
| 737 | str_copy(pEntry->m_Info.m_aCommunityType, TmpInfo.m_aCommunityType); |
| 738 | UpdateServerRank(&pEntry->m_Info); |
| 739 | |
| 740 | if(pEntry->m_Info.m_ClientScoreKind == CServerInfo::CLIENT_SCORE_KIND_UNSPECIFIED) |
| 741 | { |
| 742 | if(str_find_nocase(pEntry->m_Info.m_aGameType, "race") || str_find_nocase(pEntry->m_Info.m_aGameType, "fastcap")) |
| 743 | { |
| 744 | pEntry->m_Info.m_ClientScoreKind = CServerInfo::CLIENT_SCORE_KIND_TIME_BACKCOMPAT; |
| 745 | } |
| 746 | else |
| 747 | { |
| 748 | pEntry->m_Info.m_ClientScoreKind = CServerInfo::CLIENT_SCORE_KIND_POINTS; |
| 749 | } |
| 750 | } |
| 751 | |
| 752 | class CPlayerScoreNameLess |
| 753 | { |
| 754 | const int m_ScoreKind; |
| 755 | |
| 756 | public: |
| 757 | CPlayerScoreNameLess(int ClientScoreKind) : |
| 758 | m_ScoreKind(ClientScoreKind) |
| 759 | { |
| 760 | } |
| 761 | |
| 762 | bool operator()(const CServerInfo::CClient &Client0, const CServerInfo::CClient &Client1) const |
| 763 | { |
| 764 | // Sort players before non players |
| 765 | if(Client0.m_Player && !Client1.m_Player) |
| 766 | return true; |
| 767 | if(!Client0.m_Player && Client1.m_Player) |
| 768 | return false; |
| 769 | |
| 770 | int Score0 = Client0.m_Score; |
| 771 | int Score1 = Client1.m_Score; |
| 772 | |
| 773 | if(m_ScoreKind == CServerInfo::CLIENT_SCORE_KIND_TIME || m_ScoreKind == CServerInfo::CLIENT_SCORE_KIND_TIME_BACKCOMPAT) |
| 774 | { |
| 775 | // Sort unfinished (-9999) and still connecting players (-1) after others |
| 776 | if(Score0 < 0 && Score1 >= 0) |
| 777 | return false; |
| 778 | if(Score0 >= 0 && Score1 < 0) |
| 779 | return true; |
| 780 | } |
| 781 | |
| 782 | if(Score0 != Score1) |
nothing calls this directly
no test coverage detected