29 #define ERR_CF LOG_STREAM(err, log_config)
31 #define WRN_NG LOG_STREAM(warn, log_engine)
34 #define DBG_LB LOG_STREAM(debug, log_lobby)
35 #define LOG_LB LOG_STREAM(info, log_lobby)
36 #define WRN_LB LOG_STREAM(warn, log_lobby)
37 #define ERR_LB LOG_STREAM(err, log_lobby)
38 #define SCOPE_LB log_scope2(log_lobby, __func__)
42 : game_config_(game_config)
44 , gamelist_initialized_(false)
53 , game_filter_invert_(false)
55 , wesnothd_connection_(wesnothd_connection)
78 for(
const auto &
v : games)
81 ss <<
"G" << game.
id <<
"(" << game.
name <<
") "
93 ss <<
"g" <<
c[
"id"] <<
"(" <<
c[
"name"] <<
") "
132 ERR_LB <<
"Error while applying the gamelist diff: '" << e.
message
133 <<
"' Getting a new gamelist.\n";
142 DBG_LB <<
"data process: " << c[
"id"] <<
" ("
144 int game_id = c[
"id"];
146 ERR_LB <<
"game with id 0 in gamelist config" << std::endl;
152 if(diff_result ==
"new" || diff_result ==
"modified") {
161 }
else if(diff_result ==
"deleted") {
163 WRN_LB <<
"Would have to delete a game that I don't have: "
184 ERR_LB <<
"Error while applying the gamelist diff (2): '" << e.
message
185 <<
"' Getting a new gamelist.\n";
204 if(ui.game_id != 0) {
207 WRN_NG <<
"User " << ui.name
208 <<
" has unknown game_id: " << ui.game_id <<
"\n";
210 switch(ui.relation) {
227 DBG_LB <<
"lobby_info::sync_games_display_status";
250 std::map<int, game_info*>::const_iterator
i =
games_by_id_.find(
id);
294 DBG_LB <<
"lobby info: closing room " << name <<
" "
295 <<
static_cast<void*
>(
r) <<
"\n";
354 user.update_state(game_id, room);
413 }
else if(by_relation) {
void close_room(const std::string &name)
child_itors child_range(const std::string &key)
const char * display_status_string() const
bool has_room(const std::string &name) const
This class represents the information a client has about a room.
std::map< std::string, chat_log > whispers_
this class memorizes a chat session.
lobby_info(const config &game_config, twesnothd_connection &)
game_info * get_game_by_id(int id)
Add a special kind of assert to validate whether the input from WML doesn't contain any problems that...
std::vector< bool > games_visibility_
game_info_map games_by_id_
std::vector< game_info * > games_filtered_
void open_room(const std::string &name)
game_filter_and_stack game_filter_
bool operator()(const user_info *u1, const user_info *u2)
const std::vector< game_info * > & games_filtered() const
game_display_status display_status
void clear_diff_track(const config &diff)
Clear any tracking info from a previous apply_diff call with tracking.
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
Definitions for the interface to Wesnoth Markup Language (WML).
This class represents the information a client has about another player.
void set_game_filter_invert(bool value)
void send_data(const configr_of &request)
std::map< int, game_info * > game_info_map
A class that represents a TCP/IP connection to the wesnothd server.
bool gamelist_initialized_
std::vector< game_info * > games_
GLsizei const GLfloat * value
static lg::log_domain log_engine("engine")
bool operator()(const user_info &u1, const user_info &u2)
static lg::log_domain log_lobby("lobby")
bool match(const game_info &game) const
void update_user_statuses(int game_id, const room_info *room)
static lg::log_domain log_config("config")
const config & game_config_
void apply_diff(const config &diff, bool track=false)
A function to apply a diff config onto this config object.
void show(CVideo &video, const std::string &window_id, const t_string &message, const tpoint &mouse)
Shows a tip.
void sync_games_display_status()
chat_log & get_whisper_log(const std::string &name)
Game configuration data as global variables.
twesnothd_connection & wesnothd_connection_
bool operator()(const user_info &u1, const user_info &u2)
std::pair< child_iterator, child_iterator > child_itors
void append(game_filter_base *f)
Takes ownership.
GLdouble GLdouble GLdouble r
bool operator()(const user_info *u1, const user_info *u2)
static int sort(lua_State *L)
GLuint const GLchar * name
bool operator()(const user_info &u1, const user_info &u2)
static const char * diff_track_attribute
The name of the attribute used for tracking diff changes.
void add_game_filter(game_filter_base *f)
void sort_users(bool by_name, bool by_relation)
This class represents the info a client has about a game on the server.
bool operator()(const user_info *u1, const user_info *u2)
config & child(const std::string &key, int n=0)
Returns the nth child with the given key, or a reference to an invalid config if there is none...
void process_gamelist(const config &data)
Process a full gamelist.
Standard logging facilities (interface).
std::vector< user_info * > users_sorted_
std::vector< room_info > rooms_
std::vector< user_info > users_
GLuint GLdouble GLdouble u2
A config object defines a single node in a WML file, with access to child nodes.
GLsizei const GLcharARB ** string
room_info * get_room(const std::string &name)
const std::vector< user_info * > & users_sorted() const
bool process_gamelist_diff(const config &data)
Process a gamelist diff.