The Battle for Wesnoth  1.17.0-dev
mp_staging.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2021
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #define GETTEXT_DOMAIN "wesnoth-lib"
16 
18 
19 #include "ai/configuration.hpp"
20 #include "chat_log.hpp"
21 #include "font/text_formatting.hpp"
22 #include "formatter.hpp"
23 #include "game_config.hpp"
24 #include "gettext.hpp"
28 #include "gui/widgets/button.hpp"
29 #include "gui/widgets/chatbox.hpp"
30 #include "gui/widgets/drawing.hpp"
31 #include "gui/widgets/image.hpp"
32 #include "gui/widgets/label.hpp"
33 #include "gui/widgets/listbox.hpp"
35 #include "gui/widgets/settings.hpp"
36 #include "gui/widgets/slider.hpp"
41 #include "mp_ui_alerts.hpp"
42 #include "units/types.hpp"
43 #include "wesnothd_connection.hpp"
44 
45 namespace gui2::dialogs
46 {
47 
48 REGISTER_DIALOG(mp_staging)
49 
50 mp_staging::mp_staging(ng::connect_engine& connect_engine, wesnothd_connection* connection)
51  : connect_engine_(connect_engine)
52  , ai_algorithms_(ai::configuration::get_available_ais())
53  , network_connection_(connection)
54  , update_timer_(0)
55  , state_changed_(false)
56  , team_tree_map_()
57  , side_tree_map_()
58  , player_list_(nullptr)
59 {
60  set_show_even_without_video(true);
61 
62  assert(!ai_algorithms_.empty());
63 }
64 
66 {
67  if(update_timer_ != 0) {
69  update_timer_ = 0;
70  }
71 }
72 
74 {
75  window.set_enter_disabled(true);
76  window.set_escape_disabled(true);
77 
78  //
79  // Set title and status widget states
80  //
81  label& title = find_widget<label>(&window, "title", false);
82  title.set_label((formatter() << connect_engine_.params().name << " " << font::unicode_em_dash << " " << connect_engine_.scenario()["name"].t_str()).str());
83 
85 
86  //
87  // Set up sides list
88  //
89  for(const auto& side : connect_engine_.side_engines()) {
90  if(side->allow_player() || game_config::debug) {
91  add_side_node(side);;
92  }
93  }
94 
95  //
96  // Initialize chatbox and game rooms
97  //
98  chatbox& chat = find_widget<chatbox>(&window, "chat", false);
99 
100  chat.room_window_open(N_("this game"), true, false);
101  chat.active_window_changed();
102  chat.load_log(default_chat_log, false);
103 
104  //
105  // Set up player list
106  //
107  player_list_.reset(new player_list_helper(&window));
108 
109  //
110  // Set up the network handling
111  //
113 
114  //
115  // Set up the Lua plugin context
116  //
117  plugins_context_.reset(new plugins_context("Multiplayer Staging"));
118 
119  plugins_context_->set_callback("launch", [&window](const config&) { window.set_retval(retval::OK); }, false);
120  plugins_context_->set_callback("quit", [&window](const config&) { window.set_retval(retval::CANCEL); }, false);
121  plugins_context_->set_callback("chat", [&chat](const config& cfg) { chat.send_chat_message(cfg["message"], false); }, true);
122 }
123 
125 {
126  int position = 0;
127  for(const auto& side_engine : connect_engine_.side_engines()) {
128  if(side->team() == side_engine->team() && side->index() > side_engine->index()) {
129  ++position;
130  }
131  }
132 
133  return position;
134 }
135 
136 template<typename... T>
138 {
139  static const std::map<std::string, string_map> empty_map;
140 
141  // If there is no team node in the map, this will return nullptr
142  tree_view_node* team_node = team_tree_map_[side->team_name()];
143 
144  // Add a team node if none exists
145  if(team_node == nullptr) {
146  tree_view& tree = find_widget<tree_view>(get_window(), "side_list", false);
147 
148  std::map<std::string, string_map> tree_data;
149  string_map tree_item;
150 
151  tree_item["label"] = side->user_team_name();
152  tree_data.emplace("tree_view_node_label", tree_item);
153 
154  team_node = &tree.add_node("team_header", tree_data);
155  team_node->add_sibling("side_spacer", empty_map);
156 
157  team_tree_map_[side->team_name()] = team_node;
158  }
159 
160  assert(team_node && "No team node found!");
161  return team_node->add_child(std::forward<T>(params)...);
162 }
163 
165 {
166  std::map<std::string, string_map> data;
168 
169  item["label"] = std::to_string(side->index() + 1);
170  data.emplace("side_number", item);
171 
172  // TODO: don't hardcode magenta?
173  item["label"] = "units/unknown-unit.png~RC(magenta>" + side->color_id() + ")";
174  data.emplace("leader_image", item);
175 
176  item["label"] = "icons/icon-random.png";
177  data.emplace("leader_gender", item);
178 
179  tree_view_node& node = add_side_to_team_node(side, "side_panel", data, get_side_node_position(side));
180 
181  side_tree_map_[side] = &node;
182 
183  grid& row_grid = node.get_grid();
184 
185  update_leader_display(side, row_grid);
186 
187  // Status variables
188  const bool fls = connect_engine_.force_lock_settings();
189  const bool ums = connect_engine_.params().use_map_settings;
190 
191  const bool lock_gold = side->cfg()["gold_lock"].to_bool(fls);
192  const bool lock_income = side->cfg()["income_lock"].to_bool(fls);
193  const bool lock_team = side->cfg()["team_lock"].to_bool(fls);
194  const bool lock_color = side->cfg()["color_lock"].to_bool(fls);
195 
196  const bool saved_game = connect_engine_.params().saved_game == mp_game_settings::SAVED_GAME_MODE::MIDGAME;
197 
198  //
199  // AI Algorithm
200  //
201  int selection = 0;
202 
203  // We use an index-based loop in order to get the index of the selected option
204  std::vector<config> ai_options;
205  // If this is loading a saved game, we add an option at the beginning of the menu.
206  // This results in a mismatch between the indices of ai_options and ai_algorithms_
207  // that we need to account for later.
208  if(saved_game) {
209  ai_options.emplace_back("label", "Keep saved AI");
210  }
211  for(unsigned i = 0; i < ai_algorithms_.size(); ++i) {
212  ai_options.emplace_back("label", ai_algorithms_[i]->text);
213 
214  if(ai_algorithms_[i]->id == side->ai_algorithm()) {
215  selection = i;
216  }
217  }
218 
219  menu_button& ai_selection = find_widget<menu_button>(&row_grid, "ai_controller", false);
220 
221  ai_selection.set_values(ai_options, selection);
222 
223  connect_signal_notify_modified(ai_selection,
224  std::bind(&mp_staging::on_ai_select, this, side, std::ref(ai_selection), saved_game));
225 
226  on_ai_select(side, ai_selection, saved_game);
227  //
228  // Controller
229  //
230  std::vector<config> controller_names;
231  for(const auto& controller : side->controller_options()) {
232  controller_names.emplace_back("label", controller.second);
233  }
234 
235  menu_button& controller_selection = find_widget<menu_button>(&row_grid, "controller", false);
236 
237  controller_selection.set_values(controller_names, side->current_controller_index());
238  controller_selection.set_active(controller_names.size() > 1);
239 
240  connect_signal_notify_modified(controller_selection,
241  std::bind(&mp_staging::on_controller_select, this, side, std::ref(row_grid)));
242 
243  on_controller_select(side, row_grid);
244 
245  //
246  // Leader controls
247  //
248  button& leader_select = find_widget<button>(&row_grid, "select_leader", false);
249 
250  //todo: shouldn't this also be disabled when the flg settings are locked.
251  leader_select.set_active(!saved_game);
252 
253  connect_signal_mouse_left_click(leader_select,
254  std::bind(&mp_staging::select_leader_callback, this, side, std::ref(row_grid)));
255 
256  //
257  // Team
258  //
259  std::vector<config> team_names;
260  unsigned initial_team_selection = 0;
261 
262  for(unsigned i = 0; i < connect_engine_.team_data().size(); ++i) {
264 
265  if(!tdata.is_player_team && !game_config::debug) {
266  continue;
267  }
268 
269  config entry;
270  entry["label"] = t_string::from_serialized(tdata.user_team_name);
271 
272  // Since we're not necessarily displaying every every team, we need to store the
273  // index a displayed team has in the connect_engine's team_data vector. This is
274  // then utilized in the click callback.
275  entry["team_index"] = i;
276 
277  team_names.push_back(std::move(entry));
278 
279  // Since, again, every team might not be displayed, and side_engine::team() returns
280  // an index into the team_data vector, get an initial selection index for the menu
281  // adjusted for the displayed named.
282  if(side->team() == i) {
283  initial_team_selection = team_names.size() - 1;
284  }
285  }
286 
287  menu_button& team_selection = find_widget<menu_button>(&row_grid, "side_team", false);
288 
289  team_selection.set_values(team_names, initial_team_selection);
290  //todo: shouldn't this also be disabled when team settings are locked.
291  team_selection.set_active(!saved_game);
292 
293  connect_signal_notify_modified(team_selection,
294  std::bind(&mp_staging::on_team_select, this, side, std::ref(team_selection)));
295 
296  //
297  // Colors
298  //
299  std::vector<config> color_options;
300  for(const auto& color : side->color_options()) {
301  color_options.emplace_back(
302  "label", font::get_color_string_pango(color),
303  "icon", (formatter() << "misc/status.png~RC(magenta>" << color << ")").str()
304  );
305  }
306 
307  menu_button& color_selection = find_widget<menu_button>(&row_grid, "side_color", false);
308 
309  color_selection.set_values(color_options, side->color());
310  color_selection.set_active(!saved_game);
311  color_selection.set_use_markup(true);
312 
313  connect_signal_notify_modified(color_selection,
314  std::bind(&mp_staging::on_color_select, this, side, std::ref(row_grid)));
315 
316  //
317  // Gold and Income
318  //
319  const auto slider_setup_helper = [](slider& slider, const int value) {
320  // For the gold and income sliders, the usual min and max values are set in
321  // the dialog WML. However, if a side specifies a value out of that range,
322  // we adjust the bounds to accommodate it.
323  slider.set_value_range(
324  std::min(value, slider.get_minimum_value()),
325  std::max(value, slider.get_maximum_value())
326  );
327 
328  slider.set_value(value);
329  };
330 
331  slider& slider_gold = find_widget<slider>(&row_grid, "side_gold_slider", false);
332  slider_setup_helper(slider_gold, side->gold());
333 
334  connect_signal_notify_modified(slider_gold, std::bind(
335  &mp_staging::on_side_slider_change<&ng::side_engine::set_gold>, this, side, std::ref(slider_gold)));
336 
337  slider& slider_income = find_widget<slider>(&row_grid, "side_income_slider", false);
338  slider_setup_helper(slider_income, side->income());
339 
340  connect_signal_notify_modified(slider_income, std::bind(
341  &mp_staging::on_side_slider_change<&ng::side_engine::set_income>, this, side, std::ref(slider_income)));
342 
343  // TODO: maybe display the saved values
344  if(saved_game) {
347  }
348 
349  //
350  // Gold, income, team, and color are only suggestions unless explicitly locked
351  //
352  if(!saved_game && ums) {
353  team_selection.set_active(!lock_team);
354  color_selection.set_active(!lock_color);
355 
356  slider_gold.set_active(!lock_gold);
357  slider_income.set_active(!lock_income);
358  }
359 }
360 
362 {
363  menu_button& ai_selection = find_widget<menu_button>(&row_grid, "ai_controller", false);
364  menu_button& controller_selection = find_widget<menu_button>(&row_grid, "controller", false);
365 
366  if(side->controller_changed(controller_selection.get_value())) {
368 
370  }
371 }
372 
374 {
375  // If this is a saved game, we need to reduce the index by one, to account for
376  // the "Keep saved AI" option having been added to the computer player menu
377  int i = ai_menu.get_value();
378  if(saved_game) {
379  i--;
380  }
381 
382  if(i < 0) {
383  side->set_ai_algorithm("use_saved");
384  } else {
385  side->set_ai_algorithm(ai_algorithms_[i]->id);
386  }
387 
389 }
390 
392 {
393  side->set_color(find_widget<menu_button>(&row_grid, "side_color", false).get_value());
394 
395  update_leader_display(side, row_grid);
396 
398 }
399 
401 {
402  // Since we're not necessarily displaying every every team in the menu, we can't just
403  // use the selected index to set a side's team. Instead, we grab the index we stored
404  // in add_side_node from the selected config, which should correspond to the
405  // appropriate entry in the connect_engine's team name vector.
406  const unsigned team_index = team_menu.get_value_config()["team_index"].to_unsigned();
407 
408  if(team_index == side->team()) {
409  return;
410  }
411 
412  // Note the old team so we can remove the node if empty after the side move.
413  // Do this *before* setting the new team!
414  const std::string old_team = side->team_name();
415  side->set_team(team_index);
416 
417  auto& tree = find_widget<tree_view>(get_window(), "side_list", false);
418 
419  // First, remove the node from the tree
420  auto node = tree.remove_node(side_tree_map_[side]);
421 
422  // Then add a new node as a child to the appropriate team's node
423  add_side_to_team_node(side, std::move(node.first), get_side_node_position(side));
424 
425  tree_view_node* old_team_node = team_tree_map_[old_team];
426 
427  // Last, remove the old team node if it's now empty
428  if(old_team_node->empty()) {
429  // Only sibling should be the decor line, and it should be last
430  auto decor = old_team_node->siblings().back();
431 
432  tree.remove_node(old_team_node);
433  tree.remove_node(decor.get());
434 
435  team_tree_map_[old_team] = nullptr;
436  }
437 
439 }
440 
442 {
443  if(gui2::dialogs::faction_select::execute(side->flg(), side->color_id(), side->index() + 1)) {
444  update_leader_display(side, row_grid);
445 
447  }
448 }
449 
450 template<void(ng::side_engine::*fptr)(int)>
452 {
453  std::invoke(fptr, side, slider.get_value());
454 
456 }
457 
459 {
460  const std::string current_faction = side->flg().current_faction()["name"];
461 
462  // BIG FAT TODO: get rid of this shitty "null" string value in the FLG manager
463  std::string current_leader = side->flg().current_leader() != "null" ? side->flg().current_leader() : font::unicode_em_dash;
464  const std::string current_gender = side->flg().current_gender() != "null" ? side->flg().current_gender() : font::unicode_em_dash;
465 
466  // Sprite
467  std::string new_image;
468 
469  if(side->flg().is_random_faction() || current_leader == "random") {
470  new_image = ng::random_enemy_picture;
471  }
472 
473  if(const unit_type* ut = unit_types.find(current_leader)) {
474  const unit_type& type = ut->get_gender_unit_type(current_gender);
475 
476  new_image = formatter() << type.image() << "~RC(magenta>" << side->color_id() << ")";
477 
478  // We don't need the unit type id anymore, and can now replace this variable with the type name
479  current_leader = type.type_name();
480  }
481 
482  find_widget<drawing>(&row_grid, "leader_image", false).set_label(new_image);
483 
484  // Faction and leader
485  if(!side->cfg()["name"].empty()) {
486  current_leader = formatter() << side->cfg()["name"] << " (<i>" << current_leader << "</i>)";
487  }
488 
489  find_widget<label>(&row_grid, "leader_type", false).set_label(current_leader == "random" ? _("Random") : current_leader);
490  find_widget<label>(&row_grid, "leader_faction", false).set_label("<span color='#a69275'>" + current_faction + "</span>");
491 
492  // Gender
493  if(current_gender != font::unicode_em_dash) {
494  const std::string gender_icon = formatter() << "icons/icon-" << current_gender << ".png";
495 
496  image& icon = find_widget<image>(&row_grid, "leader_gender", false);
497  icon.set_label(gender_icon);
498  }
499 }
500 
502 {
503  find_widget<label>(get_window(), "status_label", false).set_label(
505  ? _("Waiting for players to join...")
506  : _("Waiting for players to choose factions...")
507  );
508 
509  find_widget<button>(get_window(), "ok", false).set_active(connect_engine_.can_start_game());
510 }
511 
513 {
514  // First, send off any changes if they've been accumulated
515  if(state_changed_) {
517  }
518 
519  // Next, check for any incoming changes
520  config data;
522  return;
523  }
524 
525  // Update chat
526  find_widget<chatbox>(get_window(), "chat", false).process_network_data(data);
527 
528  // TODO: why is this needed...
529  const bool was_able_to_start = connect_engine_.can_start_game();
530 
531  bool quit_signal_received;
532  std::tie(quit_signal_received, std::ignore) = connect_engine_.process_network_data(data);
533 
534  if(quit_signal_received) {
536  }
537 
538  // Update side leader displays
539  // This is basically only needed when a new player joins and selects their faction
540  for(auto& tree_entry : side_tree_map_) {
541  ng::side_engine_ptr side = tree_entry.first;
542 
543  grid& row_grid = tree_entry.second->get_grid();
544 
545  update_leader_display(side, row_grid);
546 
547  std::vector<config> controller_names;
548  for(const auto& controller : side->controller_options()) {
549  controller_names.emplace_back("label", controller.second);
550  }
551 
552  menu_button& controller_selection = find_widget<menu_button>(&row_grid, "controller", false);
553 
554  controller_selection.set_values(controller_names, side->current_controller_index());
555  controller_selection.set_active(controller_names.size() > 1);
556  }
557 
558  // Update player list
559  if(data.has_child("user")) {
560  player_list_->update_list(data.child_range("user"));
561  }
562 
563  // Update status label and buttons
565 
566  if(!was_able_to_start && connect_engine_.can_start_game()) {
568  }
569 
570  state_changed_ = false;
571 }
572 
574 {
575  if(update_timer_ != 0) {
577  update_timer_ = 0;
578  }
579 
580  if(window.get_retval() == retval::OK) {
582  } else {
584  }
585 }
586 
587 } // namespace dialogs
void active_window_changed()
Definition: chatbox.cpp:109
Dialog was closed with the CANCEL button.
Definition: retval.hpp:38
void ready_for_start()
const ::config & get_value_config() const
Returns the entire config object for the selected row.
Definition: menu_button.hpp:99
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:1262
A menu_button is a styled_widget to choose an element from a list of elements.
Definition: menu_button.hpp:61
int get_side_node_position(ng::side_engine_ptr side) const
Find an appropriate position to insert a side node.
Definition: mp_staging.cpp:124
void add_side_node(ng::side_engine_ptr side)
Definition: mp_staging.cpp:164
bool has_child(config_key_type key) const
Determine whether a config has a child or not.
Definition: config.cpp:394
bool force_lock_settings() const
child_itors child_range(config_key_type key)
Definition: config.cpp:344
ng::connect_engine & connect_engine_
Definition: mp_staging.hpp:88
unit_type_data unit_types
Definition: types.cpp:1481
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.
A label displays a text, the text can be wrapped but no scrollbars are provided.
Definition: label.hpp:57
bool receive_data(config &result)
Receives the next pending data pack from the server, if available.
static std::string _(const char *str)
Definition: gettext.hpp:93
const std::vector< team_data_pod > & team_data() const
void update_and_send_diff(bool update_time_of_day=false)
A single unit type that the player may recruit.
Definition: types.hpp:45
bool empty() const
Does the node have children?
virtual void set_label(const t_string &label)
virtual void set_active(const bool active) override
See styled_widget::set_active.
Base container class.
Definition: grid.hpp:31
A small explanation about what&#39;s going on here: Each action has access to two game_info objects First...
Definition: actions.cpp:61
virtual unsigned get_value() const override
Inherited from selectable_item.
Definition: menu_button.hpp:84
void set_value_range(int min_value, int max_value)
Definition: slider.cpp:249
void update_leader_display(ng::side_engine_ptr side, grid &row_grid)
Definition: mp_staging.cpp:458
virtual int get_maximum_value() const override
Inherited from integer_selector.
Definition: slider.hpp:91
void connect_signal_notify_modified(dispatcher &dispatcher, const signal_notification_function &signal)
Connects a signal handler for getting a notification upon modification.
Definition: dispatcher.cpp:187
std::vector< side_engine_ptr > & side_engines()
This file contains the settings handling of the widget library.
std::ostringstream wrapper.
Definition: formatter.hpp:39
const t_string & type_name() const
The name of the unit in the current language setting.
Definition: types.hpp:141
std::unique_ptr< plugins_context > plugins_context_
void set_visible(const visibility visible)
Definition: widget.cpp:476
unsigned lobby_network_timer
Definition: game_config.cpp:88
std::unique_ptr< player_list_helper > player_list_
Definition: mp_staging.hpp:101
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:172
void on_controller_select(ng::side_engine_ptr side, grid &row_grid)
Definition: mp_staging.cpp:361
A class that represents a TCP/IP connection to the wesnothd server.
virtual void send_chat_message(const std::string &message, bool allies_only) override
Inherited form chat_handler.
Definition: chatbox.cpp:244
void load_log(std::map< std::string, chatroom_log > &log, bool show_lobby)
Definition: chatbox.cpp:94
const mp_game_settings & params() const
void set_values(const std::vector<::config > &values, unsigned selected=0)
virtual void set_use_markup(bool use_markup)
A tree view is a control that holds several items of the same or different types. ...
Definition: tree_view.hpp:60
void on_side_slider_change(ng::side_engine_ptr side, slider &slider)
Definition: mp_staging.cpp:451
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
Definition: mp_staging.cpp:73
int get_retval()
Definition: window.hpp:365
std::vector< ai::description * > ai_algorithms_
Definition: mp_staging.hpp:90
std::size_t i
Definition: function.cpp:967
wesnothd_connection * network_connection_
Definition: mp_staging.hpp:92
void select_leader_callback(ng::side_engine_ptr side, grid &row_grid)
Definition: mp_staging.cpp:441
The user set the widget invisible, that means:
tree_view_node & add_side_to_team_node(ng::side_engine_ptr side, T &&... params)
Definition: mp_staging.cpp:137
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:127
static t_string from_serialized(const std::string &string)
Definition: tstring.hpp:154
std::string get_color_string_pango(const std::string &id)
Returns the name of a color range, colored with its own color.
const bool & debug
#define N_(String)
Definition: gettext.hpp:101
virtual int get_value() const override
Inherited from integer_selector.
Definition: slider.hpp:79
std::shared_ptr< side_engine > side_engine_ptr
const std::string random_enemy_picture("units/random-dice.png")
void on_ai_select(ng::side_engine_ptr side, menu_button &ai_menu, const bool saved_game)
Definition: mp_staging.cpp:373
std::map< std::string, tree_view_node * > team_tree_map_
Definition: mp_staging.hpp:98
const std::string & image() const
Definition: types.hpp:179
virtual void set_active(const bool active) override
See styled_widget::set_active.
Definition: button.cpp:63
The user sets the widget visible, that means:
node_children_vector & siblings()
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
Definition: mp_staging.cpp:573
The user sets the widget hidden, that means:
A slider is a control that can select a value by moving a grip on a groove.
Definition: slider.hpp:59
const std::string unicode_em_dash
Definition: constants.cpp:44
Managing the AIs configuration - headers.
std::map< std::string, chatroom_log > default_chat_log
Definition: chat_log.cpp:18
Functions to load and save images from/to disk.
Simple push button.
Definition: button.hpp:36
virtual void set_value(int value) override
Inherited from integer_selector.
Definition: slider.cpp:81
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.
virtual void set_active(const bool active) override
See styled_widget::set_active.
Definition: menu_button.cpp:75
void on_color_select(ng::side_engine_ptr side, grid &row_grid)
Definition: mp_staging.cpp:391
Dialog was closed with the OK button.
Definition: retval.hpp:35
bool can_start_game() const
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:61
tree_view_node & add_child(const std::string &id, const std::map< std::string, string_map > &data, const int index=-1)
Constructs a new child node.
void set_retval(int retval)
Convenience wrapper to set the window&#39;s exit code.
base class of top level items, the only item which needs to store the final canvases to draw on...
Definition: window.hpp:65
std::map< ng::side_engine_ptr, tree_view_node * > side_tree_map_
Definition: mp_staging.hpp:99
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:384
virtual int get_minimum_value() const override
Inherited from integer_selector.
Definition: slider.hpp:85
bool sides_available() const
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:57
std::pair< std::string, unsigned > item
Definition: help_impl.hpp:410
std::pair< bool, bool > process_network_data(const config &data)
bool remove_timer(const std::size_t id)
Removes a timer.
Definition: timer.cpp:168
void on_team_select(ng::side_engine_ptr side, menu_button &team_menu)
Definition: mp_staging.cpp:400
void set_enter_disabled(const bool enter_disabled)
Disable the enter key.
Definition: window.hpp:286