UFO: Alien Invasion
|
Serverlist management for multiplayer. More...
#include "../../cl_shared.h"
#include "../cl_game.h"
#include "../../../shared/parse.h"
#include "../../ui/ui_data.h"
#include "../../../shared/infostring.h"
#include "mp_serverlist.h"
#include "mp_callbacks.h"
Go to the source code of this file.
Macros | |
#define | MAX_SERVERLIST 128 |
#define | SERVERQUERYTIMEOUT 40000 |
Enumerations | |
enum | serverListStatus_t { SERVERLIST_SHOWALL, SERVERLIST_HIDEFULL, SERVERLIST_HIDEEMPTY } |
Functions | |
static bool | GAME_MP_ProcessPingReply (serverList_t *server, const char *msg) |
Parsed the server ping response. More... | |
static bool | GAME_MP_ShowServer (const serverList_t *server) |
Perform the server filtering. More... | |
static void | GAME_MP_PingServerCallback (struct net_stream *s) |
static void | GAME_MP_PingServer (serverList_t *server) |
Pings all servers in serverList. More... | |
static void | GAME_MP_PrintServerList_f (void) |
Prints all the servers on the list to game console. More... | |
static void | GAME_MP_AddServerToList (const char *node, const char *service) |
Adds a server to the serverlist cache. More... | |
void | GAME_MP_ParseTeamInfoMessage (dbuffer *msg) |
Team selection text. More... | |
static void | GAME_MP_ParseServerInfoMessage (dbuffer *msg, const char *hostname) |
Serverbrowser text. More... | |
static void | GAME_MP_ServerInfoCallback (struct net_stream *s) |
static void | GAME_MP_QueryMasterServerThread (const char *responseBuf, void *userdata) |
static void | GAME_MP_ServerListDiscoveryCallback (struct datagram_socket *s, const char *buf, int len, struct sockaddr *from) |
static void | GAME_MP_BookmarkAdd_f (void) |
Add a new bookmark. More... | |
static void | GAME_MP_ServerInfo_f (void) |
static void | GAME_MP_ServerListClick_f (void) |
Callback for bookmark nodes in multiplayer menu (mp_bookmarks) More... | |
void | GAME_MP_PingServers_f (void) |
The first function called when entering the multiplayer menu, then CL_Frame takes over. More... | |
void | GAME_MP_ServerListInit (const cgame_import_t *import) |
void | GAME_MP_ServerListShutdown (void) |
Variables | |
static const cgame_import_t * | cgi |
static serverList_t | serverList [MAX_SERVERLIST] |
serverList_t * | selectedServer |
static char | serverText [1024] |
static int | serverListLength |
static int | serverListPos |
static cvar_t * | cl_serverlist |
static struct datagram_socket * | netDatagramSocket |
static char | serverInfoText [1024] |
static char | userInfoText [256] |
static bool | serversAlreadyQueried = false |
static int | lastServerQuery = 0 |
static const cmdList_t | serverListCmds [] |
Serverlist management for multiplayer.
Definition in file mp_serverlist.cpp.
#define MAX_SERVERLIST 128 |
Definition at line 34 of file mp_serverlist.cpp.
Referenced by GAME_MP_AddServerToList(), and GAME_MP_QueryMasterServerThread().
#define SERVERQUERYTIMEOUT 40000 |
ms until the server query timed out
Definition at line 524 of file mp_serverlist.cpp.
Referenced by GAME_MP_PingServers_f().
enum serverListStatus_t |
Enumerator | |
---|---|
SERVERLIST_SHOWALL | |
SERVERLIST_HIDEFULL | |
SERVERLIST_HIDEEMPTY |
Definition at line 86 of file mp_serverlist.cpp.
|
static |
Adds a server to the serverlist cache.
Definition at line 184 of file mp_serverlist.cpp.
References GAME_MP_PingServer(), cgame_import_s::GAME_StrDup(), i, MAX_SERVERLIST, serverList_s::node, OBJZERO, Q_streq, serverListLength, and serverList_s::service.
Referenced by GAME_MP_QueryMasterServerThread(), and GAME_MP_ServerListDiscoveryCallback().
Add a new bookmark.
bookmarks are saved in cvar adr[0-15]
Definition at line 433 of file mp_serverlist.cpp.
References _, cgame_import_s::Cmd_Argv(), cgame_import_s::Cvar_GetString(), cgame_import_s::Cvar_Set(), i, MAX_BOOKMARKS, and va().
Serverbrowser text.
Definition at line 275 of file mp_serverlist.cpp.
References _, Com_Parse(), Com_sprintf(), cgame_import_s::Cvar_Set(), DEBUG_CLIENT, Info_BoolForKey(), Info_ValueForKey(), MAX_INFO_STRING, Q_strcat(), Q_strncpyz(), Q_strnull(), S_COLOR_GREEN, serverInfoText, TEXT_LIST, TEXT_STANDARD, and userInfoText.
Referenced by GAME_MP_ServerInfoCallback().
Team selection text.
This function fills the multiplayer_selectteam menu with content
Definition at line 208 of file mp_serverlist.cpp.
References _, DEBUG_CLIENT, Info_IntegerForKey(), Info_ValueForKey(), MAX_TEAMS, teamData_s::maxPlayersPerTeam, teamData_s::maxteams, OBJZERO, TEAM_NO_ACTIVE, teamData_s::teamCount, teamData, TEXT_MULTIPLAYER_USERLIST, TEXT_MULTIPLAYER_USERTEAM, user, and va().
Referenced by GAME_MP_HandleServerCommand().
|
static |
Pings all servers in serverList.
Definition at line 153 of file mp_serverlist.cpp.
References DEBUG_CLIENT, GAME_MP_PingServerCallback(), cgame_import_s::NET_Connect(), serverList_s::node, PROTOCOL_VERSION, serverList_s::service, and SV_CMD_INFO.
Referenced by GAME_MP_AddServerToList().
|
static |
Definition at line 109 of file mp_serverlist.cpp.
References serverList_s::clients, DEBUG_CLIENT, GAME_MP_ProcessPingReply(), GAME_MP_ShowServer(), serverList_s::gametype, serverList_s::mapname, cgame_import_s::NET_ReadMsg(), cgame_import_s::NET_StreamGetData(), Q_strcat(), serverList_s::serverListPos, serverListPos, serverText, serverList_s::sv_hostname, serverList_s::sv_maxclients, and svc_oob.
Referenced by GAME_MP_PingServer().
The first function called when entering the multiplayer menu, then CL_Frame takes over.
Definition at line 531 of file mp_serverlist.cpp.
References cgame_import_s::Cmd_Argv(), DEBUG_CLIENT, DOUBLEQUOTE, GAME_MP_QueryMasterServerThread(), GAME_MP_ServerListDiscoveryCallback(), i, lastServerQuery, cgame_import_s::NET_DatagramSocketNew(), OBJZERO, PORT_CLIENT, PORT_SERVER, Q_streq, serverListLength, serverListPos, SERVERQUERYTIMEOUT, serversAlreadyQueried, serverText, and TEXT_LIST.
Prints all the servers on the list to game console.
Definition at line 169 of file mp_serverlist.cpp.
References i, serverList_s::node, serverList_s::pinged, serverListLength, and serverList_s::service.
|
static |
Parsed the server ping response.
[out] | server | The server data to store the parsed information in |
[in] | msg | The ping response with the server information to parse |
true
if the server is compatible, msg
is not null
and the server wasn't pinged already, false
otherwise Definition at line 55 of file mp_serverlist.cpp.
References serverList_s::clients, Com_DPrintf(), DEBUG_CLIENT, serverList_s::gametype, Info_IntegerForKey(), Info_ValueForKey(), serverList_s::mapname, serverList_s::pinged, PROTOCOL_VERSION, Q_streq, Q_strncpyz(), serverList_s::sv_dedicated, serverList_s::sv_hostname, serverList_s::sv_maxclients, UFO_VERSION, and serverList_s::version.
Referenced by GAME_MP_PingServerCallback().
Definition at line 376 of file mp_serverlist.cpp.
References Com_DPrintf(), Com_Parse(), DEBUG_CLIENT, GAME_MP_AddServerToList(), i, MAX_SERVERLIST, MAX_VAR, and Q_strncpyz().
Referenced by GAME_MP_PingServers_f().
Definition at line 461 of file mp_serverlist.cpp.
References cgame_import_s::Cmd_Argv(), cgame_import_s::Cvar_GetString(), DOUBLEQUOTE, GAME_MP_ServerInfoCallback(), cgame_import_s::NET_Connect(), serverList_s::node, port, PORT_SERVER, PROTOCOL_VERSION, serverList_s::service, and SV_CMD_STATUS.
|
static |
Definition at line 354 of file mp_serverlist.cpp.
References GAME_MP_ParseServerInfoMessage(), cgame_import_s::NET_ReadMsg(), cgame_import_s::NET_StreamPeerToName(), Q_streq, and svc_oob.
Referenced by GAME_MP_ServerInfo_f().
Callback for bookmark nodes in multiplayer menu (mp_bookmarks)
Definition at line 498 of file mp_serverlist.cpp.
References cgame_import_s::Cmd_Argv(), i, serverInfoText, serverListLength, serverListPos, and TEXT_STANDARD.
|
static |
Definition at line 417 of file mp_serverlist.cpp.
References GAME_MP_AddServerToList(), and MAX_VAR.
Referenced by GAME_MP_PingServers_f().
void GAME_MP_ServerListInit | ( | const cgame_import_t * | import | ) |
Definition at line 586 of file mp_serverlist.cpp.
References CVAR_ARCHIVE, cgame_import_s::Cvar_Get(), i, MAX_BOOKMARKS, and va().
Referenced by GAME_MP_InitStartup().
Definition at line 597 of file mp_serverlist.cpp.
Referenced by GAME_MP_Shutdown().
|
inlinestatic |
Perform the server filtering.
[in] | server | The server data |
true
if the server should be visible for the current filter settings, false
otherwise Definition at line 97 of file mp_serverlist.cpp.
References serverList_s::clients, cvar_s::integer, SERVERLIST_HIDEEMPTY, SERVERLIST_HIDEFULL, SERVERLIST_SHOWALL, and serverList_s::sv_maxclients.
Referenced by GAME_MP_PingServerCallback().
|
static |
Definition at line 36 of file mp_serverlist.cpp.
|
static |
Definition at line 43 of file mp_serverlist.cpp.
|
static |
Definition at line 522 of file mp_serverlist.cpp.
Referenced by GAME_MP_PingServers_f().
|
static |
Definition at line 44 of file mp_serverlist.cpp.
serverList_t* selectedServer |
Definition at line 39 of file mp_serverlist.cpp.
Referenced by GAME_MP_Connect_f().
|
static |
Definition at line 264 of file mp_serverlist.cpp.
Referenced by GAME_MP_ParseServerInfoMessage(), and GAME_MP_ServerListClick_f().
|
static |
Definition at line 38 of file mp_serverlist.cpp.
|
static |
Definition at line 578 of file mp_serverlist.cpp.
|
static |
Definition at line 41 of file mp_serverlist.cpp.
Referenced by GAME_MP_AddServerToList(), GAME_MP_PingServers_f(), GAME_MP_PrintServerList_f(), and GAME_MP_ServerListClick_f().
|
static |
Definition at line 42 of file mp_serverlist.cpp.
Referenced by GAME_MP_PingServerCallback(), GAME_MP_PingServers_f(), and GAME_MP_ServerListClick_f().
|
static |
this is true if pingservers was already executed
Definition at line 521 of file mp_serverlist.cpp.
Referenced by GAME_MP_PingServers_f().
|
static |
Definition at line 40 of file mp_serverlist.cpp.
Referenced by GAME_MP_PingServerCallback(), and GAME_MP_PingServers_f().
|
static |
Definition at line 265 of file mp_serverlist.cpp.
Referenced by GAME_MP_ParseServerInfoMessage().