2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2010-05-29 07:25:38 +00:00
|
|
|
#ifndef ENGINE_SERVERBROWSER_H
|
|
|
|
#define ENGINE_SERVERBROWSER_H
|
|
|
|
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
#include <base/hash.h>
|
2023-12-11 14:40:09 +00:00
|
|
|
#include <base/system.h>
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
|
2020-06-18 16:29:27 +00:00
|
|
|
#include <engine/map.h>
|
2011-03-16 11:37:41 +00:00
|
|
|
#include <engine/shared/protocol.h>
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
#include "kernel.h"
|
|
|
|
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
#include <unordered_set>
|
2023-09-17 11:31:41 +00:00
|
|
|
#include <vector>
|
|
|
|
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
static constexpr const char *DDNET_INFO_FILE = "ddnet-info.json";
|
|
|
|
static constexpr const char *DDNET_INFO_URL = "https://info.ddnet.org/info";
|
2018-08-23 07:57:35 +00:00
|
|
|
|
2022-01-02 03:27:29 +00:00
|
|
|
class CUIElement;
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
class CServerInfo
|
|
|
|
{
|
|
|
|
public:
|
2018-07-11 20:46:04 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
LOC_UNKNOWN = 0,
|
|
|
|
LOC_AFRICA,
|
|
|
|
LOC_ASIA,
|
|
|
|
LOC_AUSTRALIA,
|
|
|
|
LOC_EUROPE,
|
|
|
|
LOC_NORTH_AMERICA,
|
|
|
|
LOC_SOUTH_AMERICA,
|
2021-04-24 13:48:27 +00:00
|
|
|
// Special case China because it has an exceptionally bad
|
|
|
|
// connection to the outside due to the Great Firewall of
|
|
|
|
// China:
|
|
|
|
// https://en.wikipedia.org/w/index.php?title=Great_Firewall&oldid=1019589632
|
|
|
|
LOC_CHINA,
|
2018-07-11 20:46:04 +00:00
|
|
|
NUM_LOCS,
|
|
|
|
};
|
|
|
|
|
2023-09-30 10:35:53 +00:00
|
|
|
enum EClientScoreKind
|
2022-10-11 19:52:27 +00:00
|
|
|
{
|
|
|
|
CLIENT_SCORE_KIND_UNSPECIFIED,
|
|
|
|
CLIENT_SCORE_KIND_POINTS,
|
|
|
|
CLIENT_SCORE_KIND_TIME,
|
|
|
|
CLIENT_SCORE_KIND_TIME_BACKCOMPAT,
|
|
|
|
};
|
|
|
|
|
2023-09-30 10:39:30 +00:00
|
|
|
enum ERankState
|
|
|
|
{
|
|
|
|
RANK_UNAVAILABLE,
|
|
|
|
RANK_RANKED,
|
|
|
|
RANK_UNRANKED,
|
|
|
|
};
|
|
|
|
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
MAX_COMMUNITY_ID_LENGTH = 32,
|
|
|
|
MAX_COMMUNITY_COUNTRY_LENGTH = 32,
|
|
|
|
MAX_COMMUNITY_TYPE_LENGTH = 32,
|
|
|
|
};
|
|
|
|
|
2011-03-20 14:33:49 +00:00
|
|
|
class CClient
|
2010-05-29 07:25:38 +00:00
|
|
|
{
|
|
|
|
public:
|
2011-03-16 11:37:41 +00:00
|
|
|
char m_aName[MAX_NAME_LENGTH];
|
|
|
|
char m_aClan[MAX_CLAN_LENGTH];
|
|
|
|
int m_Country;
|
2010-05-29 07:25:38 +00:00
|
|
|
int m_Score;
|
2011-03-20 14:33:49 +00:00
|
|
|
bool m_Player;
|
2023-09-22 21:26:09 +00:00
|
|
|
bool m_Afk;
|
2011-08-11 08:59:14 +00:00
|
|
|
|
2023-01-07 08:20:25 +00:00
|
|
|
// skin info
|
|
|
|
char m_aSkin[24 + 1];
|
|
|
|
bool m_CustomSkinColors;
|
|
|
|
int m_CustomSkinColorBody;
|
|
|
|
int m_CustomSkinColorFeet;
|
|
|
|
|
2011-06-26 15:10:13 +00:00
|
|
|
int m_FriendState;
|
|
|
|
};
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
int m_ServerIndex;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2017-03-29 10:56:13 +00:00
|
|
|
int m_Type;
|
2021-06-23 05:05:49 +00:00
|
|
|
uint64_t m_ReceivedPackets;
|
2017-03-29 10:56:13 +00:00
|
|
|
int m_NumReceivedClients;
|
|
|
|
|
2022-05-23 18:16:18 +00:00
|
|
|
int m_NumAddresses;
|
|
|
|
NETADDR m_aAddresses[MAX_SERVER_ADDRESSES];
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
int m_QuickSearchHit;
|
2011-06-26 15:10:13 +00:00
|
|
|
int m_FriendState;
|
2023-09-30 10:57:10 +00:00
|
|
|
int m_FriendNum;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2011-03-20 14:33:49 +00:00
|
|
|
int m_MaxClients;
|
|
|
|
int m_NumClients;
|
2010-05-29 07:25:38 +00:00
|
|
|
int m_MaxPlayers;
|
|
|
|
int m_NumPlayers;
|
|
|
|
int m_Flags;
|
2023-09-30 10:35:53 +00:00
|
|
|
EClientScoreKind m_ClientScoreKind;
|
2022-05-23 18:16:18 +00:00
|
|
|
TRISTATE m_Favorite;
|
|
|
|
TRISTATE m_FavoriteAllowPing;
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
char m_aCommunityId[MAX_COMMUNITY_ID_LENGTH];
|
|
|
|
char m_aCommunityCountry[MAX_COMMUNITY_COUNTRY_LENGTH];
|
|
|
|
char m_aCommunityType[MAX_COMMUNITY_TYPE_LENGTH];
|
2018-07-11 20:46:04 +00:00
|
|
|
int m_Location;
|
|
|
|
bool m_LatencyIsEstimated;
|
2010-05-29 07:25:38 +00:00
|
|
|
int m_Latency; // in ms
|
2023-09-30 10:39:30 +00:00
|
|
|
ERankState m_HasRank;
|
2010-05-29 07:25:38 +00:00
|
|
|
char m_aGameType[16];
|
|
|
|
char m_aName[64];
|
2020-06-18 16:29:27 +00:00
|
|
|
char m_aMap[MAX_MAP_LENGTH];
|
2017-03-29 10:56:13 +00:00
|
|
|
int m_MapCrc;
|
|
|
|
int m_MapSize;
|
2010-05-29 07:25:38 +00:00
|
|
|
char m_aVersion[32];
|
2022-05-23 18:16:18 +00:00
|
|
|
char m_aAddress[MAX_SERVER_ADDRESSES * NETADDR_MAXSTRSIZE];
|
2022-01-02 01:27:37 +00:00
|
|
|
CClient m_aClients[SERVERINFO_MAX_CLIENTS];
|
2023-09-17 11:18:49 +00:00
|
|
|
int m_NumFilteredPlayers;
|
2020-10-12 10:29:47 +00:00
|
|
|
|
2018-07-11 20:46:04 +00:00
|
|
|
static int EstimateLatency(int Loc1, int Loc2);
|
|
|
|
static bool ParseLocation(int *pResult, const char *pString);
|
2023-01-06 20:14:26 +00:00
|
|
|
void InfoToString(char *pBuffer, int BufferSize) const;
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
2023-09-17 11:31:41 +00:00
|
|
|
class CCommunityCountryServer
|
|
|
|
{
|
|
|
|
NETADDR m_Address;
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
char m_aTypeName[CServerInfo::MAX_COMMUNITY_TYPE_LENGTH];
|
2023-09-17 11:31:41 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
CCommunityCountryServer(NETADDR Address, const char *pTypeName) :
|
|
|
|
m_Address(Address)
|
|
|
|
{
|
|
|
|
str_copy(m_aTypeName, pTypeName);
|
|
|
|
}
|
|
|
|
|
|
|
|
NETADDR Address() const { return m_Address; }
|
|
|
|
const char *TypeName() const { return m_aTypeName; }
|
|
|
|
};
|
|
|
|
|
|
|
|
class CCommunityCountry
|
|
|
|
{
|
|
|
|
friend class CServerBrowser;
|
|
|
|
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
char m_aName[CServerInfo::MAX_COMMUNITY_COUNTRY_LENGTH];
|
2023-09-17 11:31:41 +00:00
|
|
|
int m_FlagId;
|
|
|
|
std::vector<CCommunityCountryServer> m_vServers;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CCommunityCountry(const char *pName, int FlagId) :
|
|
|
|
m_FlagId(FlagId)
|
|
|
|
{
|
|
|
|
str_copy(m_aName, pName);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *Name() const { return m_aName; }
|
|
|
|
int FlagId() const { return m_FlagId; }
|
|
|
|
const std::vector<CCommunityCountryServer> &Servers() const { return m_vServers; }
|
|
|
|
};
|
|
|
|
|
|
|
|
class CCommunityType
|
|
|
|
{
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
char m_aName[CServerInfo::MAX_COMMUNITY_TYPE_LENGTH];
|
2023-09-17 11:31:41 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
CCommunityType(const char *pName)
|
|
|
|
{
|
|
|
|
str_copy(m_aName, pName);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *Name() const { return m_aName; }
|
|
|
|
};
|
|
|
|
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
class CCommunityMap
|
|
|
|
{
|
|
|
|
char m_aName[MAX_MAP_LENGTH];
|
|
|
|
|
|
|
|
public:
|
|
|
|
CCommunityMap(const char *pName)
|
|
|
|
{
|
|
|
|
str_copy(m_aName, pName);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *Name() const { return m_aName; }
|
|
|
|
|
|
|
|
bool operator==(const CCommunityMap &Other) const
|
|
|
|
{
|
|
|
|
return str_comp(Name(), Other.Name()) == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(const CCommunityMap &Other) const
|
|
|
|
{
|
|
|
|
return !(*this == Other);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct SHash
|
|
|
|
{
|
|
|
|
size_t operator()(const CCommunityMap &Map) const
|
|
|
|
{
|
|
|
|
return str_quickhash(Map.Name());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-09-17 11:31:41 +00:00
|
|
|
class CCommunity
|
|
|
|
{
|
|
|
|
friend class CServerBrowser;
|
|
|
|
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
char m_aId[CServerInfo::MAX_COMMUNITY_ID_LENGTH];
|
2023-09-17 11:31:41 +00:00
|
|
|
char m_aName[64];
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
SHA256_DIGEST m_IconSha256;
|
Add icon URL, remove `servers-key`/`ranks-key` from community JSON
Previously:
```json
{
"ddnet": {
"name": "DDraceNetwork",
"servers-key": "servers",
"ranks-key": "maps",
"icon-sha256": "162313eeb954e34495ad03066fee1418ed3c963e76cc83dff993e1c7856c742b"
}
}
```
Now:
```json
[
{
"id": "ddnet",
"name": "DDraceNetwork",
"icon": {
"sha256": "162313eeb954e34495ad03066fee1418ed3c963e76cc83dff993e1c7856c742b",
"url": "https://info.ddnet.org/icons/ddnet.png"
},
"ranks": [
…
],
"servers": {
…
}
}
]
```
Special case `ddnet` to look for the `servers`, `maps` in the top-level
and `kog` to look for `servers-kog` in the top-level.
2023-11-18 20:52:51 +00:00
|
|
|
char m_aIconUrl[128];
|
2023-09-17 11:31:41 +00:00
|
|
|
std::vector<CCommunityCountry> m_vCountries;
|
|
|
|
std::vector<CCommunityType> m_vTypes;
|
Add icon URL, remove `servers-key`/`ranks-key` from community JSON
Previously:
```json
{
"ddnet": {
"name": "DDraceNetwork",
"servers-key": "servers",
"ranks-key": "maps",
"icon-sha256": "162313eeb954e34495ad03066fee1418ed3c963e76cc83dff993e1c7856c742b"
}
}
```
Now:
```json
[
{
"id": "ddnet",
"name": "DDraceNetwork",
"icon": {
"sha256": "162313eeb954e34495ad03066fee1418ed3c963e76cc83dff993e1c7856c742b",
"url": "https://info.ddnet.org/icons/ddnet.png"
},
"ranks": [
…
],
"servers": {
…
}
}
]
```
Special case `ddnet` to look for the `servers`, `maps` in the top-level
and `kog` to look for `servers-kog` in the top-level.
2023-11-18 20:52:51 +00:00
|
|
|
bool m_HasFinishes = false;
|
|
|
|
std::unordered_set<CCommunityMap, CCommunityMap::SHash> m_FinishedMaps;
|
2023-09-17 11:31:41 +00:00
|
|
|
|
|
|
|
public:
|
Add icon URL, remove `servers-key`/`ranks-key` from community JSON
Previously:
```json
{
"ddnet": {
"name": "DDraceNetwork",
"servers-key": "servers",
"ranks-key": "maps",
"icon-sha256": "162313eeb954e34495ad03066fee1418ed3c963e76cc83dff993e1c7856c742b"
}
}
```
Now:
```json
[
{
"id": "ddnet",
"name": "DDraceNetwork",
"icon": {
"sha256": "162313eeb954e34495ad03066fee1418ed3c963e76cc83dff993e1c7856c742b",
"url": "https://info.ddnet.org/icons/ddnet.png"
},
"ranks": [
…
],
"servers": {
…
}
}
]
```
Special case `ddnet` to look for the `servers`, `maps` in the top-level
and `kog` to look for `servers-kog` in the top-level.
2023-11-18 20:52:51 +00:00
|
|
|
CCommunity(const char *pId, const char *pName, SHA256_DIGEST IconSha256, const char *pIconUrl) :
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
m_IconSha256(IconSha256)
|
2023-09-17 11:31:41 +00:00
|
|
|
{
|
|
|
|
str_copy(m_aId, pId);
|
|
|
|
str_copy(m_aName, pName);
|
Add icon URL, remove `servers-key`/`ranks-key` from community JSON
Previously:
```json
{
"ddnet": {
"name": "DDraceNetwork",
"servers-key": "servers",
"ranks-key": "maps",
"icon-sha256": "162313eeb954e34495ad03066fee1418ed3c963e76cc83dff993e1c7856c742b"
}
}
```
Now:
```json
[
{
"id": "ddnet",
"name": "DDraceNetwork",
"icon": {
"sha256": "162313eeb954e34495ad03066fee1418ed3c963e76cc83dff993e1c7856c742b",
"url": "https://info.ddnet.org/icons/ddnet.png"
},
"ranks": [
…
],
"servers": {
…
}
}
]
```
Special case `ddnet` to look for the `servers`, `maps` in the top-level
and `kog` to look for `servers-kog` in the top-level.
2023-11-18 20:52:51 +00:00
|
|
|
str_copy(m_aIconUrl, pIconUrl);
|
2023-09-17 11:31:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *Id() const { return m_aId; }
|
|
|
|
const char *Name() const { return m_aName; }
|
Add icon URL, remove `servers-key`/`ranks-key` from community JSON
Previously:
```json
{
"ddnet": {
"name": "DDraceNetwork",
"servers-key": "servers",
"ranks-key": "maps",
"icon-sha256": "162313eeb954e34495ad03066fee1418ed3c963e76cc83dff993e1c7856c742b"
}
}
```
Now:
```json
[
{
"id": "ddnet",
"name": "DDraceNetwork",
"icon": {
"sha256": "162313eeb954e34495ad03066fee1418ed3c963e76cc83dff993e1c7856c742b",
"url": "https://info.ddnet.org/icons/ddnet.png"
},
"ranks": [
…
],
"servers": {
…
}
}
]
```
Special case `ddnet` to look for the `servers`, `maps` in the top-level
and `kog` to look for `servers-kog` in the top-level.
2023-11-18 20:52:51 +00:00
|
|
|
const char *IconUrl() const { return m_aIconUrl; }
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
const SHA256_DIGEST &IconSha256() const { return m_IconSha256; }
|
2023-09-17 11:31:41 +00:00
|
|
|
const std::vector<CCommunityCountry> &Countries() const { return m_vCountries; }
|
|
|
|
const std::vector<CCommunityType> &Types() const { return m_vTypes; }
|
Add tabs for favorite communities, separate country/type filters
Support adding up to three communities as favorites in the server browser. Favorites can be changed with favorite buttons which are shown in the community filter on the Internet and Favorites tabs. The commands `add_favorite_community` and `remove_favorite_community` are added to change the favorite communities via the console and for saving the favorite communities to the config file. For the favorite communities, additional tabs using the communities' icons are shown in the server browser next to the Internet, LAN and Favorites tabs. Each community tab shows only the servers from the respective community, hence the community filters UI is not shown on the community tabs but only on the Internet and Favorites tabs. The country and type filters on community tabs cover only the countries and types from the respective community. Favorite communities are added from left to right. When more than three favorite communities are added, the oldest (leftmost) favorite community will be removed from the list.
When starting the client for the first time, i.e. with `cl_show_welcome 1`, the DDNet tab will be created as the only favorite community and selected initially. The community, country and type filters are unset when starting for the first time, so the Internet tab now shows all servers per default.
When starting with a `ui_page` for a favorite community that is not configured, the page is reset to the Internet tab. This also affects those who upgrade from versions with the old DDNet and KoG tabs. The server browser is now also correctly updated when changing `ui_page` via the console.
Track country and type filters for every community separately, to avoid filters resetting when switching between community tabs or changing the community filter. The commands `add_excluded_community`, `remove_excluded_community`, `add_excluded_country`, `remove_excluded_country`, `add_excluded_type` and `remove_excluded_type` are added to change the exclusion filters via the console and for saving the exclusion filters to the config file.
Render community filters above the toolbox (filter, info and friends) tabs when on the Internet and Favorites tab, so this setting is more visible and can be changed also when the other toolbox tabs are selected.
Add icon for the none community, based on the tee country flag color. This icon is hard-coded in the client, as the none community also is, so fetching the icon from the server would be inconvenient. Load community icons already when rendering the menu instead of only when rendering the server browser, so the icons are immediately available when using the start menu.
Find tutorial server by searching for community type "Tutorial" instead of searching for "(Tutorial)" in the server name.
Avoid cleaning favorite communities and filters when there are no communities, i.e. when the DDNet info failed to be loaded or does not contain any communities, to avoid losing all favorite communities and filters in this case.
Closes #7774.
2024-01-21 10:06:25 +00:00
|
|
|
bool HasCountry(const char *pCountryName) const;
|
|
|
|
bool HasType(const char *pTypeName) const;
|
Add icon URL, remove `servers-key`/`ranks-key` from community JSON
Previously:
```json
{
"ddnet": {
"name": "DDraceNetwork",
"servers-key": "servers",
"ranks-key": "maps",
"icon-sha256": "162313eeb954e34495ad03066fee1418ed3c963e76cc83dff993e1c7856c742b"
}
}
```
Now:
```json
[
{
"id": "ddnet",
"name": "DDraceNetwork",
"icon": {
"sha256": "162313eeb954e34495ad03066fee1418ed3c963e76cc83dff993e1c7856c742b",
"url": "https://info.ddnet.org/icons/ddnet.png"
},
"ranks": [
…
],
"servers": {
…
}
}
]
```
Special case `ddnet` to look for the `servers`, `maps` in the top-level
and `kog` to look for `servers-kog` in the top-level.
2023-11-18 20:52:51 +00:00
|
|
|
bool HasRanks() const { return m_HasFinishes; }
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
CServerInfo::ERankState HasRank(const char *pMap) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
class IFilterList
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void Add(const char *pElement) = 0;
|
|
|
|
virtual void Remove(const char *pElement) = 0;
|
|
|
|
virtual void Clear() = 0;
|
|
|
|
virtual bool Empty() const = 0;
|
|
|
|
virtual bool Filtered(const char *pElement) const = 0;
|
2023-09-17 11:31:41 +00:00
|
|
|
};
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
class IServerBrowser : public IInterface
|
|
|
|
{
|
2023-11-28 20:46:03 +00:00
|
|
|
MACRO_INTERFACE("serverbrowser")
|
2010-05-29 07:25:38 +00:00
|
|
|
public:
|
|
|
|
/* Constants: Server Browser Sorting
|
|
|
|
SORT_NAME - Sort by name.
|
|
|
|
SORT_PING - Sort by ping.
|
|
|
|
SORT_MAP - Sort by map
|
|
|
|
SORT_GAMETYPE - Sort by game type. DM, TDM etc.
|
|
|
|
SORT_NUMPLAYERS - Sort after how many players there are on the server.
|
2024-03-03 01:01:28 +00:00
|
|
|
SORT_NUMFRIENDS - Sort after how many friends there are on the server.
|
2010-05-29 07:25:38 +00:00
|
|
|
*/
|
2020-09-26 19:41:58 +00:00
|
|
|
enum
|
|
|
|
{
|
2010-05-29 07:25:38 +00:00
|
|
|
SORT_NAME = 0,
|
|
|
|
SORT_PING,
|
|
|
|
SORT_MAP,
|
|
|
|
SORT_GAMETYPE,
|
|
|
|
SORT_NUMPLAYERS,
|
2024-03-03 01:01:28 +00:00
|
|
|
SORT_NUMFRIENDS,
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
QUICK_SERVERNAME = 1,
|
|
|
|
QUICK_PLAYER = 2,
|
|
|
|
QUICK_MAPNAME = 4,
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2023-09-20 14:57:08 +00:00
|
|
|
TYPE_INTERNET = 0,
|
|
|
|
TYPE_LAN,
|
|
|
|
TYPE_FAVORITES,
|
Add tabs for favorite communities, separate country/type filters
Support adding up to three communities as favorites in the server browser. Favorites can be changed with favorite buttons which are shown in the community filter on the Internet and Favorites tabs. The commands `add_favorite_community` and `remove_favorite_community` are added to change the favorite communities via the console and for saving the favorite communities to the config file. For the favorite communities, additional tabs using the communities' icons are shown in the server browser next to the Internet, LAN and Favorites tabs. Each community tab shows only the servers from the respective community, hence the community filters UI is not shown on the community tabs but only on the Internet and Favorites tabs. The country and type filters on community tabs cover only the countries and types from the respective community. Favorite communities are added from left to right. When more than three favorite communities are added, the oldest (leftmost) favorite community will be removed from the list.
When starting the client for the first time, i.e. with `cl_show_welcome 1`, the DDNet tab will be created as the only favorite community and selected initially. The community, country and type filters are unset when starting for the first time, so the Internet tab now shows all servers per default.
When starting with a `ui_page` for a favorite community that is not configured, the page is reset to the Internet tab. This also affects those who upgrade from versions with the old DDNet and KoG tabs. The server browser is now also correctly updated when changing `ui_page` via the console.
Track country and type filters for every community separately, to avoid filters resetting when switching between community tabs or changing the community filter. The commands `add_excluded_community`, `remove_excluded_community`, `add_excluded_country`, `remove_excluded_country`, `add_excluded_type` and `remove_excluded_type` are added to change the exclusion filters via the console and for saving the exclusion filters to the config file.
Render community filters above the toolbox (filter, info and friends) tabs when on the Internet and Favorites tab, so this setting is more visible and can be changed also when the other toolbox tabs are selected.
Add icon for the none community, based on the tee country flag color. This icon is hard-coded in the client, as the none community also is, so fetching the icon from the server would be inconvenient. Load community icons already when rendering the menu instead of only when rendering the server browser, so the icons are immediately available when using the start menu.
Find tutorial server by searching for community type "Tutorial" instead of searching for "(Tutorial)" in the server name.
Avoid cleaning favorite communities and filters when there are no communities, i.e. when the DDNet info failed to be loaded or does not contain any communities, to avoid losing all favorite communities and filters in this case.
Closes #7774.
2024-01-21 10:06:25 +00:00
|
|
|
TYPE_FAVORITE_COMMUNITY_1,
|
|
|
|
TYPE_FAVORITE_COMMUNITY_2,
|
|
|
|
TYPE_FAVORITE_COMMUNITY_3,
|
2023-09-20 14:57:08 +00:00
|
|
|
NUM_TYPES,
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
2023-09-17 11:31:41 +00:00
|
|
|
static constexpr const char *COMMUNITY_DDNET = "ddnet";
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
static constexpr const char *COMMUNITY_NONE = "none";
|
2023-09-17 11:31:41 +00:00
|
|
|
|
2022-09-25 12:37:24 +00:00
|
|
|
static constexpr const char *SEARCH_EXCLUDE_TOKEN = ";";
|
|
|
|
|
Add tabs for favorite communities, separate country/type filters
Support adding up to three communities as favorites in the server browser. Favorites can be changed with favorite buttons which are shown in the community filter on the Internet and Favorites tabs. The commands `add_favorite_community` and `remove_favorite_community` are added to change the favorite communities via the console and for saving the favorite communities to the config file. For the favorite communities, additional tabs using the communities' icons are shown in the server browser next to the Internet, LAN and Favorites tabs. Each community tab shows only the servers from the respective community, hence the community filters UI is not shown on the community tabs but only on the Internet and Favorites tabs. The country and type filters on community tabs cover only the countries and types from the respective community. Favorite communities are added from left to right. When more than three favorite communities are added, the oldest (leftmost) favorite community will be removed from the list.
When starting the client for the first time, i.e. with `cl_show_welcome 1`, the DDNet tab will be created as the only favorite community and selected initially. The community, country and type filters are unset when starting for the first time, so the Internet tab now shows all servers per default.
When starting with a `ui_page` for a favorite community that is not configured, the page is reset to the Internet tab. This also affects those who upgrade from versions with the old DDNet and KoG tabs. The server browser is now also correctly updated when changing `ui_page` via the console.
Track country and type filters for every community separately, to avoid filters resetting when switching between community tabs or changing the community filter. The commands `add_excluded_community`, `remove_excluded_community`, `add_excluded_country`, `remove_excluded_country`, `add_excluded_type` and `remove_excluded_type` are added to change the exclusion filters via the console and for saving the exclusion filters to the config file.
Render community filters above the toolbox (filter, info and friends) tabs when on the Internet and Favorites tab, so this setting is more visible and can be changed also when the other toolbox tabs are selected.
Add icon for the none community, based on the tee country flag color. This icon is hard-coded in the client, as the none community also is, so fetching the icon from the server would be inconvenient. Load community icons already when rendering the menu instead of only when rendering the server browser, so the icons are immediately available when using the start menu.
Find tutorial server by searching for community type "Tutorial" instead of searching for "(Tutorial)" in the server name.
Avoid cleaning favorite communities and filters when there are no communities, i.e. when the DDNet info failed to be loaded or does not contain any communities, to avoid losing all favorite communities and filters in this case.
Closes #7774.
2024-01-21 10:06:25 +00:00
|
|
|
virtual void Refresh(int Type, bool Force = false) = 0;
|
2018-07-11 20:46:04 +00:00
|
|
|
virtual bool IsGettingServerlist() const = 0;
|
2010-11-17 11:43:24 +00:00
|
|
|
virtual bool IsRefreshing() const = 0;
|
2010-10-30 16:56:57 +00:00
|
|
|
virtual int LoadingProgression() const = 0;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
virtual int NumServers() const = 0;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2018-08-21 07:03:29 +00:00
|
|
|
virtual int Players(const CServerInfo &Item) const = 0;
|
|
|
|
virtual int Max(const CServerInfo &Item) const = 0;
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
virtual int NumSortedServers() const = 0;
|
2023-10-01 18:17:55 +00:00
|
|
|
virtual int NumSortedPlayers() const = 0;
|
2010-05-29 07:25:38 +00:00
|
|
|
virtual const CServerInfo *SortedGet(int Index) const = 0;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2023-09-17 11:31:41 +00:00
|
|
|
virtual const std::vector<CCommunity> &Communities() const = 0;
|
|
|
|
virtual const CCommunity *Community(const char *pCommunityId) const = 0;
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
virtual std::vector<const CCommunity *> SelectedCommunities() const = 0;
|
Add tabs for favorite communities, separate country/type filters
Support adding up to three communities as favorites in the server browser. Favorites can be changed with favorite buttons which are shown in the community filter on the Internet and Favorites tabs. The commands `add_favorite_community` and `remove_favorite_community` are added to change the favorite communities via the console and for saving the favorite communities to the config file. For the favorite communities, additional tabs using the communities' icons are shown in the server browser next to the Internet, LAN and Favorites tabs. Each community tab shows only the servers from the respective community, hence the community filters UI is not shown on the community tabs but only on the Internet and Favorites tabs. The country and type filters on community tabs cover only the countries and types from the respective community. Favorite communities are added from left to right. When more than three favorite communities are added, the oldest (leftmost) favorite community will be removed from the list.
When starting the client for the first time, i.e. with `cl_show_welcome 1`, the DDNet tab will be created as the only favorite community and selected initially. The community, country and type filters are unset when starting for the first time, so the Internet tab now shows all servers per default.
When starting with a `ui_page` for a favorite community that is not configured, the page is reset to the Internet tab. This also affects those who upgrade from versions with the old DDNet and KoG tabs. The server browser is now also correctly updated when changing `ui_page` via the console.
Track country and type filters for every community separately, to avoid filters resetting when switching between community tabs or changing the community filter. The commands `add_excluded_community`, `remove_excluded_community`, `add_excluded_country`, `remove_excluded_country`, `add_excluded_type` and `remove_excluded_type` are added to change the exclusion filters via the console and for saving the exclusion filters to the config file.
Render community filters above the toolbox (filter, info and friends) tabs when on the Internet and Favorites tab, so this setting is more visible and can be changed also when the other toolbox tabs are selected.
Add icon for the none community, based on the tee country flag color. This icon is hard-coded in the client, as the none community also is, so fetching the icon from the server would be inconvenient. Load community icons already when rendering the menu instead of only when rendering the server browser, so the icons are immediately available when using the start menu.
Find tutorial server by searching for community type "Tutorial" instead of searching for "(Tutorial)" in the server name.
Avoid cleaning favorite communities and filters when there are no communities, i.e. when the DDNet info failed to be loaded or does not contain any communities, to avoid losing all favorite communities and filters in this case.
Closes #7774.
2024-01-21 10:06:25 +00:00
|
|
|
virtual std::vector<const CCommunity *> FavoriteCommunities() const = 0;
|
|
|
|
virtual std::vector<const CCommunity *> CurrentCommunities() const = 0;
|
|
|
|
virtual unsigned CurrentCommunitiesHash() const = 0;
|
|
|
|
|
|
|
|
virtual bool DDNetInfoAvailable() const = 0;
|
2024-02-04 16:09:37 +00:00
|
|
|
virtual SHA256_DIGEST DDNetInfoSha256() const = 0;
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
|
Add tabs for favorite communities, separate country/type filters
Support adding up to three communities as favorites in the server browser. Favorites can be changed with favorite buttons which are shown in the community filter on the Internet and Favorites tabs. The commands `add_favorite_community` and `remove_favorite_community` are added to change the favorite communities via the console and for saving the favorite communities to the config file. For the favorite communities, additional tabs using the communities' icons are shown in the server browser next to the Internet, LAN and Favorites tabs. Each community tab shows only the servers from the respective community, hence the community filters UI is not shown on the community tabs but only on the Internet and Favorites tabs. The country and type filters on community tabs cover only the countries and types from the respective community. Favorite communities are added from left to right. When more than three favorite communities are added, the oldest (leftmost) favorite community will be removed from the list.
When starting the client for the first time, i.e. with `cl_show_welcome 1`, the DDNet tab will be created as the only favorite community and selected initially. The community, country and type filters are unset when starting for the first time, so the Internet tab now shows all servers per default.
When starting with a `ui_page` for a favorite community that is not configured, the page is reset to the Internet tab. This also affects those who upgrade from versions with the old DDNet and KoG tabs. The server browser is now also correctly updated when changing `ui_page` via the console.
Track country and type filters for every community separately, to avoid filters resetting when switching between community tabs or changing the community filter. The commands `add_excluded_community`, `remove_excluded_community`, `add_excluded_country`, `remove_excluded_country`, `add_excluded_type` and `remove_excluded_type` are added to change the exclusion filters via the console and for saving the exclusion filters to the config file.
Render community filters above the toolbox (filter, info and friends) tabs when on the Internet and Favorites tab, so this setting is more visible and can be changed also when the other toolbox tabs are selected.
Add icon for the none community, based on the tee country flag color. This icon is hard-coded in the client, as the none community also is, so fetching the icon from the server would be inconvenient. Load community icons already when rendering the menu instead of only when rendering the server browser, so the icons are immediately available when using the start menu.
Find tutorial server by searching for community type "Tutorial" instead of searching for "(Tutorial)" in the server name.
Avoid cleaning favorite communities and filters when there are no communities, i.e. when the DDNet info failed to be loaded or does not contain any communities, to avoid losing all favorite communities and filters in this case.
Closes #7774.
2024-01-21 10:06:25 +00:00
|
|
|
virtual IFilterList &FavoriteCommunitiesFilter() = 0;
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
virtual IFilterList &CommunitiesFilter() = 0;
|
|
|
|
virtual IFilterList &CountriesFilter() = 0;
|
|
|
|
virtual IFilterList &TypesFilter() = 0;
|
Add tabs for favorite communities, separate country/type filters
Support adding up to three communities as favorites in the server browser. Favorites can be changed with favorite buttons which are shown in the community filter on the Internet and Favorites tabs. The commands `add_favorite_community` and `remove_favorite_community` are added to change the favorite communities via the console and for saving the favorite communities to the config file. For the favorite communities, additional tabs using the communities' icons are shown in the server browser next to the Internet, LAN and Favorites tabs. Each community tab shows only the servers from the respective community, hence the community filters UI is not shown on the community tabs but only on the Internet and Favorites tabs. The country and type filters on community tabs cover only the countries and types from the respective community. Favorite communities are added from left to right. When more than three favorite communities are added, the oldest (leftmost) favorite community will be removed from the list.
When starting the client for the first time, i.e. with `cl_show_welcome 1`, the DDNet tab will be created as the only favorite community and selected initially. The community, country and type filters are unset when starting for the first time, so the Internet tab now shows all servers per default.
When starting with a `ui_page` for a favorite community that is not configured, the page is reset to the Internet tab. This also affects those who upgrade from versions with the old DDNet and KoG tabs. The server browser is now also correctly updated when changing `ui_page` via the console.
Track country and type filters for every community separately, to avoid filters resetting when switching between community tabs or changing the community filter. The commands `add_excluded_community`, `remove_excluded_community`, `add_excluded_country`, `remove_excluded_country`, `add_excluded_type` and `remove_excluded_type` are added to change the exclusion filters via the console and for saving the exclusion filters to the config file.
Render community filters above the toolbox (filter, info and friends) tabs when on the Internet and Favorites tab, so this setting is more visible and can be changed also when the other toolbox tabs are selected.
Add icon for the none community, based on the tee country flag color. This icon is hard-coded in the client, as the none community also is, so fetching the icon from the server would be inconvenient. Load community icons already when rendering the menu instead of only when rendering the server browser, so the icons are immediately available when using the start menu.
Find tutorial server by searching for community type "Tutorial" instead of searching for "(Tutorial)" in the server name.
Avoid cleaning favorite communities and filters when there are no communities, i.e. when the DDNet info failed to be loaded or does not contain any communities, to avoid losing all favorite communities and filters in this case.
Closes #7774.
2024-01-21 10:06:25 +00:00
|
|
|
virtual const IFilterList &FavoriteCommunitiesFilter() const = 0;
|
Add community server filter and icons, remove DDNet and KoG tabs
Remove the DDNet and KoG tabs and replace them with a community filter, which works like the country and type filters. Community information (ID, name, icon SHA256, countries, types, servers, ranked maps) is loaded dynamically from the DDNet info json.
The official checkmark icon is replaced with community icons. The icons are downloaded to the `communityicons` folder in the config directory from a URL specified in the DDNet info json. The icons are only re-downloaded when their SHA256 has changed.
Per default, the Internet tab with all communities is selected. When starting the client for the first time, only the DDNet community is selected. The community, country and type filters can also be used on the Favorites tab now. The LAN tab remains unchanged.
The country and type filters are refactored. Previously, using these filters changed the total number of servers and players that were displayed, as the filter was implemented as a separate step. Now the community, country and type filters work like the other browser filters. This also has the benefit that the server list and DDNet info json are not reloaded each time these filters are changed, as updating the local filtering/sorting is enough now.
The check for finished maps is made more efficient by using an `std::unordered_set` instead of linear search.
Closes #5654.
2023-08-28 20:08:51 +00:00
|
|
|
virtual const IFilterList &CommunitiesFilter() const = 0;
|
|
|
|
virtual const IFilterList &CountriesFilter() const = 0;
|
|
|
|
virtual const IFilterList &TypesFilter() const = 0;
|
|
|
|
virtual void CleanFilters() = 0;
|
2014-12-14 15:45:18 +00:00
|
|
|
|
2015-05-11 19:51:06 +00:00
|
|
|
virtual int GetCurrentType() = 0;
|
2022-02-21 00:04:49 +00:00
|
|
|
virtual const char *GetTutorialServer() = 0;
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|