UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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"

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. More...
 
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. More...
 
static void GAME_MP_Reconnect_f (void)
 The server is changing levels. More...
 
static void GAME_MP_SelectTeam_Init_f (void)
 Send the SV_CMD_TEAMINFO command to server. More...
 
static bool GAME_MP_SetTeamNum (int teamnum)
 
static void GAME_MP_TeamNum_f (void)
 Increase or decrease the teamnum. More...
 
static int GAME_MP_CompleteNetworkAddress (const char *partial, const char **match)
 Autocomplete function for some network functions. More...
 
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

void GAME_MP_CallbacksShutdown ( void  )

Definition at line 318 of file mp_callbacks.cpp.

Referenced by GAME_MP_Shutdown().

static 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 cgame_import_s::Cvar_GetString(), i, MAX_BOOKMARKS, and va().

Referenced by GAME_MP_CallbacksInit().

static void GAME_MP_Disconnect_f ( void  )
static

Binding for disconnect console command.

Definition at line 173 of file mp_callbacks.cpp.

static void GAME_MP_InitUI_f ( void  )
static
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, DOUBLEQUOTE, GAME_MP_RconCallback(), cgame_import_s::NET_Connect(), port, PORT_SERVER, Q_strnull(), cvar_s::string, and SV_CMD_RCON.

Referenced by GAME_MP_Rcon_f().

static 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 cgame_import_s::Cmd_Args(), cgame_import_s::Cmd_Argv(), Com_Printf(), GAME_MP_Rcon(), and cvar_s::string.

static void GAME_MP_RconCallback ( struct net_stream s)
static

Definition at line 84 of file mp_callbacks.cpp.

References cgame_import_s::NET_ReadMsg(), Q_streq, and svc_oob.

Referenced by GAME_MP_Rcon().

static void GAME_MP_Reconnect_f ( void  )
static

The server is changing levels.

Definition at line 182 of file mp_callbacks.cpp.

References ca_connecting.

static 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 _, cgame_import_s::Cvar_Set(), PROTOCOL_VERSION, SV_CMD_TEAMINFO, and TEXT_STANDARD.

Referenced by GAME_MP_TeamNum_f().

static bool GAME_MP_SetTeamNum ( int  teamnum)
static
static void GAME_MP_StartGame_f ( void  )
static

Definition at line 162 of file mp_callbacks.cpp.

static void GAME_MP_TeamNum_f ( void  )
static

Variable Documentation

const cgame_import_t* cgi
static

Definition at line 32 of file mp_callbacks.cpp.

cvar_t* cl_maxsoldiersperplayer

Definition at line 37 of file mp_callbacks.cpp.

Referenced by GAME_MP_RunFrame(), and GAME_MP_StartServer_f().

cvar_t* cl_maxsoldiersperteam

Definition at line 36 of file mp_callbacks.cpp.

Referenced by GAME_MP_RunFrame(), and GAME_MP_StartServer_f().

cvar_t* cl_roundtimelimit

Definition at line 38 of file mp_callbacks.cpp.

Referenced by GAME_MP_RunFrame().

cvar_t* info_password
static

Definition at line 40 of file mp_callbacks.cpp.

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_InitUI_f(void)
static void GAME_MP_Rcon_f(void)
static void GAME_MP_StartGame_f(void)
static void GAME_MP_TeamNum_f(void)
Increase or decrease the teamnum.
static void GAME_MP_Disconnect_f(void)
Binding for disconnect console command.
static void GAME_MP_Reconnect_f(void)
The server is changing levels.
void GAME_MP_PingServers_f(void)
The first function called when entering the multiplayer menu, then CL_Frame takes over...
static void GAME_MP_SelectTeam_Init_f(void)
Send the SV_CMD_TEAMINFO command to server.
static void GAME_MP_Connect_f(void)

Definition at line 287 of file mp_callbacks.cpp.

cvar_t* rcon_address
static

Definition at line 39 of file mp_callbacks.cpp.

cvar_t* rcon_client_password

Definition at line 35 of file mp_callbacks.cpp.

Referenced by GAME_MP_RunFrame(), and GAME_MP_StartBattlescape().

teamData_t teamData

Definition at line 34 of file mp_callbacks.cpp.

Referenced by GAME_MP_ParseTeamInfoMessage(), and GAME_MP_Shutdown().