Public Member Functions | Private Attributes

wesnothd::room Class Reference

A room is a group of players that can communicate via messages. More...

#include <room.hpp>

Collaboration diagram for wesnothd::room:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 room (const std::string &name)
 Construct a room with just a name and default settings.
 room (const config &cfg)
 Construct a room from WML.
void write (config &cfg) const
 Write room info to a config.
const std::string & name () const
 The name of this room.
bool persistent () const
 Whether this room should be 'persistent', i.e.
void set_persistent (bool v)
 Set the persistent flag for this room.
bool logged () const
 Whether the room is logged (and might end up in e.g.
void set_logged (bool v)
 Set the room's logged flag.
const std::string & topic () const
 This room's topic/motd, sent to all joining players.
void set_topic (const std::string &v)
 Set the topic for this room.
size_t size () const
 Return the number of players in this room.
bool empty () const
 Return true iif the room is empty.
const std::vector
< network::connection > & 
members () const
 Return the members of this room.
bool is_member (network::connection player) const
 Membership checker.
bool add_player (network::connection player)
 Joining the room.
void remove_player (network::connection player)
 Leaving the room.
void process_message (simple_wml::document &data, const player_map::iterator user)
 Chat message processing.
void send_data (simple_wml::document &data, const network::connection exclude=0, std::string packet_type="") const
 Convenience function for sending a wml document to all (or all except one) members.
void send_server_message_to_all (const char *message, network::connection exclude=0) const
 Send a text message to all members.
void send_server_message_to_all (const std::string &message, network::connection exclude=0) const
void send_server_message (const char *message, network::connection sock, simple_wml::document *docptr=NULL) const
 Prepare a text message and/or send it to a player.
void send_server_message (const std::string &message, network::connection sock, simple_wml::document *docptr=NULL) const

Private Attributes

std::string name_
connection_vector members_
bool persistent_
std::string topic_
bool logged_

Detailed Description

A room is a group of players that can communicate via messages.

Definition at line 32 of file room.hpp.


Constructor & Destructor Documentation

wesnothd::room::room ( const std::string &  name  ) 

Construct a room with just a name and default settings.

Definition at line 31 of file room.cpp.

wesnothd::room::room ( const config cfg  ) 

Construct a room from WML.

Definition at line 40 of file room.cpp.


Member Function Documentation

bool wesnothd::room::add_player ( network::connection  player  ) 

Joining the room.

Returns:
true if the player was successfully added

Definition at line 92 of file room.cpp.

References ERR_ROOM, is_member(), and members_.

Referenced by wesnothd::room_manager::enter_lobby(), and wesnothd::room_manager::player_enters_room().

Here is the call graph for this function:

Here is the caller graph for this function:

bool wesnothd::room::empty (  )  const [inline]

Return true iif the room is empty.

Definition at line 95 of file room.hpp.

References members_.

Referenced by wesnothd::room_manager::process_room_part().

Here is the caller graph for this function:

bool wesnothd::room::is_member ( network::connection  player  )  const [inline]

Membership checker.

Returns:
true iif player is a member of this room

Definition at line 110 of file room.hpp.

References gui2::event::find(), and members_.

Referenced by add_player(), wesnothd::room_manager::in_lobby(), wesnothd::room_manager::player_enters_room(), and wesnothd::room_manager::require_member().

Here is the call graph for this function:

Here is the caller graph for this function:

bool wesnothd::room::logged (  )  const

Whether the room is logged (and might end up in e.g.

the lobby bot

Definition at line 82 of file room.cpp.

References logged_.

Referenced by wesnothd::room_manager::process_message().

Here is the caller graph for this function:

const std::vector<network::connection>& wesnothd::room::members (  )  const [inline]

Return the members of this room.

Definition at line 102 of file room.hpp.

References members_.

Referenced by wesnothd::room_manager::fill_member_list(), wesnothd::room_manager::fill_room_list(), and send_data().

Here is the caller graph for this function:

const std::string & wesnothd::room::name (  )  const

The name of this room.

Definition at line 57 of file room.cpp.

References name_.

Referenced by wesnothd::room_manager::fill_room_list(), wesnothd::room_manager::read_rooms(), and wesnothd::room_manager::store_player_rooms().

Here is the caller graph for this function:

bool wesnothd::room::persistent (  )  const

Whether this room should be 'persistent', i.e.

not deleted when there are no players within and stored on disk if needed.

Definition at line 62 of file room.cpp.

References persistent_.

Referenced by wesnothd::room_manager::process_room_part(), wesnothd::room_manager::process_room_query(), and wesnothd::room_manager::write_rooms().

Here is the caller graph for this function:

void wesnothd::room::process_message ( simple_wml::document data,
const player_map::iterator  user 
)

Chat message processing.

Definition at line 148 of file room.cpp.

void wesnothd::room::remove_player ( network::connection  player  ) 

Leaving the room.

Definition at line 103 of file room.cpp.

References ERR_ROOM, gui2::event::find(), and members_.

Referenced by wesnothd::room_manager::exit_lobby(), wesnothd::room_manager::player_exits_room(), and wesnothd::room_manager::remove_player().

Here is the call graph for this function:

Here is the caller graph for this function:

void wesnothd::room::send_data ( simple_wml::document data,
const network::connection  exclude = 0,
std::string  packet_type = "" 
) const

Convenience function for sending a wml document to all (or all except one) members.

See also:
send_to_many
Parameters:
data the document to send
exclude if nonzero, do not send to this player
packet_type the packet type, if empty the root node name is used

Definition at line 116 of file room.cpp.

References members(), and wesnothd::send_to_many().

Referenced by wesnothd::room_manager::process_message(), wesnothd::room_manager::process_room_join(), wesnothd::room_manager::process_room_part(), send_server_message_to_all(), and wesnothd::room_manager::unstore_player_rooms().

Here is the call graph for this function:

Here is the caller graph for this function:

void wesnothd::room::send_server_message ( const char *  message,
network::connection  sock,
simple_wml::document docptr = NULL 
) const

Prepare a text message and/or send it to a player.

If a nonzero sock is passed, the message is sent to this player. If a non-null pointer to a simple_wml::document is passed, the message is stored in that document.

Parameters:
message the message text
sock the socket to send the message to, if nonzero
docptr the wml document to store the message in, if nonnull

Definition at line 130 of file room.cpp.

References game_logic::msg(), simple_wml::document::root(), wesnothd::send_to_one(), simple_wml::node::set_attr(), and simple_wml::node::set_attr_dup().

Referenced by wesnothd::room_manager::get_create_room(), wesnothd::room_manager::player_enters_room(), wesnothd::room_manager::process_message(), wesnothd::room_manager::process_room_part(), wesnothd::room_manager::process_room_query(), wesnothd::room_manager::require_member(), wesnothd::room_manager::require_room(), send_server_message(), and send_server_message_to_all().

Here is the call graph for this function:

Here is the caller graph for this function:

void wesnothd::room::send_server_message ( const std::string &  message,
network::connection  sock,
simple_wml::document docptr = NULL 
) const [inline]

Definition at line 163 of file room.hpp.

References send_server_message().

Here is the call graph for this function:

void wesnothd::room::send_server_message_to_all ( const char *  message,
network::connection  exclude = 0 
) const

Send a text message to all members.

Parameters:
message the message text
exclude if nonzero, do not send to this player

Definition at line 123 of file room.cpp.

References send_data(), and send_server_message().

Referenced by send_server_message_to_all().

Here is the call graph for this function:

Here is the caller graph for this function:

void wesnothd::room::send_server_message_to_all ( const std::string &  message,
network::connection  exclude = 0 
) const [inline]

Definition at line 146 of file room.hpp.

References send_server_message_to_all().

Here is the call graph for this function:

void wesnothd::room::set_logged ( bool  v  ) 

Set the room's logged flag.

Definition at line 87 of file room.cpp.

References logged_.

Referenced by wesnothd::room_manager::process_room_query(), and wesnothd::room_manager::read_rooms().

Here is the caller graph for this function:

void wesnothd::room::set_persistent ( bool  v  ) 

Set the persistent flag for this room.

Definition at line 67 of file room.cpp.

References persistent_.

Referenced by wesnothd::room_manager::process_room_query(), and wesnothd::room_manager::read_rooms().

Here is the caller graph for this function:

void wesnothd::room::set_topic ( const std::string &  v  ) 

Set the topic for this room.

Definition at line 77 of file room.cpp.

References topic_.

Referenced by wesnothd::room_manager::process_room_query().

Here is the caller graph for this function:

size_t wesnothd::room::size (  )  const [inline]

Return the number of players in this room.

Definition at line 88 of file room.hpp.

References members_.

const std::string & wesnothd::room::topic (  )  const

This room's topic/motd, sent to all joining players.

Definition at line 72 of file room.cpp.

References topic_.

Referenced by wesnothd::room_manager::process_room_join(), wesnothd::room_manager::process_room_query(), and wesnothd::room_manager::unstore_player_rooms().

Here is the caller graph for this function:

void wesnothd::room::write ( config cfg  )  const

Write room info to a config.

Definition at line 49 of file room.cpp.

References logged_, name_, persistent_, and topic_.

Referenced by wesnothd::room_manager::write_rooms().

Here is the caller graph for this function:


Member Data Documentation

bool wesnothd::room::logged_ [private]

Definition at line 175 of file room.hpp.

Referenced by logged(), set_logged(), and write().

Definition at line 172 of file room.hpp.

Referenced by add_player(), empty(), is_member(), members(), remove_player(), and size().

std::string wesnothd::room::name_ [private]

Definition at line 171 of file room.hpp.

Referenced by name(), and write().

Definition at line 173 of file room.hpp.

Referenced by persistent(), set_persistent(), and write().

std::string wesnothd::room::topic_ [private]

Definition at line 174 of file room.hpp.

Referenced by set_topic(), topic(), and write().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:27:00 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs