| 1696 | } |
| 1697 | |
| 1698 | const char *CServerBrowser::GetTutorialServer() |
| 1699 | { |
| 1700 | const CCommunity *pCommunity = Community(COMMUNITY_DDNET); |
| 1701 | if(pCommunity == nullptr) |
| 1702 | return nullptr; |
| 1703 | |
| 1704 | const char *pBestAddr = nullptr; |
| 1705 | int BestLatency = std::numeric_limits<int>::max(); |
| 1706 | for(const auto &Country : pCommunity->Countries()) |
| 1707 | { |
| 1708 | for(const auto &Server : Country.Servers()) |
| 1709 | { |
| 1710 | if(str_comp(Server.TypeName(), "Tutorial") != 0) |
| 1711 | continue; |
| 1712 | const CServerEntry *pEntry = Find(Server.Address()); |
| 1713 | if(!pEntry) |
| 1714 | continue; |
| 1715 | if(pEntry->m_Info.m_NumPlayers > pEntry->m_Info.m_MaxPlayers - 10) |
| 1716 | continue; |
| 1717 | if(pEntry->m_Info.m_Latency >= BestLatency) |
| 1718 | continue; |
| 1719 | BestLatency = pEntry->m_Info.m_Latency; |
| 1720 | pBestAddr = pEntry->m_Info.m_aAddress; |
| 1721 | } |
| 1722 | } |
| 1723 | return pBestAddr; |
| 1724 | } |
| 1725 | |
| 1726 | bool CServerBrowser::IsRefreshing() const |
| 1727 | { |
no test coverage detected