The Battle for Wesnoth  1.19.5+dev
Public Types | Public Member Functions | Private Attributes | List of all members
wesnothd::player Class Reference

#include <player.hpp>

Public Types

enum  STATUS { LOBBY , PLAYING , OBSERVING }
 

Public Member Functions

 player (const std::string &n, simple_wml::node &cfg, long id, bool registered, const std::string &version, const std::string &source, unsigned long long login_id, const std::size_t max_messages=4, const std::chrono::seconds &time_period=std::chrono::seconds{10}, const bool moderator=false)
 
void set_status (STATUS status)
 
void mark_available (const int game_id=0, const std::string &location="")
 
void mark_registered (bool registered=true)
 
bool registered () const
 
const std::string & name () const
 
const std::string & version () const
 
const std::string & source () const
 
const simple_wml::nodeconfig_address () const
 
bool is_message_flooding ()
 
void set_moderator (bool moderator)
 
bool is_moderator () const
 
unsigned long long get_login_id () const
 

Private Attributes

const std::string name_
 
std::string version_
 
std::string source_
 
simple_wml::nodecfg_
 
bool registered_
 
std::chrono::steady_clock::time_point flood_start_
 
unsigned int messages_since_flood_start_
 
const std::size_t MaxMessages
 
const std::chrono::seconds TimePeriod
 
STATUS status_
 
bool moderator_
 
unsigned long long login_id_
 

Detailed Description

Definition at line 25 of file player.hpp.

Member Enumeration Documentation

◆ STATUS

Enumerator
LOBBY 
PLAYING 
OBSERVING 

Definition at line 28 of file player.hpp.

Constructor & Destructor Documentation

◆ player()

wesnothd::player::player ( const std::string &  n,
simple_wml::node cfg,
long  id,
bool  registered,
const std::string &  version,
const std::string &  source,
unsigned long long  login_id,
const std::size_t  max_messages = 4,
const std::chrono::seconds &  time_period = std::chrono::seconds{10},
const bool  moderator = false 
)

Member Function Documentation

◆ config_address()

const simple_wml::node* wesnothd::player::config_address ( ) const
inline

Definition at line 51 of file player.hpp.

References cfg_.

Referenced by wesnothd::server::handle_join_game(), and wesnothd::server::handle_player_in_game().

◆ get_login_id()

unsigned long long wesnothd::player::get_login_id ( ) const
inline

Definition at line 58 of file player.hpp.

References login_id_.

◆ is_message_flooding()

bool wesnothd::player::is_message_flooding ( )

Definition at line 81 of file player.cpp.

◆ is_moderator()

bool wesnothd::player::is_moderator ( ) const
inline

◆ mark_available()

void wesnothd::player::mark_available ( const int  game_id = 0,
const std::string &  location = "" 
)

Definition at line 62 of file player.cpp.

Referenced by player().

◆ mark_registered()

void wesnothd::player::mark_registered ( bool  registered = true)

Definition at line 75 of file player.cpp.

◆ name()

const std::string& wesnothd::player::name ( ) const
inline

◆ registered()

bool wesnothd::player::registered ( ) const
inline

Definition at line 45 of file player.hpp.

References registered_.

Referenced by player().

◆ set_moderator()

void wesnothd::player::set_moderator ( bool  moderator)
inline

Definition at line 55 of file player.hpp.

References moderator_.

Referenced by wesnothd::server::handle_query().

◆ set_status()

void wesnothd::player::set_status ( STATUS  status)

Definition at line 42 of file player.cpp.

References LOBBY, OBSERVING, and PLAYING.

◆ source()

const std::string& wesnothd::player::source ( ) const
inline

Definition at line 50 of file player.hpp.

References source_.

Referenced by wesnothd::server::handle_player_in_game().

◆ version()

const std::string& wesnothd::player::version ( ) const
inline

Member Data Documentation

◆ cfg_

simple_wml::node& wesnothd::player::cfg_
private

Definition at line 64 of file player.hpp.

Referenced by config_address(), and player().

◆ flood_start_

std::chrono::steady_clock::time_point wesnothd::player::flood_start_
private

Definition at line 68 of file player.hpp.

◆ login_id_

unsigned long long wesnothd::player::login_id_
private

Definition at line 74 of file player.hpp.

Referenced by get_login_id().

◆ MaxMessages

const std::size_t wesnothd::player::MaxMessages
private

Definition at line 70 of file player.hpp.

◆ messages_since_flood_start_

unsigned int wesnothd::player::messages_since_flood_start_
private

Definition at line 69 of file player.hpp.

◆ moderator_

bool wesnothd::player::moderator_
private

Definition at line 73 of file player.hpp.

Referenced by is_moderator(), and set_moderator().

◆ name_

const std::string wesnothd::player::name_
private

Definition at line 61 of file player.hpp.

Referenced by name().

◆ registered_

bool wesnothd::player::registered_
private

Definition at line 66 of file player.hpp.

Referenced by registered().

◆ source_

std::string wesnothd::player::source_
private

Definition at line 63 of file player.hpp.

Referenced by source().

◆ status_

STATUS wesnothd::player::status_
private

Definition at line 72 of file player.hpp.

◆ TimePeriod

const std::chrono::seconds wesnothd::player::TimePeriod
private

Definition at line 71 of file player.hpp.

◆ version_

std::string wesnothd::player::version_
private

Definition at line 62 of file player.hpp.

Referenced by version().


The documentation for this class was generated from the following files: