All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Namespaces | Classes | Functions | Variables
server Namespace Reference




struct  maprotation
struct  teamkillkick
struct  teamkillinfo
struct  teamrank
struct  msgfilter
 MSG filter works as a firewall it allowes only certain messages for certain things, see checktype -1 will become 1 in the switchcase below, its a hack to not misinterpretate the different cases as messages. More...
struct  worldstate
struct  votecount
struct  crcinfo
struct  ban
struct  savedscore
 Save scores if client disconnects to restore it when he reconnects. More...
struct  client
 server side version of "dynent" type More...
struct  projectilestate
struct  gamestate
 server specialisation of the fpsstate (?) More...
struct  gameevent
struct  timedevent
struct  hitinfo
struct  shotevent
struct  explodeevent
struct  suicideevent
struct  pickupevent
struct  clientinfo
struct  demofile
struct  bombservermode
struct  captureservermode
struct  collectservermode
struct  ctfservermode
struct  servmode
struct  hideandseekservermode


void flushserver (bool force)
int getservermtu ()
 VAR (lockmaprotation, 0, 0, 2)
void maprotationreset ()
void nextmaprotation ()
int findmaprotation (int mode, const char *map)
bool addmaprotation (int modemask, const char *map)
void addmaprotations (tagval *args, int numargs)
 COMMAND (maprotationreset,"")
 COMMANDN (maprotation, addmaprotations,"ss2V")
 VAR (restrictdemos, 0, 1, 1)
 VAR (restrictpausegame, 0, 0, 1)
 VAR (restrictgamespeed, 0, 1, 1)
 VAR (restrictpersistteams, 0, 0, 1)
 SVAR (serverdesc,"")
 SVAR (servermotd,"")
 VAR (spectatemodifiedmap, 0, 1, 1)
void teamkillkickreset ()
void addteamkillkick (char *modestr, int *limit, int *ban)
 COMMAND (teamkillkickreset,"")
 COMMANDN (teamkillkick, addteamkillkick,"sii")
void addteamkill (clientinfo *actor, clientinfo *victim, int n)
void checkteamkills ()
void resetitems ()
void serverinit ()
bool canspawnitem (int type)
int spawntime (int type)
bool pickup (int i, int sender)
void clearteaminfo ()
bool teamhasplayers (const char *team)
bool pruneteaminfo ()
teaminfoaddteaminfo (const char *team)
clientinfochoosebestclient (float &bestrank)
void autoteam ()
const char * chooseworstteam (const char *suggest=nullptr, clientinfo *exclude=nullptr)
void assign_team (clientinfo *ci)
static void freegetmap (ENetPacket *packet)
void checkpausegame ()
 If no player with a high enough privilege level is on the server, resume the game. More...
bool ispaused ()
void changegamespeed (int val, clientinfo *ci=nullptr)
void persistteams (bool val)
void checkpersistteams ()
int checktype (int type, clientinfo *ci)
void cleanworldstate (ENetPacket *packet)
void flushclientposition (clientinfo &ci)
static void sendpositions (worldstate &ws, ucharbuf &wsbuf)
static void addposition (worldstate &ws, ucharbuf &wsbuf, int mtu, clientinfo &bi, clientinfo &ci)
static void sendmessages (worldstate &ws, ucharbuf &wsbuf)
static void addmessages (worldstate &ws, ucharbuf &wsbuf, int mtu, clientinfo &bi, clientinfo &ci)
bool buildworldstate ()
bool sendpackets (bool force)
template<class T >
void sendstate (gamestate &gs, T &p)
void spawnstate (clientinfo *ci)
void sendspawn (clientinfo *ci)
int welcomepacket (packetbuf &p, clientinfo *ci)
void sendwelcome (clientinfo *ci)
void putinitclient (clientinfo *ci, packetbuf &p)
void welcomeinitclient (packetbuf &p, int exclude=-1)
void sendinitclient (clientinfo *ci)
void loaditems ()
void changemap (const char *s, int mode)
 ICOMMAND (mapmode,"si",(char *name, int *mode), changemap(name,*mode))
void rotatemap (bool next)
bool hasmap (clientinfo *ci)
void choosemap (clientinfo *ci)
void checkvotes (bool force=false)
void vote (const char *map, int reqmode, int sender)
void checkintermission ()
void startintermission ()
void checklms ()
 Checks if the game has ended because only one player is still alive. More...
void dodamage (clientinfo *target, clientinfo *actor, int damage, int gun, const vec &hitpush=vec(0, 0, 0))
void suicide (clientinfo *ci)
void clearevent (clientinfo *ci)
void flushevents (clientinfo *ci, int millis)
void processevents ()
void cleartimedevents (clientinfo *ci)
void serverupdate ()
void forcespectator (clientinfo *ci)
 VAR (modifiedmapspectator, 0, 1, 2)
