UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
sv_ccmds.cpp File Reference

Console-only server commands. More...

#include "server.h"
#include "../common/http.h"
#include "../shared/scopedmutex.h"

Go to the source code of this file.

Data Structures

struct  serverCommand_t
 List for SV_CompleteServerCommand. More...
 

Functions

void SV_Heartbeat_f (void)
 
void SV_SetMaster_f (void)
 Add the server to the master server list so that others can see the server in the server list. More...
 
static client_tSV_GetPlayerClientStructure (const char *s)
 searches a player by id or name More...
 
bool SV_CheckMap (const char *map, const char *assembly)
 Checks whether a map exists. More...
 
static void SV_Map_f (void)
 Goes directly to a given map. More...
 
static void SV_Kick_f (void)
 Kick a user off of the server. More...
 
static void SV_StartGame_f (void)
 Forces a game start even if not all players are ready yet. More...
 
static void SV_Status_f (void)
 Prints some server info to the game console - like connected players and current running map. More...
 
static void SV_Serverinfo_f (void)
 Examine or change the serverinfo string. More...
 
static void SV_UserInfo_f (void)
 Examine all a users info strings. More...
 
static void SV_KillServer_f (void)
 Kick everyone off, possibly in preparation for a new game. More...
 
static void SV_ServerCommand_f (void)
 Let the game dll handle a command. More...
 
static int SV_CompleteMapCommand (const char *partial, const char **match)
 Autocomplete function for the map command. More...
 
static void SV_ListMaps_f (void)
 List all valid maps. More...
 
static int SV_CompleteServerCommand (const char *partial, const char **match)
 Autocomplete function for server commands. More...
 
static void SV_PrintConfigStrings_f (void)
 
void SV_InitOperatorCommands (void)
 

Variables

static serverCommand_t const serverCommandList []
 

Detailed Description

Console-only server commands.

These commands can only be entered from stdin or by a remote operator datagram.

Definition in file sv_ccmds.cpp.

Function Documentation

bool SV_CheckMap ( const char *  map,
const char *  assembly 
)

Checks whether a map exists.

Definition at line 101 of file sv_ccmds.cpp.

References Com_Printf(), Com_sprintf(), FS_CheckFile(), and MAX_QPATH.

Referenced by SV_Map_f(), and SV_MapcycleAdd_f().

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

Autocomplete function for the map command.

Parameters
[in]partialThe list of params entered, starting at the first non-blank char.
[out]matchThe found entry of the list we are searching, in case of more than one entry their common suffix is returned.
See also
Cmd_AddParamCompleteFunction

Definition at line 390 of file sv_ccmds.cpp.

References Cmd_GenericCompleteFunction(), Com_Printf(), FS_GetMaps(), fs_maps, fs_numInstalledMaps, mapName, Q_strncasecmp, and Q_strncpyz().

Referenced by SV_InitOperatorCommands().

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

Autocomplete function for server commands.

See also
ServerCommand

Definition at line 479 of file sv_ccmds.cpp.

References Cmd_GenericCompleteFunction(), Com_Printf(), i, and S_COLOR_GREEN.

Referenced by SV_InitOperatorCommands().

static client_t* SV_GetPlayerClientStructure ( const char *  s)
static

searches a player by id or name

Parameters
[in]sEither the numeric id of the player, or the player name
Returns
the client structure

Definition at line 68 of file sv_ccmds.cpp.

References cl, Cmd_Argv(), Com_Printf(), cs_free, client_s::name, Q_streq, client_s::state, and SV_GetNextClient().

Referenced by SV_Kick_f(), and SV_UserInfo_f().

void SV_Heartbeat_f ( void  )

Definition at line 35 of file sv_ccmds.cpp.

References serverInstanceStatic_s::lastHeartbeat, and svs.

Referenced by SV_InitGame(), SV_InitOperatorCommands(), and SV_SetMaster_f().

