| 834 | } |
| 835 | |
| 836 | CServerBrowser::CServerEntry *CServerBrowser::Add(const NETADDR *pAddrs, int NumAddrs) |
| 837 | { |
| 838 | // create new pEntry |
| 839 | CServerEntry *pEntry = m_ServerlistHeap.Allocate<CServerEntry>(); |
| 840 | mem_zero(pEntry, sizeof(CServerEntry)); |
| 841 | |
| 842 | // set the info |
| 843 | mem_copy(pEntry->m_Info.m_aAddresses, pAddrs, NumAddrs * sizeof(pAddrs[0])); |
| 844 | pEntry->m_Info.m_NumAddresses = NumAddrs; |
| 845 | |
| 846 | pEntry->m_Info.m_Latency = 999; |
| 847 | pEntry->m_Info.m_HasRank = CServerInfo::RANK_UNAVAILABLE; |
| 848 | ServerBrowserFormatAddresses(pEntry->m_Info.m_aAddress, sizeof(pEntry->m_Info.m_aAddress), pEntry->m_Info.m_aAddresses, pEntry->m_Info.m_NumAddresses); |
| 849 | UpdateServerCommunity(&pEntry->m_Info); |
| 850 | str_copy(pEntry->m_Info.m_aName, pEntry->m_Info.m_aAddress, sizeof(pEntry->m_Info.m_aName)); |
| 851 | |
| 852 | // check if it's a favorite |
| 853 | pEntry->m_Info.m_Favorite = m_pFavorites->IsFavorite(pEntry->m_Info.m_aAddresses, pEntry->m_Info.m_NumAddresses); |
| 854 | pEntry->m_Info.m_FavoriteAllowPing = m_pFavorites->IsPingAllowed(pEntry->m_Info.m_aAddresses, pEntry->m_Info.m_NumAddresses); |
| 855 | |
| 856 | int ServerIndex = m_vpServerlist.size(); |
| 857 | for(int i = 0; i < NumAddrs; i++) |
| 858 | { |
| 859 | m_ByAddr[pAddrs[i]] = ServerIndex; |
| 860 | } |
| 861 | |
| 862 | // add to list |
| 863 | pEntry->m_Info.m_ServerIndex = ServerIndex; |
| 864 | if(m_vpServerlist.capacity() == 0) |
| 865 | { |
| 866 | m_vpServerlist.reserve(128); |
| 867 | } |
| 868 | m_vpServerlist.push_back(pEntry); |
| 869 | |
| 870 | return pEntry; |
| 871 | } |
| 872 | |
| 873 | CServerBrowser::CServerEntry *CServerBrowser::ReplaceEntry(CServerEntry *pEntry, const NETADDR *pAddrs, int NumAddrs) |
| 874 | { |
no test coverage detected