29 #include <boost/make_shared.hpp>
30 #include <boost/shared_ptr.hpp>
33 #define ERR_CF LOG_STREAM(err, log_config)
35 #define WRN_NG LOG_STREAM(warn, log_engine)
38 #define DBG_LB LOG_STREAM(info, log_lobby)
39 #define LOG_LB LOG_STREAM(info, log_lobby)
40 #define ERR_LB LOG_STREAM(err, log_lobby)
45 : timestamp(timestamp), user(user), message(message)
101 , game_id(c[
"game_id"])
103 , state(game_id == 0 ? LOBBY : GAME)
104 , registered(c[
"registered"].to_bool())
105 , observing(c[
"status"] ==
"observing")
114 if(
game_id == selected_game_id) {
120 if(current_room !=
nullptr && current_room->
is_member(
name)) {
147 if(long_name.empty())
150 bool had_space =
true;
151 for(
size_t i = 1;
i < long_name.size(); ++
i) {
152 if(long_name[
i] ==
' ') {
154 }
else if(had_space && long_name[
i] !=
'?') {
167 , map_data(game[
"map_data"])
170 , remote_scenario(false)
175 , gold(game[
"mp_village_gold"])
176 , support(game[
"mp_village_support"])
177 , xp(game[
"experience_modifier"].str() +
"%")
184 , reloaded(game[
"savegame"].to_bool())
186 ,
fog(game[
"mp_fog"].to_bool())
187 ,
shroud(game[
"mp_shroud"].to_bool())
188 , observers(game[
"observer"].to_bool(true))
192 , password_required(game[
"password"].to_bool())
194 , have_all_mods(true)
197 , display_status(NEW)
200 if(!game[
"mp_era"].empty()) {
202 = game_config.
find_child(
"era",
"id", game[
"mp_era"]);
204 symbols[
"era_id"] = game[
"mp_era"];
206 era = era_cfg[
"name"].str();
212 have_era = !game[
"require_era"].to_bool(
true);
218 era =
_(
"Unknown era");
226 if (cfg[
"require_modification"].to_bool(
false)) {
246 gamemap map(boost::make_shared<terrain_type_data>(game_config),
map_data);
249 std::ostringstream msi;
266 if(!game[
"mp_scenario"].empty()) {
270 game[
"mp_scenario"]);
273 level_cfg = &game_config.
find_child(
"generic_multiplayer",
275 game[
"mp_scenario"]);
278 scenario = (*level_cfg)[
"name"].str();
285 = game_config.
child(
"multiplayer_hashes")) {
287 bool hash_found =
false;
288 for(
const auto &
i : hashes.attribute_range())
290 if(
i.first == game[
"mp_scenario"] &&
i.second == hash) {
305 symbols[
"scenario_id"] = game[
"mp_scenario"];
323 int index = turn.find_first_of(
'/');
325 const std::string current_turn_string = turn.substr(0, index);
334 +
" " + game[
"slots"];
349 if(game[
"mp_countdown"].to_bool()) {
350 time_limit = game[
"mp_countdown_init_time"].str() +
"+"
351 + game[
"mp_countdown_turn_bonus"].str() +
"/"
352 + game[
"mp_countdown_action_bonus"].str();
427 return std::search(s1.begin(),
432 || std::search(s2.begin(),
static lg::log_domain log_lobby("lobby")
child_itors child_range(const std::string &key)
const char * display_status_string() const
std::vector< game_filter_base * > filters_
This class represents the information a client has about a room.
Add a special kind of assert to validate whether the input from WML doesn't contain any problems that...
std::deque< chat_message > history_
static lg::log_domain log_engine("engine")
const std::string unicode_multiplication_sign
const config & child_or_empty(const std::string &key) const
Returns the first child with the given key, or an empty config if there is none.
game_display_status display_status
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
To lexical_cast(From value)
Lexical cast converts one type to another.
Definitions for the interface to Wesnoth Markup Language (WML).
game_info(const config &c, const config &game_config)
bool match(const game_info &game) const
static UNUSEDNOWARN std::string _(const char *str)
std::string map_size_info
bool chars_equal_insensitive(char a, char b)
room_info(const std::string &name)
std::map< std::string, t_string > string_map
bool is_friend(const std::string &nick)
int w() const
Effective map width.
chat_message(const time_t ×tamp, const std::string &user, const std::string &message)
Create a chat message.
bool match(const game_info &game) const
std::string dev_message
The message for developers telling which problem was triggered, this shouldn't be translated...
Encapsulates the map of the game.
static UNUSEDNOWARN std::string _n(const char *str1, const char *str2, int n)
bool is_member(const std::string &user) const
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
bool is_ignored(const std::string &nick)
std::string read_map(const std::string &name)
void add_member(const std::string &user)
void add_message(const time_t ×tamp, const std::string &user, const std::string &message)
int h() const
Effective map height.
Game configuration data as global variables.
void append(game_filter_base *f)
Takes ownership.
Declarations for File-IO.
void process_room_members(const config &data)
GLuint const GLchar * name
void remove_member(const std::string &user)
std::set< std::string > members_
This class represents the info a client has about a game on the server.
To lexical_cast_default(From a, To def=To())
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 update_state(int selected_game_id, const room_info *current_room=nullptr)
config & find_child(const std::string &key, const std::string &name, const std::string &value)
Returns the first child of tag key with a name attribute containing value.
Standard logging facilities (interface).
virtual ~game_filter_stack()
static lg::log_domain log_config("config")
GLsizei GLenum GLuint GLuint GLsizei char * message
unsigned int current_turn
user_info(const config &c)
void chat_message(std::string const &caption, std::string const &msg)
Displays a message in the chat window.
A config object defines a single node in a WML file, with access to child nodes.
Helper class, don't construct this directly.
GLsizei const GLcharARB ** string