UFO: Alien Invasion
Loading...
Searching...
No Matches
mp_callbacks.cpp File Reference

Serverlist menu callbacks for multiplayer. More...

#include "../../cl_shared.h"
#include "../../ui/ui_data.h"
#include "mp_callbacks.h"
#include "mp_serverlist.h"
#include "../cl_game.h"
Include dependency graph for mp_callbacks.cpp:

Go to the source code of this file.

Functions

static void GAME_MP_Connect_f (void)
static void GAME_MP_RconCallback (struct net_stream *s)
bool GAME_MP_Rcon (const char *password, const char *command)
 Sends an rcon command to the gameserver that the user is currently connected to, or if this is not the case, the gameserver that is specified in the cvar rcon_address.
static void GAME_MP_Rcon_f (void)
static void GAME_MP_StartGame_f (void)
static void GAME_MP_Disconnect_f (void)
 Binding for disconnect console command.
static void GAME_MP_Reconnect_f (void)
 The server is changing levels.
static void GAME_MP_SelectTeam_Init_f (void)
 Send the SV_CMD_TEAMINFO command to server.
static bool GAME_MP_SetTeamNum (int teamnum)
static void GAME_MP_TeamNum_f (void)
 Increase or decrease the teamnum.
static int GAME_MP_CompleteNetworkAddress (const char *partial, const char **match)
 Autocomplete function for some network functions.
static void GAME_MP_InitUI_f (void)
void GAME_MP_CallbacksInit (const cgame_import_t *import)
void GAME_MP_CallbacksShutdown (void)

Variables

static const cgame_import_tcgi
teamData_t teamData
cvar_trcon_client_password
cvar_tcl_maxsoldiersperteam
cvar_tcl_maxsoldiersperplayer
cvar_tcl_roundtimelimit
static cvar_trcon_address
static cvar_tinfo_password
static const cmdList_t mpCallbacks []

Detailed Description

Serverlist menu callbacks for multiplayer.

Definition in file mp_callbacks.cpp.

Function Documentation

◆ GAME_MP_CallbacksInit()

◆ GAME_MP_CallbacksShutdown()

void GAME_MP_CallbacksShutdown ( void )

Definition at line 318 of file mp_callbacks.cpp.

References cgi, and mpCallbacks.

Referenced by GAME_MP_Shutdown().

◆ GAME_MP_CompleteNetworkAddress()

int GAME_MP_CompleteNetworkAddress ( const char * partial,
const char ** match )
static

Autocomplete function for some network functions.

See also
Cmd_AddParamCompleteFunction
Todo
Extend this for all the servers on the server browser list

Definition at line 264 of file mp_callbacks.cpp.

References cgi, i, MAX_BOOKMARKS, and va().

Referenced by GAME_MP_CallbacksInit().

◆ GAME_MP_Connect_f()

void GAME_MP_Connect_f ( void )
static

Definition at line 42 of file mp_callbacks.cpp.

References _, ca_connecting, cgi, DOUBLEQUOTE, MAX_VAR, PORT_SERVER, Q_strncpyz(), and selectedServer.

◆ GAME_MP_Disconnect_f()

void GAME_MP_Disconnect_f ( void )
static

Binding for disconnect console command.

Definition at line 173 of file mp_callbacks.cpp.

References cgi.

◆ GAME_MP_InitUI_f()

void GAME_MP_InitUI_f ( void )
static

Definition at line 277 of file mp_callbacks.cpp.

References _, cgi, i, gametype_t::id, gametype_t::name, and TEXT_LIST.

◆ GAME_MP_Rcon()

bool GAME_MP_Rcon ( const char * password,
const char * command )

Sends an rcon command to the gameserver that the user is currently connected to, or if this is not the case, the gameserver that is specified in the cvar rcon_address.

Returns
true if the command was send, false otherwise.

Definition at line 112 of file mp_callbacks.cpp.

References ca_connected, cgi, DOUBLEQUOTE, GAME_MP_RconCallback(), password, port, PORT_SERVER, Q_strnull(), rcon_address, and SV_CMD_RCON.

Referenced by GAME_MP_Rcon_f().

◆ GAME_MP_Rcon_f()

void GAME_MP_Rcon_f ( void )
static

Send the rest of the command line over as an unconnected command.

Definition at line 146 of file mp_callbacks.cpp.

References cgi, Com_Printf(), GAME_MP_Rcon(), and rcon_client_password.

◆ GAME_MP_RconCallback()

void GAME_MP_RconCallback ( struct net_stream * s)
static

Definition at line 84 of file mp_callbacks.cpp.

References cgi, Q_streq, and svc_oob.

Referenced by GAME_MP_Rcon().

◆ GAME_MP_Reconnect_f()

void GAME_MP_Reconnect_f ( void )
static

The server is changing levels.

Definition at line 182 of file mp_callbacks.cpp.

