The Battle for Wesnoth  1.15.10+dev
gamestate_inspector.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 - 2018 by Yurii Chernyi <terraninfo@terraninfo.net>
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 
22 #include "gui/widgets/button.hpp"
23 #include "gui/widgets/label.hpp"
26 #include "gui/widgets/settings.hpp"
27 #include "gui/widgets/window.hpp"
28 
29 #include "desktop/clipboard.hpp"
30 #include "font/text_formatting.hpp"
31 #include "game_events/manager.hpp"
32 #include "serialization/parser.hpp" // for write()
33 
34 #include "game_board.hpp"
35 #include "game_data.hpp"
36 #include "recall_list_manager.hpp"
37 #include "team.hpp"
38 #include "units/unit.hpp"
39 #include "units/map.hpp"
40 #include "ai/manager.hpp"
41 
42 #include "display_context.hpp"
43 #include "filter_context.hpp"
44 
45 #include <vector>
46 #include <functional>
47 
48 namespace
49 {
50 
51 inline std::string config_to_string(const config& cfg)
52 {
53  std::ostringstream s;
54  write(s, cfg);
55  return s.str();
56 }
57 
58 inline std::string config_to_string(const config& cfg, std::string only_children)
59 {
60  config filtered;
61  for(const config& child : cfg.child_range(only_children)) {
62  filtered.add_child(only_children, child);
63  }
64  return config_to_string(filtered);
65 }
66 
67 }
68 
69 namespace gui2::dialogs
70 {
71 
73 {
74 public:
75  std::string name;
76 
77  std::string get_data_full() const
78  {
79  return data;
80  }
81 
82  std::string get_data_paged(int which_page)
83  {
84  if(std::size_t(which_page) >= pages.size()) {
85  return "";
86  }
87  return data.substr(pages[which_page].first, pages[which_page].second);
88  }
89 
90  void clear_data()
91  {
92  data.clear();
93  }
94 
95  void set_data(const std::string& new_data)
96  {
97  data = new_data;
98  repaginate();
99  }
100 
102  {
103  return std::max<int>(pages.size(), 1);
104  }
105 
106 private:
107  void repaginate()
108  {
109  pages.clear();
110  std::size_t start = 0;
111  while(start < data.size()) {
112  std::size_t end = data.find_last_of('\n', start + max_inspect_win_len);
113  if(end == std::string::npos) {
114  end = data.size() - 1;
115  }
116  int len = end - start + 1;
117  pages.emplace_back(start, len);
118  start += len;
119  }
120  }
121  static const unsigned int max_inspect_win_len = 20000;
122  std::string data;
123  std::vector<std::pair<std::size_t,int>> pages;
124 };
125 
127 {
128 public:
129  stuff_list_adder(tree_view_node& stuff_list, const std::string& defn)
130  : stuff_list_(stuff_list)
131  , defn_(defn)
132  {
133  }
134 
135  std::vector<int> add()
136  {
137  return stuff_list_.add_child(defn_, data_).describe_path();
138  }
139 
140  stuff_list_adder& widget(const std::string& ref, const std::string& label, bool markup = false)
141  {
142  string_map& item = data_[ref];
143  item["label"] = label;
144  item["use_markup"] = utils::bool_string(markup);
145  return *this;
146  }
147 
148 private:
150  const std::string defn_;
151  std::map<std::string, string_map> data_;
152 };
153 
155 {
156 public:
158  : stuff_list_(find_widget<tree_view>(&window, "stuff_list", false, true))
159  , inspect_(find_widget<styled_widget>(&window, "inspect", false, true))
160  , pages_(find_widget<styled_widget>(&window, "page_count", false, true))
161  , left_(find_widget<styled_widget>(&window, "page_left", false, true))
162  , right_(find_widget<styled_widget>(&window, "page_right", false, true))
163  {
164  }
165 
166  stuff_list_adder stuff_list_entry(tree_view_node* parent, const std::string& defn)
167  {
168  return stuff_list_adder(parent ? *parent : stuff_list_->get_root_node(), defn);
169  }
170 
171  void update(model& m)
172  {
173  int n_pages = m.count_pages();
174  current_page_ = std::min(n_pages - 1, std::max(0, current_page_));
175  inspect_->set_label(m.get_data_paged(current_page_));
176  if(n_pages > 1) {
177  std::ostringstream out;
178  out << current_page_ + 1 << '/' << n_pages;
179  pages_->set_label(out.str());
180  left_->set_visible(widget::visibility::visible);
181  right_->set_visible(widget::visibility::visible);
182  } else {
183  pages_->set_label("");
184  left_->set_visible(widget::visibility::invisible);
185  right_->set_visible(widget::visibility::invisible);
186  }
187  }
188 
190  {
191  stuff_list_->clear();
192  pages_->set_label("");
193  left_->set_visible(widget::visibility::invisible);
194  right_->set_visible(widget::visibility::invisible);
195  }
196 
197  void page(int where)
198  {
199  current_page_ += where;
200  }
201 
202 private:
203  int current_page_ = 0;
209 };
210 
212 {
213 public:
215  {
216  }
217 
219  {
220  }
221 
222 protected:
226  const config& vars() const;
227  const game_events::manager& events() const;
228  const display_context& dc() const;
229 };
230 
232 {
233 public:
236  {
237  }
238 
239  void show_list(tree_view_node& node);
240  void show_var(tree_view_node& node);
241  void show_array(tree_view_node& node);
242 };
243 
245 {
246 public:
248  void show_list(tree_view_node& node, bool is_wmi);
249  void show_event(tree_view_node& node, bool is_wmi);
250 
251 private:
253 };
254 
256 {
257 public:
260  {
261  }
262 
263  void show_list(tree_view_node& node);
264  void show_unit(tree_view_node& node);
265 };
266 
268 {
269 public:
272  {
273  }
274 
275  void show_list(tree_view_node& node, int side);
276  void show_ai(tree_view_node& node, int side);
277  void show_ai_components(tree_view_node& node, int side);
278  void show_ai_tree(tree_view_node& node, int side);
279  void show_recall(tree_view_node& node, int side);
280  void show_recall_unit(tree_view_node& node, int side);
281  void show_units(tree_view_node& node, int side);
282  void show_unit(tree_view_node& node, int side);
283 };
284 
286 {
288 public:
289  controller(model& m, view& v, const config& vars, const game_events::manager& events, const display_context& dc)
290  : model_(m), view_(v)
291  , vars_(vars), events_(events), dc_(dc)
292  {
293  }
294 
296  {
297  tree_view_node* selected = dynamic_cast<tree_view&>(tree).selected_item();
298  callbacks[selected->describe_path()](*selected);
299 
300  // We recursively fold, but non-recursively unfold.
301  // This is because only one node on a level should be open at any given time.
302  // Furthermore, there's no need to remember that a subnode was open once the parent is closed.
303  if(!selected->is_root_node()) {
304  for(auto& node : selected->parent_node().children()) {
305  if(node.get() != selected) {
306  node->fold(true);
307  }
308  }
309 
310  selected->unfold();
311  }
312 
313  view_.update(model_);
314  }
315 
317  {
318  desktop::clipboard::copy_to_clipboard(model_.get_data_full(), false);
319  }
320 
322  {
324  // The game state could've changed, so reset the dialog
325  callbacks.clear();
326  controllers.clear();
327  view_.clear_stuff_list();
328  build_stuff_list(window);
329  model_.clear_data();
330  view_.update(model_);
331  }
332 
334  {
335  view_.page(next ? 1 : -1);
336  view_.update(model_);
337  }
338 
339  template<typename T>
340  std::shared_ptr<T> get_controller()
341  {
342  for(auto& c : controllers) {
343  if(std::shared_ptr<T> p = std::dynamic_pointer_cast<T>(c)) {
344  return p;
345  }
346  }
347  std::shared_ptr<T> p = std::make_shared<T>(*this);
348  controllers.push_back(p);
349  return p;
350  }
351 
352  template<typename C>
353  void set_node_callback(const std::vector<int>& node_path, void (C::* fcn)(tree_view_node&))
354  {
355  C& sub_controller = *get_controller<C>();
356  callbacks.emplace(node_path, std::bind(fcn, sub_controller, std::placeholders::_1));
357  }
358 
359  template<typename C, typename T>
360  void set_node_callback(const std::vector<int>& node_path, void (C::* fcn)(tree_view_node&, T), T param)
361  {
362  C& sub_controller = *get_controller<C>();
363  callbacks.emplace(node_path, std::bind(fcn, sub_controller, std::placeholders::_1, param));
364  }
365 
367  {
368  auto stuff_list = find_widget<tree_view>(&window, "stuff_list", false, true);
369  auto copy_button = find_widget<button>(&window, "copy", false, true);
370  auto lua_button = find_widget<button>(&window, "lua", false, true);
371  auto left_button = find_widget<button>(&window, "page_left", false, true);
372  auto right_button = find_widget<button>(&window, "page_right", false, true);
373 
374  connect_signal_notify_modified(*stuff_list,
375  std::bind(&gamestate_inspector::controller::handle_stuff_list_item_clicked, this, std::placeholders::_1));
376 
378  *copy_button,
380  this));
381 
383  *lua_button,
385  this, std::ref(window)));
386 
388  *left_button,
390  this, false));
391 
393  *right_button,
395  this, true));
396 
397  left_button->set_visible(widget::visibility::invisible);
398  right_button->set_visible(widget::visibility::invisible);
399 
401  copy_button->set_active(false);
402  copy_button->set_tooltip(_("Clipboard support not found, contact your packager"));
403  }
404 
405  build_stuff_list(window);
406  }
407 
409  {
410  set_node_callback(
411  view_.stuff_list_entry(nullptr, "basic")
412  .widget("name", "variables")
413  .add(),
415  set_node_callback(
416  view_.stuff_list_entry(nullptr, "basic")
417  .widget("name", "events")
418  .add(),
420  false);
421  set_node_callback(
422  view_.stuff_list_entry(nullptr, "basic")
423  .widget("name", "menu items")
424  .add(),
426  true);
427  set_node_callback(
428  view_.stuff_list_entry(nullptr, "basic")
429  .widget("name", "units")
430  .add(),
432  int sides = dc_.teams().size();
433  for(int side = 1; side <= sides; side++) {
434  std::ostringstream label;
435  label << "team " << side;
436  const std::string& name = dc_.get_team(side).user_team_name();
437  if(!name.empty()) {
438  label << " (" << name << ")";
439  }
440  set_node_callback(
441  view_.stuff_list_entry(nullptr, "basic")
442  .widget("name", label.str())
443  .add(),
445  side);
446  }
447  // Expand initially selected node
448  callbacks[{0}](find_widget<tree_view>(&window, "stuff_list", false).get_root_node().get_child_at(0));
449  }
450 
451 private:
454  using node_callback = std::function<void(tree_view_node&)>;
455  using node_callback_map = std::map<std::vector<int>, node_callback>;
456  std::vector<std::shared_ptr<single_mode_controller>> controllers;
458  const config& vars_;
461 };
462 
464  return c.model_;
465 }
466 
468  return c.view_;
469 }
470 
472  return c.vars_;
473 }
474 
476  return c.events_;
477 }
478 
480  return c.dc_;
481 }
482 
485 {
487 }
488 
490 {
491  model().clear_data();
492 
493  if(node.count_children() > 0) {
494  return;
495  }
496 
497  for(const auto& attr : vars().attribute_range())
498  {
500  view().stuff_list_entry(&node, "basic")
501  .widget("name", attr.first)
502  .add(),
504  }
505 
506  std::map<std::string, std::size_t> wml_array_sizes;
507 
508  for(const auto& ch : vars().all_children_range())
509  {
510 
511  std::ostringstream cur_str;
512  cur_str << "[" << ch.key << "][" << wml_array_sizes[ch.key] << "]";
513 
514  this->c.set_node_callback(
515  view().stuff_list_entry(&node, "basic")
516  .widget("name", cur_str.str())
517  .add(),
519  wml_array_sizes[ch.key]++;
520  }
521 }
522 
524 {
525  widget* w = node.find("name", false);
526  if(label* lbl = dynamic_cast<label*>(w)) {
527  model().set_data(vars()[lbl->get_label().str()]);
528  }
529 }
530 
532 {
533  widget* w = node.find("name", false);
534  if(label* lbl = dynamic_cast<label*>(w)) {
535  const std::string& var = lbl->get_label();
536  std::size_t n_start = var.find_last_of('[') + 1;
537  std::size_t n_len = var.size() - n_start - 1;
538  int n = std::stoi(var.substr(n_start, n_len));
539  model().set_data(config_to_string(vars().child(var.substr(1, n_start - 3), n)));
540  }
541 }
542 
544 {
545  model().clear_data();
546 
547  if(node.count_children() > 0) {
548  return;
549  }
550 
551  for(const auto & cfg : events.child_range(is_wmi ? "menu_item" : "event"))
552  {
553  std::string name = is_wmi ? cfg["id"] : cfg["name"];
554  bool named_event = !is_wmi && !cfg["id"].empty();
555 
556  auto progress = view()
557  .stuff_list_entry(&node, named_event ? "named_event" : "basic")
558  .widget("name", name);
559 
560  if(named_event) {
561  std::ostringstream out;
562  out << "id=\"" << cfg["id"] << '"';
563  progress.widget("id", out.str());
564  }
565 
566  c.set_node_callback(progress.add(), &event_mode_controller::show_event, is_wmi);
567  }
568 
569 }
570 
572 {
573  int n = node.describe_path().back();
574  model().set_data(config_to_string(events.child(is_wmi ? "menu_item" : "event", n)));
575 }
576 
578 {
579 
580  color_t team_color = game_config::tc_info(dc.get_team(u.side()).color())[0];
581  std::stringstream s;
582 
583  s << '(' << u.get_location() << ')';
584  progress.widget("loc", s.str());
585 
586  s.str("");
587  s << font::span_color(team_color);
588  s << "side=" << u.side() << "</span>";
589  progress.widget("side", s.str(), true);
590 
591  if(u.can_recruit()) {
592  progress.widget("leader", "<span color='yellow'>LEADER</span> ", true);
593  }
594 
595  s.str("");
596  s << "id=\"" << u.id() << '"';
597  progress.widget("id", s.str());
598 
599  progress.widget("type", u.type_id());
600 
601  s.str("");
602  s << "L" << u.level();
603  progress.widget("level", s.str());
604 
605  s.str("");
606  s << u.experience() << '/' << u.max_experience() << " xp";
607  progress.widget("xp", s.str());
608 
609  s.str("");
610  s << u.hitpoints() << '/' << u.max_hitpoints() << " hp";
611  progress.widget("hp", s.str());
612 
613  progress.widget("traits", utils::join(u.get_traits_list(), ", "));
614 
615  return progress;
616 }
617 
619 {
620  model().clear_data();
621 
622  if(node.count_children() > 0) {
623  return;
624  }
625 
626  for(unit_map::const_iterator i = dc().units().begin(); i != dc().units().end(); ++i) {
627  auto progress = view().stuff_list_entry(&node, "unit");
628  add_unit_entry(progress, *i, dc());
630  }
631 }
632 
634 {
635  int i = node.describe_path().back();
637  std::advance(u, i);
638  config c_unit;
639  u->write(c_unit);
640  model().set_data(config_to_string(c_unit));
641 }
642 
644 {
645  config&& cfg = dc().get_team(side).to_config();
646  cfg.clear_children("ai");
647  model().set_data(config_to_string(cfg));
648 
649  if(node.count_children() > 0) {
650  return;
651  }
652 
654  view().stuff_list_entry(&node, "basic")
655  .widget("name", "ai")
656  .add(),
658  side);
660  view().stuff_list_entry(&node, "basic")
661  .widget("name", "recall list")
662  .add(),
664  side);
666  view().stuff_list_entry(&node, "basic")
667  .widget("name", "units")
668  .add(),
670  side);
671 }
672 
674 {
675  model().set_data(ai::manager::get_singleton().get_active_ai_overview_for_side(side));
676 
677  if(node.count_children() > 0) {
678  return;
679  }
680 
682  view().stuff_list_entry(&node, "basic")
683  .widget("name", "engines")
684  .add(),
686  side);
688  view().stuff_list_entry(&node, "basic")
689  .widget("name", "stages")
690  .add(),
692  side);
694  view().stuff_list_entry(&node, "basic")
695  .widget("name", "aspects")
696  .add(),
698  side);
700  view().stuff_list_entry(&node, "basic")
701  .widget("name", "goals")
702  .add(),
704  side);
706  view().stuff_list_entry(&node, "basic")
707  .widget("name", "component structure")
708  .add(),
710  side);
711 }
712 
714 {
715  widget* w = node.find("name", false);
716  if(label* lbl = dynamic_cast<label*>(w)) {
717  std::string tag = lbl->get_label();
718  tag.pop_back();
719  model().set_data(config_to_string(ai::manager::get_singleton().to_config(side), tag));
720  }
721 }
722 
724 {
725  model().clear_data();
726 
727  if(node.count_children() > 0) {
728  return;
729  }
730 
731  for(const unit_ptr& u : dc().get_team(side).recall_list()) {
732  auto progress = view().stuff_list_entry(&node, "unit");
733  add_unit_entry(progress, *u, dc());
735  }
736 }
737 
739 {
740  int i = node.describe_path().back();
741  auto u = dc().get_team(side).recall_list().begin();
742  std::advance(u, i);
743  config c_unit;
744  (*u)->write(c_unit);
745  model().set_data(config_to_string(c_unit));
746 }
747 
749 {
750  model().set_data(ai::manager::get_singleton().get_active_ai_structure_for_side(side));
751 }
752 
754 {
755  std::ostringstream s;
756  for(unit_map::const_iterator i = dc().units().begin(); i != dc().units().end();
757  ++i) {
758  if(i->side() != side) {
759  continue;
760  }
761  s << '(' << i->get_location() << ") ";
762  if(i->can_recruit()) {
763  s << "LEADER ";
764  }
765 
766  s << "\nid=\"" << i->id() << "\" (" << i->type_id() << ")\n"
767  << "L" << i->level() << "; " << i->experience() << '/'
768  << i->max_experience() << " XP; " << i->hitpoints() << '/'
769  << i->max_hitpoints() << " HP\n";
770  for(const auto & str : i->get_traits_list())
771  {
772  s << "\t" << str << std::endl;
773  }
774  s << std::endl;
775  }
776  model().set_data(s.str());
777 }
778 
780 
782  : title_(title)
783  , vars_(vars)
784  , events_(events)
785  , dc_(dc)
786 {
787  model_.reset(new model);
788 }
789 
791 {
792  view_.reset(new view(window));
793  controller_.reset(new controller(*model_, *view_, vars_, events_, dc_));
794 
795  if(!title_.empty()) {
796  find_widget<styled_widget>(&window, "inspector_name", false).set_label(title_);
797  }
798  controller_->bind(window);
799  view_->update(*model_);
800 }
801 
802 } // namespace dialogs
std::map< std::string, string_map > data_
unit_iterator end()
Definition: map.hpp:428
const_all_children_itors all_children_range() const
In-order iteration over all children.
Definition: config.cpp:953
std::vector< std::shared_ptr< single_mode_controller > > controllers
const team & get_team(int side) const
std::function< void(tree_view_node &)> node_callback
void clear_children(T... keys)
Definition: config.hpp:526
This class represents a single unit of a specific type.
Definition: unit.hpp:120
const std::string & type_id() const
The id of this unit&#39;s type.
Definition: unit.cpp:1769
bool available()
Whether wesnoth was compiled with support for a clipboard.
Definition: clipboard.cpp:54
std::string join(const T &v, const std::string &s=",")
Generates a new string joining container items in a list.
std::vector< int > describe_path()
Calculates the node indices needed to get from the root node to this node.
static manager & get_singleton()
Definition: manager.hpp:143
void show_ai_tree(tree_view_node &node, int side)
const game_events::manager & events_
int hitpoints() const
The current number of hitpoints this unit has.
Definition: unit.hpp:492
This file contains the window object, this object is a top level container which has the event manage...
child_itors child_range(config_key_type key)
Definition: config.cpp:356
Base class for all widgets.
Definition: widget.hpp:49
This shows the gamestate inspector.
unit_iterator begin()
Definition: map.hpp:418
void show_recall(tree_view_node &node, int side)
STL namespace.
A label displays a text, the text can be wrapped but no scrollbars are provided.
Definition: label.hpp:56
void set_node_callback(const std::vector< int > &node_path, void(C::*fcn)(tree_view_node &, T), T param)
widget * find(const std::string &id, const bool must_be_active) override
See widget::find.
static std::string _(const char *str)
Definition: gettext.hpp:92
void show_list(tree_view_node &node, bool is_wmi)
std::shared_ptr< unit > unit_ptr
Definition: ptr.hpp:25
event_mode_controller(gamestate_inspector::controller &c)
const_attr_itors attribute_range() const
Definition: config.cpp:833
static void display(lua_kernel_base *lk)
Display a new console, using given video and lua kernel.
T * find_widget(utils::const_clone_ptr< widget, T > widget, const std::string &id, const bool must_be_active, const bool must_exist)
Gets a widget with the wanted id.
Definition: find_widget.hpp:68
std::size_t count_children() const
The number of children in this widget.
std::string span_color(const color_t &color)
Returns a Pango formatting string using the provided color_t object.
void write(std::ostream &out, const configr_of &cfg, unsigned int level)
Definition: parser.cpp:763
const game_events::manager & events() const
const std::string & id() const
Gets this unit&#39;s id.
Definition: unit.hpp:370
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:186
variable_mode_controller(gamestate_inspector::controller &c)
This file contains the settings handling of the widget library.
void set_data(const std::string &new_data)
gamestate_inspector::controller & c
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
gamestate_inspector::model & model()
std::string selected
iterator begin()
begin iterator
int max_experience() const
The max number of experience points this unit can have.
Definition: unit.hpp:522
int level() const
The current level of this unit.
Definition: unit.hpp:552
stuff_list_adder(tree_view_node &stuff_list, const std::string &defn)
Managing the AIs lifecycle - headers TODO: Refactor history handling and internal commands...
A tree view is a control that holds several items of the same or different types. ...
Definition: tree_view.hpp:59
virtual const unit_map & units() const =0
void show_event(tree_view_node &node, bool is_wmi)
void show_units(tree_view_node &node, int side)
void set_node_callback(const std::vector< int > &node_path, void(C::*fcn)(tree_view_node &))
void show_recall_unit(tree_view_node &node, int side)
stuff_list_adder stuff_list_entry(tree_view_node *parent, const std::string &defn)
Domain specific events.
Definition: action_wml.cpp:86
void show_ai_components(tree_view_node &node, int side)
std::vector< std::pair< std::size_t, int > > pages
std::size_t i
Definition: function.cpp:934
virtual const std::vector< team > & teams() const =0
unit_mode_controller(gamestate_inspector::controller &c)
void write_events(config &cfg) const
Definition: manager.cpp:135
int max_hitpoints() const
The max number of hitpoints this unit can have.
Definition: unit.hpp:498
mock_party p
The user set the widget invisible, that means:
static map_location::DIRECTION s
bool can_recruit() const
Whether this unit can recruit other units - ie, are they a leader unit.
Definition: unit.hpp:605
std::string name
Definition: sdl_ttf.cpp:70
std::string bool_string(const bool value)
Converts a bool value to &#39;true&#39; or &#39;false&#39;.
virtual void pre_show(window &window) override
Inherited from modal_dialog.
std::map< std::string, t_string > string_map
Definition: widget.hpp:26
std::vector< std::string > get_traits_list() const
Gets a list of the traits this unit currently has.
Definition: unit.cpp:830
int w
The game event manager loads the scenario configuration object, and ensures that events are handled a...
Definition: manager.hpp:43
Base class for all visible items.
single_mode_controller(gamestate_inspector::controller &c)
stuff_list_adder & widget(const std::string &ref, const std::string &label, bool markup=false)
config & add_child(config_key_type key)
Definition: config.cpp:500
Handling of system events.
Definition: manager.hpp:42
#define next(ls)
Definition: llex.cpp:32
void copy_to_clipboard(const std::string &text, const bool)
Copies text to the clipboard.
Definition: clipboard.cpp:33
The user sets the widget visible, that means:
int experience() const
The current number of experience points this unit has.
Definition: unit.hpp:516
std::map< std::vector< int >, node_callback > node_callback_map
const map_location & get_location() const
The current map location this unit is at.
Definition: unit.hpp:1348
recall_list_manager & recall_list()
Definition: team.hpp:223
EXIT_STATUS start(const std::string &filename, bool take_screenshot, const std::string &screenshot_filename)
Main interface for launching the editor from the title screen.
Definition: editor_main.cpp:28
void show_list(tree_view_node &node, int side)
const std::vector< color_t > & tc_info(const std::string &name)
team_mode_controller(gamestate_inspector::controller &c)
int side() const
The side this unit belongs to.
Definition: unit.hpp:333
void show_ai(tree_view_node &node, int side)
static stuff_list_adder add_unit_entry(stuff_list_adder &progress, const unit &u, const display_context &dc)
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:59
controller(model &m, view &v, const config &vars, const game_events::manager &events, const display_context &dc)
mock_char c
static map_location::DIRECTION n
base class of top level items, the only item which needs to store the final canvases to draw on...
Definition: window.hpp:64
const t_string & user_team_name() const
Definition: team.hpp:306
std::pair< std::string, unsigned > item
Definition: help_impl.hpp:407
config to_config() const
Definition: team.cpp:1033
const display_context & dc() const