Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Functions | Variables
client_management.cpp File Reference
#include <string.h>
#include <memory>
#include <enet/enet.h>
#include "inexor/fpsgame/guns.hpp"
#include "inexor/gamemode/gamemode.hpp"
#include "inexor/io/Logging.hpp"
#include "inexor/network/IsLocalConnection.hpp"
#include "inexor/network/legacy/buffer_types.hpp"
#include "inexor/network/legacy/crypto.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/gamemode/gamemode_server.hpp"
#include "inexor/server/map_management.hpp"
#include "inexor/server/network_send.hpp"
#include "inexor/shared/command.hpp"
#include "inexor/shared/cube_formatting.hpp"
#include "inexor/shared/cube_tools.hpp"
#include "inexor/shared/cube_vector.hpp"
#include "inexor/shared/tools.hpp"

Classes

struct  server::ban
 
struct  server::savedscore
 Save scores if client disconnects to restore it when he reconnects. More...
 

Namespaces

 server
 

Functions

void server::checkpausegame ()
 If no player with a high enough privilege level is on the server, resume the game. More...
 
 server::VARF (maxclients, 0, DEFAULTCLIENTS, MAXCLIENTS,{if(!maxclients) maxclients=DEFAULTCLIENTS;})
 
 server::VARF (maxdupclients, 0, 0, MAXCLIENTS,{if(serverhost) serverhost->duplicatePeers=maxdupclients?maxdupclients:MAXCLIENTS;})
 Max clients from same peer. More...
 
int server::reserveclients ()
 The amount of people who can connect more than the actual specified max clients limit. More...
 
 server::SVAR (serverpass,"")
 
 server::SVAR (adminpass,"")
 
 server::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 * server::getclientpeer (int i)
 
uint server::getclientip (int n)
 
bool server::has_clients ()
 
int server::get_num_clients ()
 
int server::numclients (int exclude=-1, bool nospec=true, bool noai=true, bool priv=false)
 List all connected clients (game players) More...
 
clientinfo * server::get_client_info (int n, bool findbots)
 
bool server::duplicatename (clientinfo *ci, const char *name)
 
const char * server::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 server::addban (uint ip, int expire)
 
void server::clearbans (clientinfo *actor)
 
void server::check_bans_expired ()
 
void server::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 server::trykick (clientinfo *ci, int victim, const char *reason, bool trial)
 
void server::cleargbans ()
 
bool server::checkgban (uint ip)
 
void server::addgban (const char *name)
 
int server::allowconnect (clientinfo *ci, const char *pwd="")
 
void server::change_mastermode (int mm, int sendernum, clientinfo *actor)
 
int server::get_mastermode_int ()
 
void server::revokemaster (clientinfo *ci)
 
bool server::setmaster (clientinfo *ci, bool val, const char *pass, bool force, bool trial)
 
savedscore * server::findscore (clientinfo *ci, bool insert)
 
void server::savescore (clientinfo *ci)
 
bool server::restorescore (clientinfo *ci)
 
void server::resetdisconnectedplayerscores ()
 New map: we throw away the scores of disconnected players. More...
 
void server::sendservinfo (clientinfo *ci)
 
void server::choosemap (clientinfo *ci)
 
void server::sendresume (clientinfo *ci)
 
void server::assign_team (clientinfo *ci)
 
void server::sendwelcome (clientinfo *ci)
 
void server::sendinitclient (clientinfo *ci)
 
bool server::player_connected (clientinfo *ci, const char *password, const char *mapwish, int modewish)
 
void server::promote_if_local_client (client *c)
 If client ci is from the same ip as this server -> make him priv_local. More...
 
client & server::add_client_connection (ENetPeer *peer)
 
void server::delete_client_connection (client *c)
 
void server::noclients ()
 
int server::clientconnect (int n, uint ip)
 
void server::disconnect_client (int n, int reason)
 
void server::check_clients_timed_out ()
 After some period of time without response we disconnect a client. More...
 

Variables

ENetHost * server::serverhost = nullptr
 
vector< client * > server::client_connections
 TODO merge with clients or connects. More...
 
vector< clientinfo * > server::connects
 
vector< clientinfo * > server::clients
 
vector< clientinfo * > server::bots
 
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. More...
 
vector< uintserver::allowedips
 allowed IPs: mastermode locked allows some players to be unspectated immediately? More...
 
vector< ban > server::bannedips
 
vector< ipmaskserver::gbans
 
int server::mastermode = MM_OPEN
 
int server::mastermask = MM_PRIVSERV
 
vector< savedscore > server::scores
 
SharedVar< char * > server::serverdesc
 
SharedVar< char * > server::servermotd
 

Class Documentation

struct server::ban
Class Members
int expire
uint ip
int time