void checkmaps (int req=-1)
bool shouldspectate (clientinfo *ci)
void unspectate (clientinfo *ci)
void sendclipboard (clientinfo *ci)
bool allowbroadcast (int n)
void receivefile (int sender, uchar *data, int len)
void parsepacket (int sender, int chan, packetbuf &p)
void serverinforeply (ucharbuf &req, ucharbuf &p)
bool servercompatible (char *name, char *sdec, char *map, int ping, const vector< int > &attr, int np)
void sendresume (clientinfo *ci)
void clientdisconnect (int n)
int clientconnect (int n, uint ip)
 VARF (maxclients, 0, DEFAULTCLIENTS, MAXCLIENTS,{if(!maxclients) maxclients=DEFAULTCLIENTS;})
 VARF (maxdupclients, 0, 0, MAXCLIENTS,{if(serverhost) serverhost->duplicatePeers=maxdupclients?maxdupclients:MAXCLIENTS;})
 Max clients from same peer. More...
int reserveclients ()
 The amount of people who can connect more than the actual specified max clients limit. More...
 SVAR (serverpass,"")
 SVAR (adminpass,"")
 VARF (publicserver, 0, 0, 2,{switch(*publicserver){case 0:default:mastermask=MM_PRIVSERV;break;case 1:mastermask=MM_PUBSERV;break;case 2:mastermask=MM_COOPSERV;break;}})
ENetPeer * getclientpeer (int i)
uint getclientip (int n)
bool has_clients ()
int get_num_clients ()
int numclients (int exclude=-1, bool nospec=true, bool noai=true, bool priv=false)
 List all connected clients (game players) More...
clientinfoget_client_info (int n, bool findbots)
bool duplicatename (clientinfo *ci, const char *name)
const char * colorname (clientinfo *ci, const char *name=nullptr)
 colorful version of the clients name (if two people share the same name or ci is a bot) More...
void addban (uint ip, int expire)
void clearbans (clientinfo *actor)
void check_bans_expired ()
void kickclients (uint ip, clientinfo *actor=nullptr, int priv=PRIV_NONE)
 Kick all clients with this IP (including bots and people in the same LAN) More...
bool trykick (clientinfo *ci, int victim, const char *reason, bool trial)
void cleargbans ()
bool checkgban (uint ip)
void addgban (const char *name)
int allowconnect (clientinfo *ci, const char *pwd="")
void change_mastermode (int mm, int sendernum, clientinfo *actor)
int get_mastermode_int ()
void revokemaster (clientinfo *ci)
bool setmaster (clientinfo *ci, bool val, const char *pass, bool force, bool trial)
savedscorefindscore (clientinfo *ci, bool insert)
void savescore (clientinfo *ci)
bool restorescore (clientinfo *ci)
void resetdisconnectedplayerscores ()
 New map: we throw away the scores of disconnected players. More...
void sendservinfo (clientinfo *ci)
bool player_connected (clientinfo *ci, const char *password, const char *mapwish, int modewish)
void promote_if_local_client (client *c)
 If client ci is from the same ip as this server -> make him priv_local. More...
clientadd_client_connection (ENetPeer *peer)
void delete_client_connection (client *c)
void noclients ()
void disconnect_client (int n, int reason)
void check_clients_timed_out ()
 After some period of time without response we disconnect a client. More...
 VAR (maxdemos, 0, 5, 25)
 VAR (maxdemosize, 0, 16, 31)
void prunedemos (int extra=0)
void adddemo ()
void enddemorecord ()
void writedemo (int chan, void *data, int len)
void recordpacket (int chan, void *data, int len)
void setupdemorecord ()
void listdemos (int cn)
 Send a list of demos to that client. More...
void cleardemos (int n)
 Remove all demos until demo number n or all if n = 0. More...
static void freegetdemo (ENetPacket *packet)
void senddemo (clientinfo *ci, int num)
 Send a specific demo to the client. More...
void enddemoplayback ()
void setupdemoplayback ()
void readdemo ()
void stopdemo ()
 Wrapper for either enddemoplayback or enddemorecord, depending on m_demo. More...
 VAR (extinfoip, 0, 0, 1)
void extinfoplayer (ucharbuf &p, clientinfo *ci)
static void extinfoteamscore (ucharbuf &p, const char *team, int score)
void extinfoteams (ucharbuf &p)
void extserverinforeply (ucharbuf &req, ucharbuf &p)
void pausegame (bool val, clientinfo *ci)
 VAR (ctftkpenalty, 0, 1, 1)
