Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Macros | Functions | Variables
server.cpp File Reference
#include <boost/algorithm/clamp.hpp>
#include <math.h>
#include <stdarg.h>
#include <string.h>
#include <algorithm>
#include <memory>
#include <enet/enet.h>
#include "inexor/engine/worldio.hpp"
#include "inexor/fpsgame/entities.hpp"
#include "inexor/fpsgame/fpsstate.hpp"
#include "inexor/fpsgame/guns.hpp"
#include "inexor/fpsgame/teaminfo.hpp"
#include "inexor/gamemode/gamemode.hpp"
#include "inexor/io/Logging.hpp"
#include "inexor/io/legacy/stream.hpp"
#include "inexor/network/SharedVar.hpp"
#include "inexor/network/legacy/administration.hpp"
#include "inexor/network/legacy/buffer_types.hpp"
#include "inexor/network/legacy/cube_network.hpp"
#include "inexor/network/legacy/game_types.hpp"
#include "inexor/server/client_management.hpp"
#include "inexor/server/demos.hpp"
#include "inexor/server/extinfo.hpp"
#include "inexor/server/game_management.hpp"
#include "inexor/server/gamemode/bomb_server.hpp"
#include "inexor/server/gamemode/capture_server.hpp"
#include "inexor/server/gamemode/collect_server.hpp"
#include "inexor/server/gamemode/ctf_server.hpp"
#include "inexor/server/gamemode/gamemode_server.hpp"
#include "inexor/server/gamemode/hideandseek_server.hpp"
#include "inexor/server/network.hpp"
#include "inexor/server/network_send.hpp"
#include "inexor/shared/command.hpp"
#include "inexor/shared/cube_endian.hpp"
#include "inexor/shared/cube_formatting.hpp"
#include "inexor/shared/cube_hash.hpp"
#include "inexor/shared/cube_loops.hpp"
#include "inexor/shared/cube_tools.hpp"
#include "inexor/shared/cube_types.hpp"
#include "inexor/shared/cube_vector.hpp"
#include "inexor/shared/ents.hpp"
#include "inexor/shared/geom.hpp"
#include "inexor/shared/tools.hpp"
#include "inexor/util/legacy_time.hpp"
#include "inexor/fpsgame/aiman.hpp"

Classes

struct  server::maprotation
 
struct  server::teamkillkick
 
struct  server::teamkillinfo
 
struct  server::teamrank
 
struct  server::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  server::worldstate
 
struct  server::votecount
 
struct  server::crcinfo
 

Namespaces

 server
 
 server::aiman
 

Macros

#define QUEUE_AI   clientinfo *cm = cq;
 
#define QUEUE_MSG   { if(cm) while(curmsg<p.length()) cm->messages.add(p.buf[curmsg++]); }
 
#define QUEUE_BUF(body)
 
#define QUEUE_INT(n)   QUEUE_BUF(putint(cm->messages, n))
 
#define QUEUE_UINT(n)   QUEUE_BUF(putuint(cm->messages, n))
 
#define QUEUE_STR(text)   QUEUE_BUF(sendstring(text, cm->messages))
 

Functions

void server::flushserver (bool force)
 
int server::getservermtu ()
 
 server::VAR (lockmaprotation, 0, 0, 2)
 
void server::maprotationreset ()
 
void server::nextmaprotation ()
 
int server::findmaprotation (int mode, const char *map)
 
bool server::addmaprotation (int modemask, const char *map)
 
void server::addmaprotations (tagval *args, int numargs)
 
 server::COMMAND (maprotationreset,"")
 
 server::COMMANDN (maprotation, addmaprotations,"ss2V")
 
 server::VAR (restrictdemos, 0, 1, 1)
 
 server::VAR (restrictpausegame, 0, 0, 1)
 
 server::VAR (restrictgamespeed, 0, 1, 1)
 
 server::VAR (restrictpersistteams, 0, 0, 1)
 
 server::SVAR (serverdesc,"")
 
 server::SVAR (servermotd,"")
 
 server::VAR (spectatemodifiedmap, 0, 1, 1)
 
void server::teamkillkickreset ()
 
void server::addteamkillkick (char *modestr, int *limit, int *ban)
 
 server::COMMAND (teamkillkickreset,"")
 
 server::COMMANDN (teamkillkick, addteamkillkick,"sii")
 
void server::addteamkill (clientinfo *actor, clientinfo *victim, int n)
 
void server::checkteamkills ()
 
void server::resetitems ()
 
void server::serverinit ()
 
bool server::canspawnitem (int type)
 
int server::spawntime (int type)
 
bool server::pickup (int i, int sender)
 
void server::clearteaminfo ()
 