References ca_connecting, and cgi.

◆ GAME_MP_SelectTeam_Init_f()

void GAME_MP_SelectTeam_Init_f ( void )
static

Send the SV_CMD_TEAMINFO command to server.

See also
CL_ParseTeamInfoMessage
SV_ConnectionlessPacket

Definition at line 201 of file mp_callbacks.cpp.

References _, cgi, PROTOCOL_VERSION, SV_CMD_TEAMINFO, and TEXT_STANDARD.

Referenced by GAME_MP_TeamNum_f().

◆ GAME_MP_SetTeamNum()

bool GAME_MP_SetTeamNum ( int teamnum)
static

Definition at line 215 of file mp_callbacks.cpp.

References _, cgi, Com_sprintf(), DEBUG_CLIENT, MAX_VAR, teamData, and TEXT_STANDARD.

Referenced by GAME_MP_TeamNum_f().

◆ GAME_MP_StartGame_f()

void GAME_MP_StartGame_f ( void )
static

Definition at line 162 of file mp_callbacks.cpp.

References cgi.

◆ GAME_MP_TeamNum_f()

void GAME_MP_TeamNum_f ( void )
static

Increase or decrease the teamnum.

See also
GAME_MP_SelectTeam_Init_f

Definition at line 235 of file mp_callbacks.cpp.

References cgi, GAME_MP_SelectTeam_Init_f(), GAME_MP_SetTeamNum(), i, Q_streq, TEAM_CIVILIAN, TEAM_DEFAULT, and teamData.

Variable Documentation

◆ cgi

const cgame_import_t* cgi
static

Definition at line 32 of file mp_callbacks.cpp.

◆ cl_maxsoldiersperplayer

cvar_t* cl_maxsoldiersperplayer

Definition at line 37 of file mp_callbacks.cpp.

Referenced by GAME_MP_CallbacksInit(), GAME_MP_RunFrame(), and GAME_MP_StartServer_f().

◆ cl_maxsoldiersperteam

cvar_t* cl_maxsoldiersperteam

Definition at line 36 of file mp_callbacks.cpp.

Referenced by GAME_MP_CallbacksInit(), GAME_MP_RunFrame(), and GAME_MP_StartServer_f().

◆ cl_roundtimelimit

cvar_t* cl_roundtimelimit

Definition at line 38 of file mp_callbacks.cpp.

Referenced by GAME_MP_CallbacksInit(), and GAME_MP_RunFrame().

◆ info_password

cvar_t* info_password
static

Definition at line 40 of file mp_callbacks.cpp.

Referenced by GAME_MP_CallbacksInit().

◆ mpCallbacks

const cmdList_t mpCallbacks[]
static
Initial value:
= {
{"mp_selectteam_init", GAME_MP_SelectTeam_Init_f, "Function that gets all connected players and let you choose a free team"},
{"mp_init_ui", GAME_MP_InitUI_f, nullptr},
{"teamnum_dec", GAME_MP_TeamNum_f, "Decrease the preferred teamnum"},
{"teamnum_inc", GAME_MP_TeamNum_f, "Increase the preferred teamnum"},
{"pingservers", GAME_MP_PingServers_f, "Ping all servers in local network to get the serverlist"},
{"disconnect", GAME_MP_Disconnect_f, "Disconnect from the current server"},
{"connect", GAME_MP_Connect_f, "Connect to given ip"},
{"reconnect", GAME_MP_Reconnect_f, "Reconnect to last server"},
{"rcon", GAME_MP_Rcon_f, "Execute a rcon command - see rcon_password"},
{"cl_startgame", GAME_MP_StartGame_f, "Forces a gamestart if you are the admin"},
{nullptr, nullptr, nullptr}
}
static void GAME_MP_Rcon_f(void)
static void GAME_MP_Reconnect_f(void)
The server is changing levels.
static void GAME_MP_SelectTeam_Init_f(void)
Send the SV_CMD_TEAMINFO command to server.
static void GAME_MP_InitUI_f(void)
static void GAME_MP_TeamNum_f(void)
Increase or decrease the teamnum.
static void GAME_MP_Connect_f(void)
static void GAME_MP_Disconnect_f(void)
Binding for disconnect console command.
static void GAME_MP_StartGame_f(void)
void GAME_MP_PingServers_f(void)
The first function called when entering the multiplayer menu, then CL_Frame takes over.

Definition at line 287 of file mp_callbacks.cpp.

Referenced by GAME_MP_CallbacksInit(), and GAME_MP_CallbacksShutdown().

◆ rcon_address

cvar_t* rcon_address
static

Definition at line 39 of file mp_callbacks.cpp.

Referenced by GAME_MP_CallbacksInit(), and GAME_MP_Rcon().

◆ rcon_client_password

cvar_t* rcon_client_password

◆ teamData