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

Server commands. More...

#include "g_local.h"
#include "g_ai.h"
#include "g_client.h"
#include "g_edicts.h"
#include "g_inventory.h"
#include "g_match.h"
#include "g_vis.h"

Go to the source code of this file.

Data Structures

struct  ipfilter_s
 PACKET FILTERING. More...
 

Macros

#define MAX_IPFILTERS   1024
 

Typedefs

typedef struct ipfilter_s ipfilter_t
 PACKET FILTERING. More...
 

Functions

static bool StringToFilter (const char *s, ipfilter_t *f)
 
bool SV_FilterPacket (const char *from)
 
static void SVCmd_AddIP_f (void)
 
static void SVCmd_RemoveIP_f (void)
 
static void SVCmd_ListIP_f (void)
 Shows the current ip in the filter list. More...
 
static void SVCmd_WriteIP_f (void)
 Store all ips in the current filter list in. More...
 
static void SVCmd_AI_Add_f (void)
 Used to add ai opponents to a game. More...
 
static void SVCmd_Win_f (void)
 Call the end game function with the given team used to e.g. abort singleplayer games and let the aliens win. More...
 
void G_ServerCommand (void)
 ServerCommand will be called when an "sv" command is issued. The game can issue gi.Cmd_Argc() / gi.Cmd_Argv() commands to get the rest of the parameters. More...
 

Variables

static ipfilter_t ipfilters [MAX_IPFILTERS]
 
static int numipfilters
 

Detailed Description

Server commands.

Definition in file g_svcmds.cpp.

Macro Definition Documentation

#define MAX_IPFILTERS   1024

Definition at line 63 of file g_svcmds.cpp.

Referenced by SVCmd_AddIP_f().

Typedef Documentation

typedef struct ipfilter_s ipfilter_t

PACKET FILTERING.

Note
You can add or remove addresses from the filter list with:

addip IP removeip IP 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 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 "addip IP" commands to listip.cfg so it can be executed at a later date. The filter lists are not saved and restored by default, because I beleive it would cause too much confusion.

sv_filterban <0 or 1> If 1 (the default), then ip addresses matching the current list will be prohibited from entering the game. This is the default setting. If 0, then only addresses matching the list will be allowed. This lets you easily set up a private game, or a game that only allows players from your local network.

Function Documentation

void G_ServerCommand ( void  )

ServerCommand will be called when an "sv" command is issued. The game can issue gi.Cmd_Argc() / gi.Cmd_Argv() commands to get the rest of the parameters.

See also
serverCommandList

Definition at line 337 of file g_svcmds.cpp.

References game_import_s::Cmd_Argv(), gi, Q_strcasecmp, SVCmd_AddIP_f(), SVCmd_AI_Add_f(), SVCmd_ListIP_f(), SVCmd_RemoveIP_f(), SVCmd_Win_f(), and SVCmd_WriteIP_f().

Referenced by GetGameAPI().

static bool StringToFilter ( const char *  s,
ipfilter_t f 
)
static
Todo:
find out if this printf is needed. Passing nullptr as a player would have crashed anyway.

Definition at line 68 of file g_svcmds.cpp.

References ipfilter_s::compare, i, m, ipfilter_s::mask, and OBJZERO.

Referenced by SVCmd_AddIP_f(), and SVCmd_RemoveIP_f().

bool SV_FilterPacket ( const char *  from)

Definition at line 104 of file g_svcmds.cpp.

References ipfilter_s::compare, i, cvar_s::integer, m, numipfilters, and sv_filterban.

Referenced by G_ClientConnect().

static void SVCmd_AddIP_f ( void  )
static
static void SVCmd_AI_Add_f ( void  )
static

Used to add ai opponents to a game.

Note
civilians can not be added with this function
See also
AI_CreatePlayer

Definition at line 228 of file g_svcmds.cpp.

References AI_CreatePlayer(), game_import_s::Cmd_Argv(), gi, MAX_TEAMS, and TEAM_CIVILIAN.

Referenced by G_ServerCommand().

static void SVCmd_ListIP_f ( void  )
static

Shows the current ip in the filter list.

Definition at line 185 of file g_svcmds.cpp.

References gi, i, and numipfilters.

Referenced by G_ServerCommand().

static void SVCmd_RemoveIP_f ( void  )
static
static void SVCmd_Win_f ( void  )
static

Call the end game function with the given team used to e.g. abort singleplayer games and let the aliens win.

See also
G_MatchEndTrigger

Definition at line 248 of file g_svcmds.cpp.

References game_import_s::Cmd_Argv(), G_MatchEndTrigger(), gi, MAX_TEAMS, and TEAM_CIVILIAN.

Referenced by G_ServerCommand().

static void SVCmd_WriteIP_f ( void  )
static

Store all ips in the current filter list in.

Definition at line 198 of file g_svcmds.cpp.

References Com_sprintf(), f, FILE, game_import_s::FS_Gamedir(), gi, i, cvar_s::integer, MAX_OSPATH, name, numipfilters, sv_filterban, and game_import_s::Sys_Fopen().

Referenced by G_ServerCommand().

Variable Documentation

ipfilter_t ipfilters[MAX_IPFILTERS]
static

Definition at line 65 of file g_svcmds.cpp.

int numipfilters
static