static void SV_Kick_f ( void  )
static
static void SV_KillServer_f ( void  )
static

Kick everyone off, possibly in preparation for a new game.

Definition at line 354 of file sv_ccmds.cpp.

References serverInstanceStatic_s::initialized, SV_Shutdown(), and svs.

Referenced by SV_InitOperatorCommands().

static void SV_ListMaps_f ( void  )
static

List all valid maps.

See also
FS_GetMaps

Definition at line 442 of file sv_ccmds.cpp.

References Com_Printf(), FS_GetMaps(), fs_maps, fs_numInstalledMaps, and i.

Referenced by SV_InitOperatorCommands().

static void SV_Map_f ( void  )
static

Goes directly to a given map.

See also
SV_InitGame
SV_SpawnServer

Definition at line 131 of file sv_ccmds.cpp.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), Cvar_SetValue(), MAX_TILESTRINGS, MAX_TOKEN_CHARS, Q_streq, Q_strncpyz(), SV_CheckMap(), and SV_Map().

Referenced by SV_InitOperatorCommands().

static void SV_PrintConfigStrings_f ( void  )
static
static void SV_ServerCommand_f ( void  )
static

Let the game dll handle a command.

Definition at line 364 of file sv_ccmds.cpp.

References Cmd_Argc(), Cmd_Args(), Cmd_Argv(), Com_DPrintf(), Com_Printf(), DEBUG_SERVER, serverInstanceStatic_s::ge, serverInstanceStatic_s::serverMutex, and svs.

Referenced by SV_InitOperatorCommands().

static void SV_Serverinfo_f ( void  )
static

Examine or change the serverinfo string.

Definition at line 316 of file sv_ccmds.cpp.

References Com_Printf(), Cvar_Serverinfo(), Info_Print(), and MAX_INFO_STRING.

Referenced by SV_InitOperatorCommands().

void SV_SetMaster_f ( void  )

Add the server to the master server list so that others can see the server in the server list.

See also
SV_InitGame

Definition at line 45 of file sv_ccmds.cpp.

References Com_Printf(), Cvar_Set(), HTTP_GetURL(), cvar_s::integer, masterserver_url, port, cvar_s::string, sv_dedicated, SV_Heartbeat_f(), sv_maxclients, and va().

Referenced by SV_InitGame(), and SV_InitOperatorCommands().

static void SV_StartGame_f ( void  )
static

Forces a game start even if not all players are ready yet.

See also
SV_CheckGameStart

Definition at line 215 of file sv_ccmds.cpp.

References cl, cs_free, Cvar_ForceSet(), client_s::player, SrvPlayer::setReady(), client_s::state, SV_GetNextClient(), and va().

Referenced by SV_InitOperatorCommands().

static void SV_UserInfo_f ( void  )
static

Examine all a users info strings.

See also
CL_UserInfo_f

Definition at line 328 of file sv_ccmds.cpp.

References cl, Cmd_Argc(), Cmd_Argv(), Com_Printf(), Info_Print(), serverInstanceStatic_s::initialized, SV_GetPlayerClientStructure(), svs, and client_s::userinfo.

Referenced by SV_InitOperatorCommands().

Variable Documentation

serverCommand_t const serverCommandList[]
static
Initial value:
= {
{ "startgame", "Force the gamestart - useful for multiplayer games" },
{ "addip", "The ip address is specified in dot format, and any unspecified digits will match any value, so you can specify an entire class C network with 'addip 192.246.40'" },
{ "removeip", "Removeip will only remove an address specified exactly the same way. You cannot addip a subnet, then removeip a single host" },
{ "listip", "Prints the current list of filters" },
{ "writeip", "Dumps ips to listip.cfg so it can be executed at a later date" },
{ "ai_add", "Used to add ai opponents to a game - but no civilians" },
{ "win", "Call the end game function with the given team" },
{ 0, 0 }
}

Definition at line 460 of file sv_ccmds.cpp.