void cleanupserver ()
void process (ENetPacket *packet, int sender, int chan)
bool resolverwait (const char *name, ENetAddress *address)
int connectwithtimeout (ENetSocket sock, const char *hostname, const ENetAddress &remoteaddress)
void sendserverinforeply (ucharbuf &p)
void checkserversockets ()
 Reply all server info requests. More...
 VAR (serveruprate, 0, 0, INT_MAX)
 SVAR (serverip,"")
 VARF (serverport, 0, INEXOR_SERVER_PORT, MAX_POSSIBLE_PORT,{if(!serverport) serverport=server_port();})
void serverslice (uint timeout)
 main server update More...
void run_server ()
bool servererror (const char *desc)
bool setup_network_sockets ()


int gamelimit = 0
int nextexceeded = 0
int gamespeed = 100
bool shouldstep = true
int interm = 0
bool teamspersisted
 Whether team reshuffeling after map change is disabled. More...
enet_uint32 lastsend = 0
streammapdata = nullptr
string smapname = ""
bool notgotitems = true
vector< maprotationmaprotations
int curmaprotation = 0
vector< teamkillkickteamkillkicks
vector< teamkillinfoteamkills
bool shouldcheckteamkills = false
uint mcrc = 0
vector< entityments
vector< server_entitysents
captureservermode capturemode
ctfservermode ctfmode
collectservermode collectmode
bombservermode bombmode
hideandseekservermode hideandseekmode
servmodesmode = nullptr
hashset< teaminfoteaminfos
struct server::worldstate msgfilter
vector< worldstateworldstates
bool reliablemessages = false
ENetHost * serverhost = nullptr
vector< client * > client_connections
 TODO merge with clients or connects. More...
vector< clientinfo * > connects
vector< clientinfo * > clients
vector< clientinfo * > bots
int client_count = 0
 Idk why client_connections.length isnt used here: we try to avoid resetting the vector completely (probably an optimisation), but just free the buffers from it and set the connection->connected to false and the next player joining fills the gap. More...
vector< uintallowedips
 allowed IPs: mastermode locked allows some players to be unspectated immediately? More...
vector< banbannedips
vector< ipmaskgbans
int mastermode = MM_OPEN
int mastermask = MM_PRIVSERV
vector< savedscorescores
SharedVar< char * > serverdesc
SharedVar< char * > servermotd
SharedVar< int > maxclients
SharedVar< int > maxdupclients
static constexpr int DEATHMILLIS = 300
vector< demofiledemos
bool demonextmatch = false
 Whether we want to record a demo next match. More...
streamdemotmp = nullptr
streamdemorecord = nullptr
 The streams for demo playback or demo recording. More...
streamdemoplayback = nullptr
int nextplayback = 0
int demomillis = 0
SharedVar< int > maxdemos
SharedVar< int > maxdemosize
bool gamepaused = false
 Whether this game is currently paused. More...
int laststatus = 0
ENetSocket pongsock = ENET_SOCKET_NULL
ENetSocket lansock = ENET_SOCKET_NULL
ENetAddress serveraddress = { ENET_HOST_ANY, ENET_PORT_ANY }
static ENetAddress pongaddr

Class Documentation

struct server::teamkillinfo
Class Members
uint ip
int teamkills
struct server::ban
Class Members
int expire
uint ip
int time
struct server::client

server side version of "dynent" type

Class Members
bool connected
string hostname
void * info
int num
ENetPeer * peer
struct server::hitinfo
Class Members
vec dir
float dist
int lifesequence
int rays
int target
struct server::demofile
Class Members
uchar * data
string info
int len

Function Documentation