bool server::teamhasplayers (const char *team)
 
bool server::pruneteaminfo ()
 
teaminfoserver::addteaminfo (const char *team)
 
clientinfo * server::choosebestclient (float &bestrank)
 
void server::autoteam ()
 
const char * server::chooseworstteam (const char *suggest=nullptr, clientinfo *exclude=nullptr)
 
void server::assign_team (clientinfo *ci)
 
static void server::freegetmap (ENetPacket *packet)
 
void server::checkpausegame ()
 If no player with a high enough privilege level is on the server, resume the game. More...
 
bool server::ispaused ()
 
void server::changegamespeed (int val, clientinfo *ci=nullptr)
 
void server::persistteams (bool val)
 
void server::checkpersistteams ()
 
static struct server::msgfilter server::msgfilter (-1, N_CONNECT, N_SERVINFO, N_INITCLIENT, N_WELCOME, N_MAPCHANGE, N_SERVMSG, N_DAMAGE, N_HITPUSH, N_SHOTFX, N_EXPLODEFX, N_DIED, N_SPAWNSTATE, N_FORCEDEATH, N_TEAMINFO, N_ITEMACC, N_ITEMSPAWN, N_TIMEUP, N_CDIS, N_CURRENTMASTER, N_PONG, N_RESUME, N_BASESCORE, N_BASEINFO, N_BASEREGEN, N_ANNOUNCE, N_SENDDEMOLIST, N_SENDDEMO, N_DEMOPLAYBACK, N_SENDMAP, N_DROPFLAG, N_SCOREFLAG, N_RETURNFLAG, N_RESETFLAG, N_INVISFLAG, N_CLIENT, N_INITAI, N_EXPIRETOKENS, N_DROPTOKENS, N_STEALTOKENS, N_DEMOPACKET,-2, N_REMIP, N_NEWMAP, N_GETMAP, N_SENDMAP, N_CLIPBOARD,-3, N_EDITENT, N_EDITF, N_EDITT, N_EDITM, N_FLIP, N_COPY, N_PASTE, N_ROTATE, N_REPLACE, N_DELCUBE, N_EDITVAR, N_EDITVSLOT, N_UNDO, N_REDO,-4, N_POS, NUMMSG)
 
 msgfilter (int msg,...)
 
uchar operator[] (int msg) const
 
int server::checktype (int type, clientinfo *ci)
 
void server::cleanworldstate (ENetPacket *packet)
 
void server::flushclientposition (clientinfo &ci)
 
static void server::sendpositions (worldstate &ws, ucharbuf &wsbuf)
 
static void server::addposition (worldstate &ws, ucharbuf &wsbuf, int mtu, clientinfo &bi, clientinfo &ci)
 
static void server::sendmessages (worldstate &ws, ucharbuf &wsbuf)
 
static void server::addmessages (worldstate &ws, ucharbuf &wsbuf, int mtu, clientinfo &bi, clientinfo &ci)
 
bool server::buildworldstate ()
 
bool server::sendpackets (bool force)
 
template<class T >
void server::sendstate (gamestate &gs, T &p)
 
void server::spawnstate (clientinfo *ci)
 
void server::sendspawn (clientinfo *ci)
 
int server::welcomepacket (packetbuf &p, clientinfo *ci)
 
void server::sendwelcome (clientinfo *ci)
 
void server::putinitclient (clientinfo *ci, packetbuf &p)
 
void server::welcomeinitclient (packetbuf &p, int exclude=-1)
 
void server::sendinitclient (clientinfo *ci)
 
void server::loaditems ()
 
void server::changemap (const char *s, int mode)
 
 server::ICOMMAND (mapmode,"si",(char *name, int *mode), changemap(name,*mode))
 
void server::rotatemap (bool next)
 
bool server::hasmap (clientinfo *ci)
 
void server::choosemap (clientinfo *ci)
 
void server::checkvotes (bool force=false)
 
void server::vote (const char *map, int reqmode, int sender)
 
void server::checkintermission ()
 
void server::startintermission ()
 
void server::checklms ()
 Checks if the game has ended because only one player is still alive. More...
 
void server::dodamage (clientinfo *target, clientinfo *actor, int damage, int gun, const vec &hitpush=vec(0, 0, 0))
 
void server::suicide (clientinfo *ci)
 
void server::clearevent (clientinfo *ci)
 
void server::flushevents (clientinfo *ci, int millis)
 
void server::processevents ()
 
void server::cleartimedevents (clientinfo *ci)
 
void server::serverupdate ()
 
void server::forcespectator (clientinfo *ci)
 
 server::VAR (modifiedmapspectator, 0, 1, 2)
 
