18 #include "addon/manager.hpp"
24 #define WRN_NG LOG_STREAM(warn, log_engine)
27 #define DBG_LB LOG_STREAM(debug, log_lobby)
28 #define WRN_LB LOG_STREAM(warn, log_lobby)
29 #define ERR_LB LOG_STREAM(err, log_lobby)
30 #define SCOPE_LB log_scope2(log_lobby, __func__)
37 , gamelist_initialized_(false)
42 , game_filter_invert_()
92 for(
const auto& v : games) {
93 const game_info&
game = v.second;
94 ss <<
"G" <<
game.id <<
"(" <<
game.name <<
") " <<
game.display_status_string() <<
" ";
101 std::string dump_games_config(
const config& gamelist)
103 std::stringstream ss;
157 ERR_LB <<
"Error while applying the gamelist diff: '" <<
e.message <<
"' Getting a new gamelist.";
167 const int game_id =
c[
"id"].to_int();
169 ERR_LB <<
"game with id 0 in gamelist config";
177 if(diff_result ==
"new" || diff_result ==
"modified") {
191 }
else if(diff_result ==
"deleted") {
193 WRN_LB <<
"Would have to delete a game that I don't have: " << game_id;
212 ERR_LB <<
"Error while applying the gamelist diff (2): '" <<
e.message <<
"' Getting a new gamelist.";
242 g->has_friends =
true;
245 g->has_ignored =
true;
263 DBG_LB <<
"lobby_info, second state sync stage";
301 for(
auto& user :
users_) {
302 if(user.name == name) {
316 games_.push_back(&v.second);
342 for(
unsigned i = 0;
i <
games_.size(); ++
i) {
std::vector< std::string > installed_addons()
Retrieves the names of all installed add-ons.
A config object defines a single node in a WML file, with access to child nodes.
config & mandatory_child(config_key_type key, int n=0)
Returns the nth child with the given key, or throws an error if there is none.
static const char * diff_track_attribute
The name of the attribute used for tracking diff changes.
child_itors child_range(config_key_type key)
void apply_diff(const config &diff, bool track=false)
A function to apply a diff config onto this config object.
void clear_diff_track(const config &diff)
Clear any tracking info from a previous apply_diff call with tracking.
std::function< bool(bool)> game_filter_invert_
bool gamelist_initialized_
bool is_game_visible(const game_info &)
Returns whether the game would be visible after the game filters are applied.
bool process_gamelist_diff_impl(const config &data)
void process_gamelist(const config &data)
Process a full game list.
bool process_gamelist_diff(const config &data)
Process a gamelist diff.
void refresh_installed_addons_cache()
std::function< void()> begin_state_sync()
Updates the game pointer list and returns a second stage cleanup function to be called after any acti...
game_info * get_game_by_id(int id)
Returns info on a game with the given game ID.
game_info_map games_by_id_
void make_games_vector()
Generates a new vector of game pointers from the ID/game map.
std::vector< user_info > users_
user_info * get_user(const std::string &name)
Returns info on the user with the given name, or nullptr if they don't eixst.
std::vector< game_info * > games_
boost::dynamic_bitset games_visibility_
std::map< int, game_info > game_info_map
void apply_game_filter()
Generates a new list of games that match the current filter functions and inversion setting.
std::vector< game_filter_func > game_filters_
std::vector< std::string > installed_addons_
static lg::log_domain log_engine("engine")
static lg::log_domain log_lobby("lobby")
Standard logging facilities (interface).
void public_message(bool is_lobby, const std::string &sender, const std::string &message)
void game_created(const std::string &scenario, const std::string &name)
void private_message(bool is_lobby, const std::string &sender, const std::string &message)
void player_joins(bool is_lobby)
void friend_message(bool is_lobby, const std::string &sender, const std::string &message)
void server_message(bool is_lobby, const std::string &sender, const std::string &message)
void player_leaves(bool is_lobby)
Main entry points of multiplayer mode.
void do_notify(notify_mode mode, const std::string &sender, const std::string &message)
This class represents the info a client has about a game on the server.
This class represents the information a client has about another player.
user_relation get_relation() const