client & server::add_client_connection ( ENetPeer *  peer)
void server::addban ( uint  ip,
int  expire 
void server::adddemo ( )
void server::addgban ( const char *  name)
bool server::addmaprotation ( int  modemask,
const char *  map 
void server::addmaprotations ( tagval args,
int  numargs 
static void server::addmessages ( worldstate &  ws,
ucharbuf wsbuf,
int  mtu,
clientinfo &  bi,
clientinfo &  ci 
static void server::addposition ( worldstate &  ws,
ucharbuf wsbuf,
int  mtu,
clientinfo &  bi,
clientinfo &  ci 
teaminfo* server::addteaminfo ( const char *  team)
void server::addteamkill ( clientinfo *  actor,
clientinfo *  victim,
int  n 
void server::addteamkillkick ( char *  modestr,
int *  limit,
int *  ban 
bool server::allowbroadcast ( int  n)
int server::allowconnect ( clientinfo *  ci,
const char *  pwd = "" 
void server::assign_team ( clientinfo *  ci)
void server::autoteam ( )
bool server::buildworldstate ( )
bool server::canspawnitem ( int  type)
void server::change_mastermode ( int  mm,
int  sendernum,
clientinfo *  actor 
void server::changegamespeed ( int  val,
clientinfo *  ci = nullptr 
void server::changemap ( const char *  s,
int  mode 
void server::check_bans_expired ( )

References bannedips, and totalmillis.

Referenced by serverupdate().

void server::check_clients_timed_out ( )

After some period of time without response we disconnect a client.

References connects, DISC_TIMEOUT, disconnect_client(), loopv, and totalmillis.

Referenced by serverupdate().

bool server::checkgban ( uint  ip)

References ai::check(), gbans, and loopv.

Referenced by addgban(), and allowconnect().

void server::checkintermission ( )
void server::checklms ( )

Checks if the game has ended because only one player is still alive.

If yes it forces intermission.

It does this by checking if less than 2 players have their state set to alive. This means, the game will also end if someone is Lagging.

References vector< T, MINSIZE >::add(), clients, CS_ALIVE, vector< T, MINSIZE >::length(), m_teammode, startintermission(), recorder::state, and anonymous_namespace{utilTest.cpp}::t().

Referenced by dodamage(), and suicide().

void server::checkmaps ( int  req = -1)
void server::checkpausegame ( )

If no player with a high enough privilege level is on the server, resume the game.

(Otherwise servers could get locked after an admin disconnected).

References clients, gamepaused, loopv, pausegame(), PRIV_ADMIN, and PRIV_MASTER.

Referenced by disconnect_client(), and setmaster().

void server::checkpersistteams ( )
void server::checkserversockets ( )

Reply all server info requests.

References lansock, databuf< T >::len, loopi(), inexor::rpc::max(), MAXPINGDATA, MAXTRANS, pongaddr, pongsock, and serverinforeply().

Referenced by serverslice().

void server::checkteamkills ( )

Referenced by serverupdate().

int server::checktype ( int  type,
clientinfo *  ci 
void server::checkvotes ( bool  force = false)
clientinfo* server::choosebestclient ( float &  bestrank)
void server::choosemap ( clientinfo *  ci)

References hasmap(), and rotatemap().

Referenced by player_connected().

const char* server::chooseworstteam ( const char *  suggest = nullptr,
clientinfo *  exclude = nullptr 
void server::cleanupserver ( )
void server::cleanworldstate ( ENetPacket *  packet)
void server::clearbans ( clientinfo *  actor)
void server::cleardemos ( int  n)

Remove all demos until demo number n or all if n = 0.

References demos, loopv, sendservmsg(), and sendservmsgf().

Referenced by parsepacket().

void server::clearevent ( clientinfo *  ci)

References server::clientinfo::events.

Referenced by flushevents().

void server::cleargbans ( )

References gbans.

void server::clearteaminfo ( )

References teaminfos.

Referenced by changemap().

void server::cleartimedevents ( clientinfo *  ci)
int server::clientconnect ( int  n,
uint  ip 
void server::clientdisconnect ( int  n)
const char * server::colorname ( clientinfo *  ci,
const char *  name 

colorful version of the clients name (if two people share the same name or ci is a bot)

References AI_NONE, fpsstate::aitype, server::clientinfo::clientnum, COL_MAGENTA, COL_WHITE, duplicatename(), formatstring(), server::clientinfo::name, and server::clientinfo::state.

Referenced by checkmaps(), parsepacket(), receivefile(), setmaster(), trykick(), and vote().

server::COMMAND ( maprotationreset  ,
server::COMMAND ( teamkillkickreset  ,
server::COMMANDN ( maprotation  ,
addmaprotations  ,
server::COMMANDN ( teamkillkick  ,
addteamkillkick  ,
int server::connectwithtimeout ( ENetSocket  sock,
const char *  hostname,
const ENetAddress &  remoteaddress 
void server::delete_client_connection ( client *  c)
void server::disconnect_client ( int  n,
int  reason 
void server::dodamage ( clientinfo *  target,
clientinfo *  actor,
int  damage,
int  gun,
const vec hitpush = vec(0, 0, 0) 
bool server::duplicatename ( clientinfo *  ci,
const char *  name 

References clients, loopv, and server::clientinfo::name.

Referenced by colorname().

void server::enddemoplayback ( )
void server::enddemorecord ( )
void server::extinfoplayer ( ucharbuf p,
clientinfo *  ci 
void server::extinfoteams ( ucharbuf p)
static void server::extinfoteamscore ( ucharbuf p,
const char *  team,
int  score 
void server::extserverinforeply ( ucharbuf req,
ucharbuf p 
int server::findmaprotation ( int  mode,
const char *  map 
savedscore* server::findscore ( clientinfo *  ci,
bool  insert 
void server::flushclientposition ( clientinfo &  ci)
void server::flushevents ( clientinfo *  ci,
int  millis 
void server::flushserver ( bool  force)
void server::forcespectator ( clientinfo *  ci)
static void server::freegetdemo ( ENetPacket *  packet)

References clients, server::clientinfo::getdemo, and loopv.

Referenced by senddemo().

static void server::freegetmap ( ENetPacket *  packet)

References clients, server::clientinfo::getmap, and loopv.

Referenced by parsepacket().

clientinfo * server::get_client_info ( int  n,
bool  findbots 
int server::get_mastermode_int ( )
int server::get_num_clients ( )

References client_count.

Referenced by player_connected(), and serverslice().

uint server::getclientip ( int  n)
ENetPeer * server::getclientpeer ( int  i)
int server::getservermtu ( )
bool server::has_clients ( )
bool server::hasmap ( clientinfo *  ci)
server::ICOMMAND ( mapmode  ,
"si"  ,
(char *name, int *mode)  ,
bool server::ispaused ( )

References gamepaused.

Referenced by serverslice().

void server::kickclients ( uint  ip,
clientinfo *  actor,
int  priv 
void server::listdemos ( int  cn)

Send a list of demos to that client.

References demos, packetbuf::finalize(), loopv, MAXTRANS, N_SENDDEMOLIST, putint(), sendpacket(), and sendstring().

Referenced by parsepacket().

void server::loaditems ( )
void server::maprotationreset ( )
void server::nextmaprotation ( )

References curmaprotation.

Referenced by rotatemap().

void server::noclients ( )

References bannedips, and server::aiman::clearai().

Referenced by disconnect_client().

int server::numclients ( int  exclude = -1,
bool  nospec = true,
bool  noai = true,
bool  priv = false 

List all connected clients (game players)

excludeexclude the player with this client number from the counter.
nospecexclude spectators (expect they have priviledge leveles and parameter priv is true)
privsee nospec: count priviledges users (master, admin, local) even when they are in spectator mode.
noaiexclude bots from the counter.

References AI_NONE, fpsstate::aitype, server::clientinfo::clientnum, clients, CS_SPECTATOR, loopv, server::clientinfo::privilege, server::gamestate::state, and server::clientinfo::state.

Referenced by allowconnect(), aiman::checkai(), disconnect_client(), hasmap(), game::listclients(), serverinforeply(), and setmaster().

void server::parsepacket ( int  sender,
int  chan,
packetbuf p 

References vector< T, MINSIZE >::add(), server::clientinfo::addevent(), addteaminfo(), AI_NONE, fpsstate::aitype, server::gamestate::bombs, server::clientinfo::bots, databuf< T >::buf, server::servmode::canchangeteam(), server::servmode::canspawn(), canspawnitem(), CHAN_FILE, change_mastermode(), changegamespeed(), server::aiman::changeteam(), checkmaps(), checktype(), server::clientinfo::cleanclipboard(), clearbans(), cleardemos(), cleartimedevents(), server::clientinfo::clientmap, server::clientinfo::clientnum, clients, server::clientinfo::clipboard, colorname(), server::clientinfo::connected, copystring(), CS_ALIVE, CS_DEAD, CS_EDITING, CS_SPECTATOR, server::gamestate::deadflush, server::gamestate::deaths, defformatstring, entities::delayspawn(), demonextmatch, server::hitinfo::dir, dir, DISC_MSGERR, DISC_OVERFLOW, disconnect_client(), server::hitinfo::dist, DMF, DNF, DVELF, server::gamestate::editstate, server::pickupevent::ent, server::servmode::entergame(), server::clientinfo::events, server::clientinfo::exceeded, filtertext(), packetbuf::finalize(), hmap::flags, flushclientposition(), flushevents(), forcespectator(), server::clientinfo::fov, freegetmap(), server::shotevent::from, server::clientinfo::gameclip, gamemillis, databuf< T >::get(), get_client_info(), server::clientinfo::geteventmillis(), getfloat(), getint(), server::clientinfo::getmap, getstring(), getuint(), server::gamestate::grenades, server::shotevent::gun, server::explodeevent::gun, GUN_BOMB, GUN_FIST, GUN_PISTOL, fpsstate::gunselect, game::gunselect(), game::hit(), game::hits, server::shotevent::hits, server::explodeevent::hits, server::shotevent::id, server::explodeevent::id, ID_FVAR, ID_SVAR, ID_VAR, server::clientinfo::lastclipboard, server::gamestate::lastspawn, server::servmode::leavegame(), databuf< T >::length(), server::gamestate::lifesequence, server::hitinfo::lifesequence, lilswap(), listdemos(), Log, loopi(), loopk, loopv, m_demo, m_edit, m_lms, m_teammode, vec::magnitude2(), server::clientinfo::mapcrc, mapdata, mastermode, inexor::rpc::max(), maxdemos, maxdemosize, MAXENTS, databuf< T >::maxlen, MAXNAMELEN, MAXTAGLEN, MAXTEAMLEN, MAXTRANS, server::clientinfo::messages, server::timedevent::millis, MM_LOCKED, server::servmode::moved(), msgsizelookup(), vec::mul(), N_ADDBOT, N_BOTBALANCE, N_BOTLIMIT, N_CHECKMAPS, N_CLEARBANS, N_CLEARDEMOS, N_CLIENTPING, N_CLIPBOARD, N_CONNECT, N_COPY, N_DELBOT, N_EDITENT, N_EDITMODE, N_EDITT, N_EDITVAR, N_EDITVSLOT, N_EXPLODE, N_FORCEINTERMISSION, N_FOV, N_FROMAI, N_GAMESPEED, N_GETDEMO, N_GETMAP, N_GUNSELECT, N_ITEMLIST, N_ITEMPICKUP, N_JUMPPAD, N_KICK, N_LISTDEMOS, N_MAPCRC, N_MAPVOTE, N_MASTERMODE, N_NEWMAP, N_PASTE, N_PAUSEGAME, N_PERSISTTEAMS, N_PING, N_PONG, N_POS, N_PRIVMSG, N_RECORDDEMO, N_REDO, N_REPLACE, N_SAYTEAM, N_SENDMAP, N_SERVCMD, N_SERVMSG, N_SETMASTER, N_SETTEAM, N_SHOOT, N_SPAWN, N_SPECTATOR, N_STOPDEMO, N_SUICIDE, N_SWITCHMODEL, N_SWITCHNAME, N_SWITCHTEAM, N_TELEPORT, N_TEXT, N_TRYSPAWN, N_UNDO, server::clientinfo::name, server::clientinfo::needclipboard, server::servmode::newmap(), notgotitems, NOTUSED, server::gamestate::o, databuf< T >::overread(), server::clientinfo::ownernum, packetbuf::packet, databuf< T >::pad(), server::servmode::parse_network_message(), pausegame(), persistteams(), pickup(), server::clientinfo::ping, player_connected(), server::clientinfo::playermodel, server::clientinfo::position, PRIV_ADMIN, PRIV_MASTER, server::clientinfo::privilege, putint(), QUEUE_AI, QUEUE_BUF, QUEUE_MSG, QUEUE_STR, RAD, server::hitinfo::rays, receivefile(), databuf< T >::remaining(), server::aiman::reqadd(), server::aiman::reqdel(), server::projectilestate< N >::reset(), resetitems(), server::gamestate::respawn(), server::gamestate::rockets, sendclipboard(), senddemo(), sendf(), sendfile(), sendpacket(), sendservmsgf(), sendspawn(), sendstate(), sents, server::aiman::setbotbalance(), server::aiman::setbotlimit(), server::clientinfo::setexceeded(), setmaster(), server::clientinfo::setpushed(), vector< T, MINSIZE >::setsize(), shouldstep, smapname, smode, server::servmode::spawned(), ai::spawned(), spawntime(), startintermission(), server::gamestate::state, server::clientinfo::state, inexor::util::log_manager::std, stopdemo(), packetbuf::subbuf(), suicide(), anonymous_namespace{utilTest.cpp}::t(), server::clientinfo::tag, server::hitinfo::target, server::clientinfo::team, entities::teleport(), server::shotevent::to, totalmillis, trykick(), unspectate(), and vote().

Referenced by process().

void server::pausegame ( bool  val,
clientinfo *  ci 
void server::persistteams ( bool  val)

References N_PERSISTTEAMS, sendf(), and teamspersisted.

Referenced by parsepacket().

bool server::pickup ( int  i,
int  sender 
bool server::player_connected ( clientinfo *  ci,
const char *  password,
const char *  mapwish,
int  modewish 
void server::process ( ENetPacket *  packet,
int  sender,
int  chan 
void server::processevents ( )
void server::promote_if_local_client ( client *  c)

If client ci is from the same ip as this server -> make him priv_local.

References server::clientinfo::clientnum, server::client::info, IsLocalConnection(), Log, server::client::peer, PRIV_LOCAL, and server::clientinfo::privilege.

Referenced by add_client_connection().

void server::prunedemos ( int  extra = 0)

References demos, loopi(), and maxdemos.

Referenced by enddemorecord().

bool server::pruneteaminfo ( )

References enumerate, teamhasplayers(), and teaminfos.

Referenced by addteaminfo().

void server::putinitclient ( clientinfo *  ci,
packetbuf p 
void server::readdemo ( )
void server::receivefile ( int  sender,
uchar data,
int  len 
void server::recordpacket ( int  chan,
void data,
int  len 

References writedemo().

Referenced by sendmessages(), sendpacket(), and sendpositions().

int server::reserveclients ( )

The amount of people who can connect more than the actual specified max clients limit.

E.g. for people connecting as admin or with the password.

Referenced by setup_network_sockets().

void server::resetdisconnectedplayerscores ( )

New map: we throw away the scores of disconnected players.

References scores.

Referenced by changemap().

void server::resetitems ( )

References mcrc, ments, and sents.

Referenced by loaditems(), and parsepacket().

bool server::resolverwait ( const char *  name,
ENetAddress *  address 

Referenced by connectserv().

bool server::restorescore ( clientinfo *  ci)
void server::revokemaster ( clientinfo *  ci)
void server::rotatemap ( bool  next)
void server::run_server ( )

References Log, NULL, serverslice(), and inexor::util::log_manager::std.

Referenced by main().

void server::savescore ( clientinfo *  ci)
void server::sendclipboard ( clientinfo *  ci)
void server::senddemo ( clientinfo *  ci,
int  num 

Send a specific demo to the client.

If client ci is not receiving one yet and num is valid.

ciinfo of connected clients on server side
numif 0 send the latest demo.

References server::clientinfo::clientnum, hmap::d, server::demofile::data, demos, freegetdemo(), server::clientinfo::getdemo, server::demofile::len, N_SENDDEMO, and sendf().

Referenced by parsepacket().

void server::sendinitclient ( clientinfo *  ci)
static void server::sendmessages ( worldstate &  ws,
ucharbuf wsbuf 
bool server::sendpackets ( bool  force)
static void server::sendpositions ( worldstate &  ws,
ucharbuf wsbuf 
void server::sendresume ( clientinfo *  ci)
void server::sendserverinforeply ( ucharbuf p)
void server::sendservinfo ( clientinfo *  ci)
void server::sendspawn ( clientinfo *  ci)
template<class T >
void server::sendstate ( gamestate &  gs,
T &  p 
void server::sendwelcome ( clientinfo *  ci)
bool server::servercompatible ( char *  name,
char *  sdec,
char *  map,
int  ping,
const vector< int > &  attr,
int  np 
bool server::servererror ( const char *  desc)

References fatal().

Referenced by setup_network_sockets().

void server::serverinforeply ( ucharbuf req,
ucharbuf p 
void server::serverinit ( )

References smapname.

Referenced by main().

void server::serverslice ( uint  timeout)
void server::serverupdate ( )
bool server::setmaster ( clientinfo *  ci,
bool  val,
const char *  pass,
bool  force,
bool  trial 
bool server::setup_network_sockets ( )
void server::setupdemoplayback ( )
void server::setupdemorecord ( )
bool server::shouldspectate ( clientinfo *  ci)

References mcrc, and server::clientinfo::warned.

Referenced by unspectate().

void server::spawnstate ( clientinfo *  ci)
int server::spawntime ( int  type)
void server::startintermission ( )
void server::stopdemo ( )

Wrapper for either enddemoplayback or enddemorecord, depending on m_demo.

References enddemoplayback(), enddemorecord(), and m_demo.

Referenced by changemap(), and parsepacket().

void server::suicide ( clientinfo *  ci)
server::SVAR ( serverpass  ,
server::SVAR ( adminpass  ,
server::SVAR ( serverip  ,
server::SVAR ( serverdesc  ,
server::SVAR ( servermotd  ,
bool server::teamhasplayers ( const char *  team)

References clients, and loopv.

Referenced by pruneteaminfo().

void server::teamkillkickreset ( )

References teamkillkicks.

bool server::trykick ( clientinfo *  ci,
int  victim,
const char *  reason,
bool  trial 
void server::unspectate ( clientinfo *  ci)
server::VAR ( ctftkpenalty  ,
server::VAR ( maxdemos  ,
server::VAR ( maxdemosize  ,
16  ,
server::VAR ( extinfoip  ,
server::VAR ( lockmaprotation  ,
server::VAR ( serveruprate  ,
server::VAR ( restrictdemos  ,
server::VAR ( restrictpausegame  ,
server::VAR ( restrictgamespeed  ,
server::VAR ( restrictpersistteams  ,
server::VAR ( spectatemodifiedmap  ,
server::VAR ( modifiedmapspectator  ,
server::VARF ( maxclients  ,
{if(!maxclients) maxclients=DEFAULTCLIENTS;}   
server::VARF ( maxdupclients  ,
{if(serverhost) serverhost->duplicatePeers=maxdupclients?maxdupclients:MAXCLIENTS;}   

Max clients from same peer.

server::VARF ( publicserver  ,
{switch(*publicserver){case 0:default:mastermask=MM_PRIVSERV;break;case 1:mastermask=MM_PUBSERV;break;case 2:mastermask=MM_COOPSERV;break;}}   
server::VARF ( serverport  ,
{if(!serverport) serverport=server_port();}   
void server::vote ( const char *  map,
int  reqmode,
int  sender 
void server::welcomeinitclient ( packetbuf p,
int  exclude = -1 
int server::welcomepacket ( packetbuf p,
clientinfo *  ci 
void server::writedemo ( int  chan,
void data,
int  len 

Variable Documentation

vector<uint> server::allowedips

allowed IPs: mastermode locked allows some players to be unspectated immediately?

Referenced by addban(), allowconnect(), change_mastermode(), and setmaster().

vector<ban> server::bannedips
bombservermode server::bombmode

Referenced by changemap(), and game::setclientmode().

vector< clientinfo * > server::bots
captureservermode server::capturemode

Referenced by changemap(), and game::setclientmode().

vector< client * > server::client_connections
int server::client_count = 0

Idk why client_connections.length isnt used here: we try to avoid resetting the vector completely (probably an optimisation), but just free the buffers from it and set the connection->connected to false and the next player joining fills the gap.

. dunno, smells useless.

Referenced by add_client_connection(), delete_client_connection(), get_num_clients(), and has_clients().

vector< clientinfo * > server::clients
collectservermode server::collectmode

Referenced by changemap().

vector< clientinfo * > server::connects
ctfservermode server::ctfmode

Referenced by changemap(), and game::setclientmode().

int server::curmaprotation = 0
constexpr int server::DEATHMILLIS = 300
int server::demomillis = 0

Referenced by readdemo(), and setupdemoplayback().

bool server::demonextmatch = false

Whether we want to record a demo next match.

Referenced by changemap(), and parsepacket().

stream * server::demoplayback = nullptr
stream * server::demorecord = nullptr

The streams for demo playback or demo recording.

set to nullptr if not recording/playing a demo.

Referenced by checkvotes(), enddemorecord(), flushclientposition(), sendpackets(), serverupdate(), setupdemorecord(), vote(), and writedemo().

vector< demofile > server::demos
stream* server::demotmp = nullptr
int server::gamelimit = 0
bool server::gamepaused = false

Whether this game is currently paused.

Referenced by checkpausegame(), ispaused(), pausegame(), serverinforeply(), serverupdate(), and welcomepacket().

int server::gamespeed = 100
vector<ipmask> server::gbans

Referenced by addgban(), checkgban(), and cleargbans().

hideandseekservermode server::hideandseekmode

Referenced by changemap(), and game::setclientmode().

int server::interm = 0
ENetSocket server::lansock = ENET_SOCKET_NULL
enet_uint32 server::lastsend = 0

Referenced by sendpackets().

int server::laststatus = 0

Referenced by serverslice().

stream* server::mapdata = nullptr

Referenced by parsepacket(), and receivefile().

vector<maprotation> server::maprotations
int server::mastermask = MM_PRIVSERV
int server::mastermode = MM_OPEN
SharedVar<int> server::maxclients
SharedVar<int> server::maxdemos
SharedVar<int> server::maxdemosize
SharedVar<int> server::maxdupclients

Referenced by setup_network_sockets().

uint server::mcrc = 0
vector< entity > server::ments
int server::nextexceeded = 0
int server::nextplayback = 0

Referenced by readdemo(), and setupdemoplayback().

bool server::notgotitems = true
ENetAddress server::pongaddr
ENetSocket server::pongsock = ENET_SOCKET_NULL
bool server::reliablemessages = false
vector<savedscore> server::scores
vector< server_entity > server::sents
ENetAddress server::serveraddress = { ENET_HOST_ANY, ENET_PORT_ANY }

Referenced by setup_network_sockets().

SharedVar<char*> server::serverdesc

Referenced by sendservinfo(), and serverinforeply().

ENetHost * server::serverhost = nullptr
SharedVar<char*> server::servermotd

Referenced by player_connected().

bool server::shouldcheckteamkills = false
bool server::shouldstep = true

Referenced by parsepacket(), and serverupdate().

string server::smapname = ""
servmode * server::smode = nullptr
hashset< teaminfo > server::teaminfos
vector<teamkillkick> server::teamkillkicks
vector<teamkillinfo> server::teamkills

Referenced by addteamkill(), and changemap().

bool server::teamspersisted

Whether team reshuffeling after map change is disabled.

TODO move this to a better sourcefile.

Referenced by changemap(), and persistteams().

vector<worldstate> server::worldstates