The Battle for Wesnoth  1.15.7+dev
mp_join_game.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2018 by the Battle for Wesnoth Project https://www.wesnoth.org/
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY.
10 
11  See the COPYING file for more details.
12 */
13 
14 #define GETTEXT_DOMAIN "wesnoth-lib"
15 
17 
18 #include "chat_log.hpp"
19 #include "font/text_formatting.hpp"
20 #include "formatter.hpp"
21 #include "formula/string_utils.hpp"
22 #include "game_config.hpp"
23 #include "game_config_manager.hpp"
26 #include "gettext.hpp"
28 #include "gui/core/timer.hpp"
32 #include "gui/widgets/button.hpp"
33 #include "gui/widgets/chatbox.hpp"
35 #include "gui/widgets/image.hpp"
36 #include "gui/widgets/label.hpp"
37 #include "gui/widgets/listbox.hpp"
38 #include "gui/widgets/settings.hpp"
41 #include "log.hpp"
42 #include "mp_ui_alerts.hpp"
43 #include "statistics.hpp"
44 #include "units/types.hpp"
45 #include "utils/scope_exit.hpp"
46 #include "wesnothd_connection.hpp"
47 
48 static lg::log_domain log_mp_connect_engine("mp/connect/engine");
49 #define DBG_MP LOG_STREAM(debug, log_mp_connect_engine)
50 #define LOG_MP LOG_STREAM(info, log_mp_connect_engine)
51 #define WRN_MP LOG_STREAM(warn, log_mp_connect_engine)
52 #define ERR_MP LOG_STREAM(err, log_mp_connect_engine)
53 
54 namespace gui2
55 {
56 namespace dialogs
57 {
58 
59 REGISTER_DIALOG(mp_join_game)
60 
61 mp_join_game::mp_join_game(saved_game& state, wesnothd_connection& connection, const bool first_scenario, const bool observe_game)
62  : level_()
63  , state_(state)
64  , network_connection_(connection)
65  , update_timer_(0)
66  , first_scenario_(first_scenario)
67  , observe_game_(observe_game)
68  , stop_updates_(false)
69  , player_list_(nullptr)
70  , flg_dialog_(nullptr)
71 {
72  set_show_even_without_video(true);
73 }
74 
76 {
77  if(update_timer_ != 0) {
79  update_timer_ = 0;
80  }
81 }
82 
83 /*
84  * Fetch the selected game's config from the server and prompts an initial faction selection.
85  */
87 {
88  // Ask for the next scenario data, if applicable
89  if(!first_scenario_) {
90  network_connection_.send_data(config("load_next_scenario"));
91  }
92 
93  bool has_scenario_and_controllers = false;
94  while(!has_scenario_and_controllers) {
95  config revc;
96  bool data_res = false;
97 
100 
102  });
103 
104  if(!data_res) {
105  // NOTE: there used to be a function after this that would throw wesnothd_error if data_res was false.
106  // However, this block here already handles that case. Dunno if we ever need this exception again.
107  // throw wesnothd_error(_("Connection timed out"));
108  return false;
109  }
110 
111  if(const config& err = revc.child("error")) {
112  throw wesnothd_error(err["message"]);
113  } else if(revc.child("leave_game")) {
114  return false;
115  } else if(config& next_scenario = revc.child("next_scenario")) {
117  } else if(revc.has_attribute("version")) {
118  level_.swap(revc);
119 
120  has_scenario_and_controllers = true;
121  } else if(config& controllers = revc.child("controllers")) {
122  int index = 0;
123  for(const config& controller : controllers.child_range("controller")) {
124  if(config& side = get_scenario().child("side", index)) {
125  side["is_local"] = controller["is_local"];
126  }
127  ++index;
128  }
129 
130  has_scenario_and_controllers = true;
131  }
132  }
133 
134  if(level_["started"].to_bool()) {
136  return true;
137  }
138 
139  if(first_scenario_) {
140  state_.clear();
142 
143  // Make sure that we have the same config as host, if possible.
145  }
146 
148 
149  // If we're just an observer, we don't need to find an appropriate side and set faction selection
150  if(observe_game_) {
151  return true;
152  }
153 
154  // Search for an appropriate vacant slot. If a description is set (i.e. we're loading from a saved game),
155  // then prefer to get the side with the same description as our login. Otherwise just choose the first
156  // available side.
157  const config* side_choice = nullptr;
158 
159  int side_num_choice = 1, side_num_counter = 1;
160  for(const config& side : get_scenario().child_range("side")) {
161  // TODO: it can happen that the scenario specifies that the controller
162  // of a side should also gain control of another side.
163  if(side["controller"] == "reserved" && side["current_player"] == preferences::login()) {
164  side_choice = &side;
165  side_num_choice = side_num_counter;
166  break;
167  }
168 
169  if(side["controller"] == "human" && side["player_id"].empty()) {
170  if(!side_choice) { // Found the first empty side
171  side_choice = &side;
172  side_num_choice = side_num_counter;
173  }
174 
175  if(side["current_player"] == preferences::login()) {
176  side_choice = &side;
177  side_num_choice = side_num_counter;
178  break; // Found the preferred one
179  }
180  }
181 
182  if(side["player_id"] == preferences::login()) {
183  // We already own a side in this game
184  return true;
185  }
186 
187  ++side_num_counter;
188  }
189 
190  if(!side_choice) {
191  observe_game_ = true;
192  return true;
193  }
194 
195  // If the client is allowed to choose their team, do that here instead of having it set by the server
196  if((*side_choice)["allow_changes"].to_bool(true)) {
197  if(!show_flg_select(side_num_choice, true)) {
198  return false;
199  }
200  }
201 
202  return true;
203 }
204 
206 {
207  // Allow the host to override, since only the host knows the ai_algorithm.
208  if(const config::attribute_value* desc = side.get("user_description")) {
209  return desc->str();
210  }
211 
212  const std::string controller_type = side["controller"].str();
213  const std::string reservation = side["current_player"].str();
214  const std::string owner = side["player_id"].str();
215 
216  if(controller_type == "ai") {
217  return _("Computer Player");
218  } else if(controller_type == "null") {
219  return _("Empty slot");
220  } else if(controller_type == "reserved") {
221  return VGETTEXT("Reserved for $playername", {{"playername", reservation}});
222  } else if(owner.empty()) {
223  return _("Vacant slot");
224  } else if(controller_type == "human" || controller_type == "network") {
225  return owner;
226  } else {
227  return _("empty");
228  }
229 }
230 
232 {
233  window.set_enter_disabled(true);
234  window.set_escape_disabled(true);
235 
236  //
237  // Set title
238  //
239  label& title = find_widget<label>(&window, "title", false);
240  title.set_label((formatter() << title.get_label() << " " << font::unicode_em_dash << " " << get_scenario()["name"].t_str()).str());
241 
242  //
243  // Set up sides list
244  //
246 
247  //
248  // Initialize chatbox and game rooms
249  //
250  chatbox& chat = find_widget<chatbox>(&window, "chat", false);
251 
253 
254  chat.room_window_open(N_("this game"), true, false);
255  chat.active_window_changed();
256  chat.load_log(default_chat_log, false);
257 
258  //
259  // Set up player list
260  //
261  player_list_.reset(new player_list_helper(&window));
262 
263  //
264  // Set up the network handling
265  //
267 
268  //
269  // Set up the Lua plugin context
270  //
271  plugins_context_.reset(new plugins_context("Multiplayer Join"));
272 
273  plugins_context_->set_callback("launch", [&window](const config&) { window.set_retval(retval::OK); }, false);
274  plugins_context_->set_callback("quit", [&window](const config&) { window.set_retval(retval::CANCEL); }, false);
275  plugins_context_->set_callback("chat", [&chat](const config& cfg) { chat.send_chat_message(cfg["message"], false); }, true);
276 }
277 
278 bool mp_join_game::show_flg_select(int side_num, bool first_time)
279 {
280  if(const config& side_choice = get_scenario().child("side", side_num - 1)) {
281  if(!side_choice["allow_changes"].to_bool(true)) {
282  return true;
283  }
284 
285  const config& era = level_.child("era");
286  if(!era) {
287  ERR_MP << "no era information\n";
288  return false;
289  }
290 
291  config::const_child_itors possible_sides = era.child_range("multiplayer_side");
292  if(possible_sides.empty()) {
293  WRN_MP << "no [multiplayer_side] found in era '" << era["id"] << "'.\n";
294  return false;
295  }
296 
297  const std::string color = side_choice["color"].str();
298 
299  std::vector<const config*> era_factions;
300  //make this safe against changes to level_ that might make possible_sides invalid pointers.
301  config era_copy;
302  for(const config& side : possible_sides) {
303  config& side_new = era_copy.add_child("multiplayer_side", side);
304  era_factions.push_back(&side_new);
305  }
306 
307  const bool is_mp = state_.classification().is_normal_mp_game();
308  const bool lock_settings = get_scenario()["force_lock_settings"].to_bool(!is_mp);
309  const bool use_map_settings = level_.child("multiplayer")["mp_use_map_settings"].to_bool();
310  const mp_game_settings::SAVED_GAME_MODE saved_game = level_.child("multiplayer")["savegame"].to_enum<mp_game_settings::SAVED_GAME_MODE>(mp_game_settings::SAVED_GAME_MODE::NONE);
311 
312  ng::flg_manager flg(era_factions, side_choice, lock_settings, use_map_settings, saved_game == mp_game_settings::SAVED_GAME_MODE::MIDGAME);
313 
314  {
315  gui2::dialogs::faction_select flg_dialog(flg, color, side_num);
316  flg_dialog_ = &flg_dialog;
317  utils::scope_exit se([this]() { flg_dialog_ = nullptr; });
318 
319  if(!flg_dialog.show() && !first_time) {
320  return true;
321  }
322  }
323 
324  config faction;
325  config& change = faction.add_child("change_faction");
326  change["change_faction"] = true;
327  change["name"] = preferences::login();
328  change["faction"] = flg.current_faction()["id"];
329  change["leader"] = flg.current_leader();
330  change["gender"] = flg.current_gender();
331  // TODO: the host cannot yet handle this and always uses the first side owned by that player.
332  change["side_num"] = side_num;
333 
335  }
336 
337  return true;
338 }
339 
341 {
342  if(stop_updates_) {
343  return;
344  }
345 
346  tree_view& tree = find_widget<tree_view>(get_window(), "side_list", false);
347 
348  tree.clear();
349  team_tree_map_.clear();
350  const std::map<std::string, string_map> empty_map;
351 
352  int side_num = 0;
353  for(const auto& side : get_scenario().child_range("side")) {
354  ++side_num;
355  if(!side["allow_player"].to_bool(true)) {
356  continue;
357  }
358 
359  // Check to see whether we've added a toplevel tree node for this team. If not, add one
360  if(team_tree_map_.find(side["team_name"].str()) == team_tree_map_.end()) {
361  std::map<std::string, string_map> data;
363 
364  item["label"] = (formatter() << _("Team:") << " " << t_string::from_serialized(side["user_team_name"])).str();
365  data.emplace("tree_view_node_label", item);
366 
367  tree_view_node& team_node = tree.add_node("team_header", data);
368  team_node.add_sibling("side_spacer", empty_map);
369 
370  team_tree_map_[side["team_name"].str()] = &team_node;
371  }
372 
373  std::map<std::string, string_map> data;
375 
376  const std::string color = !side["color"].empty() ? side["color"] : side["side"].str();
377 
378  item["label"] = (formatter() << "<span color='" << font::get_pango_color_from_id(color) << "'>" << side["side"] << "</span>").str();
379  data.emplace("side_number", item);
380 
381  std::string leader_image = ng::random_enemy_picture;
382  std::string leader_type = side["type"];
383  std::string leader_gender = side["gender"];
384  std::string leader_name;
385 
386  // If there is a unit which can recruit, use it as a leader.
387  // Necessary to display leader information when loading saves.
388  for(const config& side_unit : side.child_range("unit")) {
389  if(side_unit["canrecruit"].to_bool()) {
390  leader_type = side_unit["type"].str();
391  leader_gender = side_unit["gender"].str();
392  break;
393  }
394  }
395 
396  if(const unit_type* ut = unit_types.find(leader_type)) {
397  const unit_type& type = ut->get_gender_unit_type(leader_gender);
398 
399  leader_image = formatter() << type.image() << "~RC(" << type.flag_rgb() << ">" << color << ")";
400  leader_name = type.type_name();
401  }
402 
403  item["label"] = leader_image;
404  data.emplace("leader_image", item);
405 
406  std::string description = generate_user_description(side);
407  if(!leader_name.empty()) {
408  description += formatter() << " (<i>" << leader_name << "</i>)";
409  }
410 
411  item["label"] = description;
412  data.emplace("leader_type", item);
413 
414  item["label"] = (formatter() << "<span color='#a69275'>" << side["faction_name"] << "</span>").str();
415  data.emplace("leader_faction", item);
416 
417  std::string gender_icon = "icons/icon-random.png";
418  if(leader_gender != "null") {
419  gender_icon = formatter() << "icons/icon-" << leader_gender << ".png";
420  item["tooltip"] = leader_gender;
421  }
422 
423  item["label"] = gender_icon;
424  data.emplace("leader_gender", item);
425 
426  item.clear();
427 
428  // Don't show gold for saved games
429  // TODO: gold icon
430  if(side["allow_changes"].to_bool()) {
431  item["label"] = side["gold"].str() + " " + _("Gold");
432  data.emplace("side_gold", item);
433  }
434 
435  const int income_amt = side["income"];
436  if(income_amt != 0) {
437  const std::string income_string = formatter() << (income_amt > 0 ? "+" : "") << income_amt << " " << _("Income");
438 
439  item["label"] = income_string;
440  data.emplace("side_income", item);
441  }
442 
443  tree_view_node& node = team_tree_map_[side["team_name"].str()]->add_child("side_panel", data);
444 
445  grid& row_grid = node.get_grid();
446 
447  auto* select_leader_button = find_widget<button>(&row_grid, "select_leader", false, false);
448  if(select_leader_button) {
449  if(side["player_id"] == preferences::login() && side["allow_changes"].to_bool(true)) {
450  //
451  // Small wrapper function in order to set the handled and halt parameters and prevent
452  // crashes in case the dialog closes and the original button to which the callback was
453  // bound had already been destroyed. The other use of show_flg_select doesn't need these
454  // parameters, so it's easier not to declare them as function arguments.
455  //
456  const auto handler = [this, side_num](bool& handled, bool& halt) {
457  show_flg_select(side_num);
458  // note: this function is called from a std::function object stored in the widget
459  // and show_flg_select which internally calls
460  // show_dialog -> pump -> ... -> network_handler -> ... -> generate_side_list
461  // might destroy that std::function object while it is executed, this means that
462  // using the captured variables 'this' and 'side_num' after this will result in
463  // unexpected behaviour or crashes.
464  handled = halt = true;
465  };
466 
467  connect_signal_mouse_left_click(*select_leader_button, std::bind(handler, _3, _4));
468  } else {
469  select_leader_button->set_visible(widget::visibility::hidden);
470  }
471  }
472 
473  if(income_amt == 0) {
474  find_widget<image>(&row_grid, "income_icon", false).set_visible(widget::visibility::invisible);
475  find_widget<label>(&row_grid, "side_income", false).set_visible(widget::visibility::invisible);
476  }
477  }
478 }
479 
481 {
482  if(flg_dialog_) {
483  if(window* w = flg_dialog_->get_window()) {
484  w->set_retval(retval::CANCEL);
485  }
486  }
487 }
488 
490 {
491  // If the game has already started, close the dialog immediately.
492  if(level_["started"].to_bool()) {
494  return;
495  }
496 
497  config data;
498  if(!network_connection_.receive_data(data)) {
499  return;
500  }
501 
502  // Update chat
503  find_widget<chatbox>(get_window(), "chat", false).process_network_data(data);
504 
505  if(!data["message"].empty()) {
506  gui2::show_transient_message(_("Response") , data["message"]);
507  }
508 
509  if(data["failed"].to_bool()) {
511 
513  } else if(data.child("start_game")) {
515 
516  level_["started"] = true;
518  } else if(data.child("leave_game")) {
520 
522  }
523 
524  if(data.child("stop_updates")) {
525  stop_updates_ = true;
526  } else if(const config& c = data.child("scenario_diff")) {
527  // TODO: We should catch config::error and then leave the game.
529 
531  } else if(const config& change = data.child("change_controller")) {
532  if(config& side_to_change = get_scenario().find_child("side", "side", change["side"])) {
533  side_to_change.merge_with(change);
534  }
535 
536  if(flg_dialog_ && flg_dialog_->get_side_num() == change["side"].to_int()) {
538  }
539  } else if(data.has_child("scenario") || data.has_child("snapshot") || data.child("next_scenario")) {
540  level_ = first_scenario_ ? data : data.child("next_scenario");
541 
543  }
544 
545  if(data.has_child("turn")) {
546  ERR_MP << "received replay data\n" << data << "\n in mp join\n";
547  }
548 
549  // Update player list
550  if(data.has_child("user")) {
551  player_list_->update_list(data.child_range("user"));
552  }
553 }
554 
556 {
557  if(config& scenario = level_.child("scenario")) {
558  return scenario;
559  } else if(config& snapshot = level_.child("snapshot")) {
560  return snapshot;
561  }
562 
563  return level_;
564 }
565 
567 {
568  if(update_timer_ != 0) {
570  update_timer_ = 0;
571  }
572 
573  if(window.get_retval() == retval::OK) {
574  if(const config& stats = level_.child("statistics")) {
576  statistics::read_stats(stats);
577  }
578 
580 
582  } else if(observe_game_) {
583  network_connection_.send_data(config("observer_quit", config { "name", preferences::login() }));
584  } else {
585  network_connection_.send_data(config("leave_game"));
586  }
587 }
588 
589 } // namespace dialogs
590 } // namespace gui2
void send_data(const configr_of &request)
void active_window_changed()
Definition: chatbox.cpp:110
An error occurred during when trying to coommunicate with the wesnothd server.
Dialog was closed with the CANCEL button.
Definition: retval.hpp:37
config & child(config_key_type key, int n=0)
Returns the nth child with the given key, or a reference to an invalid config if there is none...
Definition: config.cpp:420
const unit_type * find(const std::string &key, unit_type::BUILD_STATUS status=unit_type::FULL) const
Finds a unit_type by its id() and makes sure it is built to the specified level.
Definition: types.cpp:1159
std::string era()
Definition: game.cpp:712
config & find_child(config_key_type key, const std::string &name, const std::string &value)
Returns the first child of tag key with a name attribute containing value.
Definition: config.cpp:836
Variant for storing WML attributes.
static game_config_view wrap(const config &cfg)
bool has_attribute(config_key_type key) const
Definition: config.cpp:213
bool has_child(config_key_type key) const
Determine whether a config has a child or not.
Definition: config.cpp:412
const std::string & flag_rgb() const
Definition: types.cpp:689
void game_has_begun()
child_itors child_range(config_key_type key)
Definition: config.cpp:362
void show_transient_message(const std::string &title, const std::string &message, const std::string &image, const bool message_use_markup, const bool title_use_markup, const bool restore_background)
Shows a transient message to the user.
static void progress(loading_stage stage=loading_stage::none)
void load_game_config_for_game(const game_classification &classification, const std::string &scenario_id)
const attribute_value * get(config_key_type key) const
Returns a pointer to the attribute with the given key or nullptr if it does not exist.
Definition: config.cpp:742
void fresh_stats()
Definition: statistics.cpp:780
unit_type_data unit_types
Definition: types.cpp:1378
void clear()
Definition: saved_game.cpp:793
faction_select * flg_dialog_
static lg::log_domain log_mp_connect_engine("mp/connect/engine")
void set_escape_disabled(const bool escape_disabled)
Disable the escape key.
Definition: window.hpp:299
window * get_window() const
Returns a pointer to the dialog&#39;s window.
Label showing a text.
Definition: label.hpp:32
bool receive_data(config &result)
std::string str
Definition: statement.cpp:110
void level_to_gamestate(const config &level, saved_game &state)
FLG stands for faction, leader and gender.
Definition: flg_manager.hpp:28
bool show(const unsigned auto_close_time=0)
Shows the window.
wesnothd_connection & network_connection_
A single unit type that the player may recruit.
Definition: types.hpp:44
std::string get_scenario_id() const
Definition: saved_game.cpp:649
Generic file dialog.
Definition: field-fwd.hpp:22
virtual void set_label(const t_string &label)
Base container class.
Definition: grid.hpp:30
static game_config_manager * get()
void swap(config &cfg)
Definition: config.cpp:1390
static UNUSEDNOWARN std::string _(const char *str)
Definition: gettext.hpp:100
std::string get_pango_color_from_id(const std::string &id)
Returns a hex color string from a color range.
This file contains the settings handling of the widget library.
std::ostringstream wrapper.
Definition: formatter.hpp:38
const t_string & type_name() const
The name of the unit in the current language setting.
Definition: types.hpp:136
std::unique_ptr< plugins_context > plugins_context_
unsigned lobby_network_timer
Definition: game_config.cpp:87
void connect_signal_mouse_left_click(dispatcher &dispatcher, const signal_function &signal)
Connects a signal handler for a left mouse button click.
Definition: dispatcher.cpp:171
A class that represents a TCP/IP connection to the wesnothd server.
bool show_flg_select(int side_num, bool first_time=false)
virtual void send_chat_message(const std::string &message, bool allies_only) override
Inherited form chat_handler.
Definition: chatbox.cpp:245
void load_log(std::map< std::string, chatroom_log > &log, bool show_lobby)
Definition: chatbox.cpp:95
void read_stats(const config &cfg)
Definition: statistics.cpp:770
void close_faction_select_dialog_if_open()
Will close the Faction Select dialog if it&#39;s open.
void apply_diff(const config &diff, bool track=false)
A function to apply a diff config onto this config object.
Definition: config.cpp:1068
static void add_color_info(const game_config_view &v, bool build_defaults)
static map_location::DIRECTION se
Various uncategorised dialogs.
int get_retval()
Definition: window.hpp:370
boost::iterator_range< const_child_iterator > const_child_itors
Definition: config.hpp:213
std::string login()
std::unique_ptr< player_list_helper > player_list_
logger & err()
Definition: log.cpp:79
Default, unset return value.
Definition: retval.hpp:31
The user set the widget invisible, that means:
bool use_map_settings()
Definition: game.cpp:505
Contains the gui2 timer routines.
std::map< std::string, t_string > string_map
Definition: widget.hpp:26
std::size_t add_timer(const uint32_t interval, const std::function< void(std::size_t id)> &callback, const bool repeat)
Adds a new timer.
Definition: timer.cpp:126
static t_string from_serialized(const std::string &string)
Definition: tstring.hpp:149
int w
void set_retval(const int retval, const bool close_window=true)
Sets there return value of the window.
Definition: window.hpp:363
#define N_(String)
Definition: gettext.hpp:108
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
Definition: unicode.cpp:71
#define VGETTEXT(msgid,...)
Handy wrappers around interpolate_variables_into_string and gettext.
config & add_child(config_key_type key)
Definition: config.cpp:476
const std::string random_enemy_picture("units/random-dice.png")
const std::string & image() const
Definition: types.hpp:166
const t_string & get_label() const
static void display(std::function< void()> f)
std::map< std::string, tree_view_node * > team_tree_map_
The user sets the widget hidden, that means:
game_classification & classification()
Definition: saved_game.hpp:55
const std::string unicode_em_dash
Definition: constants.cpp:40
std::map< std::string, chatroom_log > default_chat_log
Definition: chat_log.cpp:16
virtual void post_show(window &window) override
Inherited from modal_dialog.
void set_wesnothd_connection(wesnothd_connection &c)
Definition: chatbox.hpp:87
Standard logging facilities (interface).
tree_view_node & add_sibling(const std::string &id, const std::map< std::string, string_map > &data)
Adds a sibbling for a node at the end of the list.
#define ERR_MP
bool wait_and_receive_data(config &data)
Helper function that spins until data has been received.
#define WRN_MP
virtual void pre_show(window &window) override
Inherited from modal_dialog.
static std::string generate_user_description(const config &side)
Dialog was closed with the OK button.
Definition: retval.hpp:34
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:68
mock_char c
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:62
lobby_chat_window * room_window_open(const std::string &room, const bool open_new, const bool allow_close=true)
Check if a room window for "room" is open, if open_new is true then it will be created if not found...
Definition: chatbox.cpp:385
tree_view_node & add_node(const std::string &id, const std::map< std::string, string_map > &data, const int index=-1)
Definition: tree_view.cpp:56
std::pair< std::string, unsigned > item
Definition: help_impl.hpp:384
bool remove_timer(const std::size_t id)
Removes a timer.
Definition: timer.cpp:167
void set_enter_disabled(const bool enter_disabled)
Disable the enter key.
Definition: window.hpp:286