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
|
|
|
|
|
2011-03-16 11:37:41 +00:00
|
|
|
#include <engine/shared/protocol.h>
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
#include "kernel.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
Structure: CServerInfo
|
|
|
|
*/
|
|
|
|
class CServerInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/*
|
2011-03-20 14:33:49 +00:00
|
|
|
Structure: CInfoClient
|
2010-05-29 07:25:38 +00:00
|
|
|
*/
|
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;
|
2011-08-11 08:59:14 +00:00
|
|
|
|
2011-06-26 15:10:13 +00:00
|
|
|
int m_FriendState;
|
|
|
|
};
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
int m_SortedIndex;
|
|
|
|
int m_ServerIndex;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
NETADDR m_NetAddr;
|
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;
|
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;
|
|
|
|
int m_Favorite;
|
|
|
|
int m_Latency; // in ms
|
|
|
|
char m_aGameType[16];
|
|
|
|
char m_aName[64];
|
|
|
|
char m_aMap[32];
|
|
|
|
char m_aVersion[32];
|
2011-03-28 18:11:28 +00:00
|
|
|
char m_aAddress[NETADDR_MAXSTRSIZE];
|
2011-03-20 14:33:49 +00:00
|
|
|
CClient m_aClients[MAX_CLIENTS];
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class IServerBrowser : public IInterface
|
|
|
|
{
|
|
|
|
MACRO_INTERFACE("serverbrowser", 0)
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
enum{
|
|
|
|
SORT_NAME = 0,
|
|
|
|
SORT_PING,
|
|
|
|
SORT_MAP,
|
|
|
|
SORT_GAMETYPE,
|
|
|
|
SORT_NUMPLAYERS,
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
QUICK_SERVERNAME=1,
|
2011-03-18 16:59:48 +00:00
|
|
|
QUICK_PLAYER=2,
|
2010-05-29 07:25:38 +00:00
|
|
|
QUICK_MAPNAME=4,
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
TYPE_INTERNET = 0,
|
|
|
|
TYPE_LAN = 1,
|
|
|
|
TYPE_FAVORITES = 2,
|
2014-09-13 14:36:25 +00:00
|
|
|
TYPE_DDNET = 3,
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
SET_MASTER_ADD=1,
|
|
|
|
SET_FAV_ADD,
|
2014-09-13 14:36:25 +00:00
|
|
|
SET_DDNET_ADD,
|
2011-03-04 17:14:08 +00:00
|
|
|
SET_TOKEN
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
virtual void Refresh(int Type) = 0;
|
2010-11-17 11:43:24 +00:00
|
|
|
virtual bool IsRefreshing() const = 0;
|
2010-05-29 07:25:38 +00:00
|
|
|
virtual bool IsRefreshingMasters() 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
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
virtual int NumSortedServers() const = 0;
|
|
|
|
virtual const CServerInfo *SortedGet(int Index) const = 0;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
virtual bool IsFavorite(const NETADDR &Addr) const = 0;
|
|
|
|
virtual void AddFavorite(const NETADDR &Addr) = 0;
|
|
|
|
virtual void RemoveFavorite(const NETADDR &Addr) = 0;
|
2014-09-19 21:52:09 +00:00
|
|
|
|
|
|
|
virtual int NumDDNetCountries() = 0;
|
|
|
|
virtual int GetDDNetCountryFlag(int Index) = 0;
|
|
|
|
virtual const char *GetDDNetCountryName(int Index) = 0;
|
|
|
|
virtual void DDNetCountryFilterAdd(const char *pName) = 0;
|
|
|
|
virtual void DDNetCountryFilterRem(const char *pName) = 0;
|
|
|
|
virtual bool DDNetCountryFiltered(const char *pName) = 0;
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|