The Battle for Wesnoth  1.15.2+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, bool registered, const std::string &version, const std::string &source, const std::size_t max_messages=4, const std::size_t time_period=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
 

Private Attributes

const std::string name_
 
std::string version_
 
std::string source_
 
simple_wml::nodecfg_
 
bool registered_
 
std::time_t flood_start_
 
unsigned int messages_since_flood_start_
 
const std::size_t MaxMessages
 
const std::time_t TimePeriod
 
STATUS status_
 
bool moderator_
 

Detailed Description

Definition at line 24 of file player.hpp.

Member Enumeration Documentation

◆ STATUS

Enumerator
LOBBY 
PLAYING 
OBSERVING 

Definition at line 27 of file player.hpp.

Constructor & Destructor Documentation

◆ player()

wesnothd::player::player ( const std::string &  n,
simple_wml::node cfg,
bool  registered,
const std::string &  version,
const std::string &  source,
const std::size_t  max_messages = 4,
const std::size_t  time_period = 10,
const bool  moderator = false 
)

Member Function Documentation

◆ config_address()

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

Definition at line 50 of file player.hpp.

References cfg_, and is_message_flooding().

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

◆ is_message_flooding()

bool wesnothd::player::is_message_flooding ( )

Definition at line 79 of file player.cpp.

References flood_start_, MaxMessages, messages_since_flood_start_, and TimePeriod.

Referenced by config_address().

◆ is_moderator()

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

Definition at line 55 of file player.hpp.

References moderator_.

Referenced by wesnothd::server::adminmsg_handler(), and wesnothd::server::handle_query().

◆ mark_available()

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

Definition at line 60 of file player.cpp.

References cfg_, LOBBY, simple_wml::node::set_attr(), simple_wml::node::set_attr_dup(), and set_status().

Referenced by player().

◆ mark_registered()

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

Definition at line 73 of file player.cpp.

References cfg_, registered(), registered_, and simple_wml::node::set_attr().

◆ name()

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

◆ registered()

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

Definition at line 44 of file player.hpp.

References registered_.

Referenced by mark_registered().

◆ set_moderator()

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

Definition at line 54 of file player.hpp.

References moderator_.

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

◆ set_status()

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

Definition at line 40 of file player.cpp.

References cfg_, LOBBY, OBSERVING, PLAYING, simple_wml::node::set_attr(), and status_.

Referenced by mark_available().

◆ source()

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

Definition at line 49 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 61 of file player.hpp.

Referenced by config_address(), mark_available(), mark_registered(), player(), and set_status().

◆ flood_start_

std::time_t wesnothd::player::flood_start_
private

Definition at line 65 of file player.hpp.

Referenced by is_message_flooding().

◆ MaxMessages

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

Definition at line 67 of file player.hpp.

Referenced by is_message_flooding().

◆ messages_since_flood_start_

unsigned int wesnothd::player::messages_since_flood_start_
private

Definition at line 66 of file player.hpp.

Referenced by is_message_flooding().

◆ moderator_

bool wesnothd::player::moderator_
private

Definition at line 70 of file player.hpp.

Referenced by is_moderator(), and set_moderator().

◆ name_

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

Definition at line 58 of file player.hpp.

Referenced by name().

◆ registered_

bool wesnothd::player::registered_
private

Definition at line 63 of file player.hpp.

Referenced by mark_registered(), and registered().

◆ source_

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

Definition at line 60 of file player.hpp.

Referenced by source().

◆ status_

STATUS wesnothd::player::status_
private

Definition at line 69 of file player.hpp.

Referenced by set_status().

◆ TimePeriod

const std::time_t wesnothd::player::TimePeriod
private

Definition at line 68 of file player.hpp.

Referenced by is_message_flooding().

◆ version_

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

Definition at line 59 of file player.hpp.

Referenced by version().


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