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

Console-only server commands. More...

#include "server.h"
#include "../common/http.h"
#include "../shared/scopedmutex.h"
Include dependency graph for sv_ccmds.cpp:

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

◆ SV_CheckMap()

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_BroadcastPrintf(), SV_Map_f(), and SV_MapcycleAdd_f().

◆ SV_CompleteMapCommand()

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().

◆ SV_CompleteServerCommand()

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, S_COLOR_GREEN, and serverCommandList.

Referenced by SV_InitOperatorCommands().

◆ SV_GetPlayerClientStructure()

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, Q_streq, and SV_GetNextClient().

Referenced by SV_Kick_f(), and SV_UserInfo_f().

◆ SV_Heartbeat_f()

void SV_Heartbeat_f ( void )

Definition at line 35 of file sv_ccmds.cpp.

References svs.

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

◆ SV_InitOperatorCommands()

◆ SV_Kick_f()

void SV_Kick_f ( void )
static

Kick a user off of the server.

Definition at line 187 of file sv_ccmds.cpp.

References cl, Cmd_Argc(), Cmd_Argv(), Com_Printf(), PRINT_CONSOLE, SV_BroadcastPrintf(), SV_DropClient(), SV_GetPlayerClientStructure(), and svs.

Referenced by SV_InitOperatorCommands().

◆ SV_KillServer_f()

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 SV_Shutdown(), and svs.

Referenced by SV_InitOperatorCommands().

◆ SV_ListMaps_f()

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().

◆ SV_Map_f()

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().

◆ SV_PrintConfigStrings_f()

void SV_PrintConfigStrings_f ( void )
static

◆ SV_ServerCommand_f()

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, and svs.

Referenced by SV_InitOperatorCommands().

◆ SV_Serverinfo_f()

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().

◆ SV_SetMaster_f()

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(), masterserver_url, port, sv_dedicated, SV_Heartbeat_f(), sv_maxclients, and va().

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

◆ SV_StartGame_f()

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(), SV_GetNextClient(), and va().

Referenced by SV_InitOperatorCommands().

◆ SV_Status_f()

void SV_Status_f ( void )
static

Prints some server info to the game console - like connected players and current running map.

Definition at line 232 of file sv_ccmds.cpp.

References cl, Com_Printf(), cs_began, cs_connected, cs_free, CS_LIGHTMAP, cs_spawned, cs_spawning, i, NET_StreamPeerToName(), sv, SV_GetConfigStringInteger(), SV_GetNextClient(), and svs.

Referenced by SV_InitOperatorCommands().

◆ SV_UserInfo_f()

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(), SV_GetPlayerClientStructure(), and svs.

Referenced by SV_InitOperatorCommands().

Variable Documentation

◆ serverCommandList

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.

Referenced by SV_CompleteServerCommand().