void server::checkmaps (int req=-1)
 
bool server::shouldspectate (clientinfo *ci)
 
void server::unspectate (clientinfo *ci)
 
void server::sendclipboard (clientinfo *ci)
 
bool server::allowbroadcast (int n)
 
void server::receivefile (int sender, uchar *data, int len)
 
void server::parsepacket (int sender, int chan, packetbuf &p)
 
void server::serverinforeply (ucharbuf &req, ucharbuf &p)
 
bool server::servercompatible (char *name, char *sdec, char *map, int ping, const vector< int > &attr, int np)
 
void server::sendresume (clientinfo *ci)
 
 server::aiman::VARN (serverbotlimit, botlimit, 0, 8, MAXBOTS)
 
 server::aiman::VAR (serverbotbalance, 0, 1, 1)
 
void server::aiman::calcteams (vector< teamscore > &teams)
 
void server::aiman::balanceteams ()
 
const char * server::aiman::chooseteam ()
 
static bool server::aiman::validaiclient (clientinfo *ci)
 
clientinfo * server::aiman::findaiclient (clientinfo *exclude=nullptr)
 
bool server::aiman::addai (int skill, int limit)
 
void server::aiman::deleteai (clientinfo *ci)
 
bool server::aiman::deleteai ()
 
void server::aiman::reinitai (clientinfo *ci)
 
void server::aiman::shiftai (clientinfo *ci, clientinfo *owner=nullptr)
 
void server::aiman::removeai (clientinfo *ci)
 
bool server::aiman::reassignai ()
 
void server::aiman::checksetup ()
 
void server::aiman::clearai ()
 
void server::aiman::checkai ()
 
void server::aiman::reqadd (clientinfo *ci, int skill)
 
void server::aiman::reqdel (clientinfo *ci)
 
void server::aiman::setbotlimit (clientinfo *ci, int limit)
 
void server::aiman::setbotbalance (clientinfo *ci, bool balance)
 
void server::aiman::changemap ()
 
void server::aiman::addclient (clientinfo *ci)
 
void server::aiman::changeteam (clientinfo *ci)
 

Variables

int server::gamelimit = 0
 
int server::nextexceeded = 0
 
int server::gamespeed = 100
 
bool server::shouldstep = true
 
int server::interm = 0
 
bool server::teamspersisted
 Whether team reshuffeling after map change is disabled. More...
 
enet_uint32 server::lastsend = 0
 
streamserver::mapdata = nullptr
 
string server::smapname = ""
 
bool server::notgotitems = true
 
vector< maprotation > server::maprotations
 
int server::curmaprotation = 0
 
vector< teamkillkick > server::teamkillkicks
 
vector< teamkillinfo > server::teamkills
 
bool server::shouldcheckteamkills = false
 
uint server::mcrc = 0
 
vector< entityserver::ments
 
vector< server_entityserver::sents
 
captureservermode server::capturemode
 
ctfservermode server::ctfmode
 
collectservermode server::collectmode
 
bombservermode server::bombmode
 
hideandseekservermode server::hideandseekmode
 
servmode * server::smode = nullptr
 
hashset< teaminfoserver::teaminfos
 
uchar msgmask [NUMMSG]
 
struct server::worldstate server::msgfilter
 
vector< worldstate > server::worldstates
 
bool server::reliablemessages = false
 
bool server::aiman::dorefresh = false
 
bool server::aiman::botbalance = true
 

Class Documentation

struct server::teamkillinfo
Class Members
uint ip
int teamkills

Macro Definition Documentation

#define QUEUE_AI   clientinfo *cm = cq;

Referenced by server::parsepacket().

#define QUEUE_BUF (   body)
Value:
{ \
if(cm) \
{ \
curmsg = p.length(); \
{ body; } \
} \
}
if(NOT DEFINED PROJECT_ARCH) message(FATAL_ERROR"You are generating from the wrong folder! \"Where is the Source
Definition: CMakeLists.txt:2

Referenced by server::parsepacket().

#define QUEUE_INT (   n)    QUEUE_BUF(putint(cm->messages, n))
#define QUEUE_MSG   { if(cm) while(curmsg<p.length()) cm->messages.add(p.buf[curmsg++]); }

Referenced by server::parsepacket().

#define QUEUE_STR (   text)    QUEUE_BUF(sendstring(text, cm->messages))

Referenced by server::parsepacket().

#define QUEUE_UINT (   n)    QUEUE_BUF(putuint(cm->messages, n))

Function Documentation

msgfilter::msgfilter ( int  msg,
  ... 
)
uchar msgfilter::operator[] ( int  msg) const

Variable Documentation

uchar msgmask[NUMMSG]