The Battle for Wesnoth  1.15.2+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 "utils/functional.hpp"
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
70 {
71 namespace dialogs
72 {
73 
74 /*WIKI
75  * @page = GUIWindowDefinitionWML
76  * @order = 2_gamestate_inspector
77  *
78  * == Gamestate inspector ==
79  *
80  * This shows the gamestate inspector
81  *
82  * @begin{table}{dialog_widgets}
83  *
84  * inspector_name & & styled_widget & m &
85  * Name of the inspector. $
86  *
87  * stuff_list & & styled_widget & m &
88  * List of various stuff that can be viewed. $
89  *
90  * inspect & & styled_widget & m &
91  * The state of the variable or event. $
92  *
93  * copy & & button & m &
94  * A button to copy the state to clipboard. $
95  *
96  * @end{table}
97  */
98 
100 {
101 public:
102  std::string name;
103 
104  std::string get_data_full() const
105  {
106  return data;
107  }
108 
109  std::string get_data_paged(int which_page)
110  {
111  if(std::size_t(which_page) >= pages.size()) {
112  return "";
113  }
114  return data.substr(pages[which_page].first, pages[which_page].second);
115  }
116 
117  void clear_data()
118  {
119  data.clear();
120  }
121 
122  void set_data(const std::string& new_data)
123  {
124  data = new_data;
125  repaginate();
126  }
127 
129  {
130  return std::max<int>(pages.size(), 1);
131  }
132 
133 private:
134  void repaginate()
135  {
136  pages.clear();
137  std::size_t start = 0;
138  while(start < data.size()) {
139  std::size_t end = data.find_last_of('\n', start + max_inspect_win_len);
140  if(end == std::string::npos) {
141  end = data.size() - 1;
142  }
143  int len = end - start + 1;
144  pages.emplace_back(start, len);
145  start += len;
146  }
147  }
148  static const unsigned int max_inspect_win_len = 20000;
149  std::string data;
150  std::vector<std::pair<std::size_t,int>> pages;
151 };
152 
154 {
155 public:
156  stuff_list_adder(tree_view_node& stuff_list, const std::string& defn)
157  : stuff_list_(stuff_list)
158  , defn_(defn)
159  {
160  }
161 
162  std::vector<int> add()
163  {
164  return stuff_list_.add_child(defn_, data_).describe_path();
165  }
166 
167  stuff_list_adder& widget(const std::string& ref, const std::string& label, bool markup = false)
168  {
169  string_map& item = data_[ref];
170  item["label"] = label;
171  item["use_markup"] = utils::bool_string(markup);
172  return *this;
173  }
174 
175 private:
177  const std::string defn_;
178  std::map<std::string, string_map> data_;
179 };
180 
182 {
183 public:
185  : stuff_list_(find_widget<tree_view>(&window, "stuff_list", false, true))
186  , inspect_(find_widget<styled_widget>(&window, "inspect", false, true))
187  , pages_(find_widget<styled_widget>(&window, "page_count", false, true))
188  , left_(find_widget<styled_widget>(&window, "page_left", false, true))
189  , right_(find_widget<styled_widget>(&window, "page_right", false, true))
190  {
191  }
192 
193  stuff_list_adder stuff_list_entry(tree_view_node* parent, const std::string& defn)
194  {
195  return stuff_list_adder(parent ? *parent : stuff_list_->get_root_node(), defn);
196  }
197 
198  void update(model& m)
199  {
200  int n_pages = m.count_pages();
201  current_page_ = std::min(n_pages - 1, std::max(0, current_page_));
202  inspect_->set_label(m.get_data_paged(current_page_));
203  if(n_pages > 1) {
204  std::ostringstream out;
205  out << current_page_ + 1 << '/' << n_pages;
206  pages_->set_label(out.str());
207  left_->set_visible(widget::visibility::visible);
208  right_->set_visible(widget::visibility::visible);
209  } else {
210  pages_->set_label("");
211  left_->set_visible(widget::visibility::invisible);
212  right_->set_visible(widget::visibility::invisible);
213  }
214  }
215 
217  {
218  stuff_list_->clear();
219  pages_->set_label("");
220  left_->set_visible(widget::visibility::invisible);
221  right_->set_visible(widget::visibility::invisible);
222  }
223 
224  void page(int where)
225  {
226  current_page_ += where;
227  }
228 
229 private:
230  int current_page_ = 0;
236 };
237 
239 {
240 public:
242  {
243  }
244 
246  {
247  }
248 
249 protected:
253  const config& vars() const;
254  const game_events::manager& events() const;
255  const display_context& dc() const;
256 };
257 
259 {
260 public:
263  {
264  }
265 
266  void show_list(tree_view_node& node);
267  void show_var(tree_view_node& node);
268  void show_array(tree_view_node& node);
269 };
270 
272 {
273 public:
275  void show_list(tree_view_node& node, bool is_wmi);
276  void show_event(tree_view_node& node, bool is_wmi);
277 
278 private:
280 };
281 
283 {
284 public:
287  {
288  }
289 
290  void show_list(tree_view_node& node);
291  void show_unit(tree_view_node& node);
292 };
293 
295 {
296 public:
299  {
300  }
301 
302  void show_list(tree_view_node& node, int side);
303  void show_ai(tree_view_node& node, int side);
304  void show_ai_components(tree_view_node& node, int side);
305  void show_ai_tree(tree_view_node& node, int side);
306  void show_recall(tree_view_node& node, int side);
307  void show_recall_unit(tree_view_node& node, int side);
308  void show_units(tree_view_node& node, int side);
309  void show_unit(tree_view_node& node, int side);
310 };
311 
313 {
315 public:
316  controller(model& m, view& v, const config& vars, const game_events::manager& events, const display_context& dc)
317  : model_(m), view_(v)
318  , vars_(vars), events_(events), dc_(dc)
319  {
320  }
321 
323  {
324  tree_view_node* selected = dynamic_cast<tree_view&>(tree).selected_item();
325  callbacks[selected->describe_path()](*selected);
326 
327  // We recursively fold, but non-recursively unfold.
328  // This is because only one node on a level should be open at any given time.
329  // Furthermore, there's no need to remember that a subnode was open once the parent is closed.
330  if(!selected->is_root_node()) {
331  for(auto& node : selected->parent_node().children()) {
332  if(node.get() != selected) {
333  node->fold(true);
334  }
335  }
336 
337  selected->unfold();
338  }
339 
340  view_.update(model_);
341  }
342 
344  {
345  desktop::clipboard::copy_to_clipboard(model_.get_data_full(), false);
346  }
347 
349  {
351  // The game state could've changed, so reset the dialog
352  callbacks.clear();
353  controllers.clear();
354  view_.clear_stuff_list();
355  build_stuff_list(window);
356  model_.clear_data();
357  view_.update(model_);
358  }
359 
361  {
362  view_.page(next ? 1 : -1);
363  view_.update(model_);
364  }
365 
366  template<typename T>
367  std::shared_ptr<T> get_controller()
368  {
369  for(auto& c : controllers) {
370  if(std::shared_ptr<T> p = std::dynamic_pointer_cast<T>(c)) {
371  return p;
372  }
373  }
374  std::shared_ptr<T> p = std::make_shared<T>(*this);
375  controllers.push_back(p);
376  return p;
377  }
378 
379  template<typename C>
380  void set_node_callback(const std::vector<int>& node_path, void (C::* fcn)(tree_view_node&))
381  {
382  C& sub_controller = *get_controller<C>();
383  callbacks.emplace(node_path, std::bind(fcn, sub_controller, _1));
384  }
385 
386  template<typename C, typename T>
387  void set_node_callback(const std::vector<int>& node_path, void (C::* fcn)(tree_view_node&, T), T param)
388  {
389  C& sub_controller = *get_controller<C>();
390  callbacks.emplace(node_path, std::bind(fcn, sub_controller, _1, param));
391  }
392 
394  {
395  auto stuff_list = find_widget<tree_view>(&window, "stuff_list", false, true);
396  auto copy_button = find_widget<button>(&window, "copy", false, true);
397  auto lua_button = find_widget<button>(&window, "lua", false, true);
398  auto left_button = find_widget<button>(&window, "page_left", false, true);
399  auto right_button = find_widget<button>(&window, "page_right", false, true);
400 
401  connect_signal_notify_modified(*stuff_list,
403 
405  *copy_button,
407  this));
408 
410  *lua_button,
412  this, std::ref(window)));
413 
415  *left_button,
417  this, false));
418 
420  *right_button,
422  this, true));
423 
424  left_button->set_visible(widget::visibility::invisible);
425  right_button->set_visible(widget::visibility::invisible);
426 
428  copy_button->set_active(false);
429  copy_button->set_tooltip(_("Clipboard support not found, contact your packager"));
430  }
431 
432  build_stuff_list(window);
433  }
434 
436  {
437  set_node_callback(
438  view_.stuff_list_entry(nullptr, "basic")
439  .widget("name", "variables")
440  .add(),
442  set_node_callback(
443  view_.stuff_list_entry(nullptr, "basic")
444  .widget("name", "events")
445  .add(),
447  false);
448  set_node_callback(
449  view_.stuff_list_entry(nullptr, "basic")
450  .widget("name", "menu items")
451  .add(),
453  true);
454  set_node_callback(
455  view_.stuff_list_entry(nullptr, "basic")
456  .widget("name", "units")
457  .add(),
459  int sides = dc_.teams().size();
460  for(int side = 1; side <= sides; side++) {
461  std::ostringstream label;
462  label << "team " << side;
463  const std::string& name = dc_.get_team(side).user_team_name();
464  if(!name.empty()) {
465  label << " (" << name << ")";
466  }
467  set_node_callback(
468  view_.stuff_list_entry(nullptr, "basic")
469  .widget("name", label.str())
470  .add(),
472  side);
473  }
474  // Expand initially selected node
475  callbacks[{0}](find_widget<tree_view>(&window, "stuff_list", false).get_root_node().get_child_at(0));
476  }
477 
478 private:
481  using node_callback = std::function<void(tree_view_node&)>;
482  using node_callback_map = std::map<std::vector<int>, node_callback>;
483  std::vector<std::shared_ptr<single_mode_controller>> controllers;
485  const config& vars_;
488 };
489 
491  return c.model_;
492 }
493 
495  return c.view_;
496 }
497 
499  return c.vars_;
500 }
501 
503  return c.events_;
504 }
505 
507  return c.dc_;
508 }
509 
512 {
514 }
515 
517 {
518  model().clear_data();
519 
520  if(node.count_children() > 0) {
521  return;
522  }
523 
524  for(const auto& attr : vars().attribute_range())
525  {
527  view().stuff_list_entry(&node, "basic")
528  .widget("name", attr.first)
529  .add(),
531  }
532 
533  std::map<std::string, std::size_t> wml_array_sizes;
534 
535  for(const auto& ch : vars().all_children_range())
536  {
537 
538  std::ostringstream cur_str;
539  cur_str << "[" << ch.key << "][" << wml_array_sizes[ch.key] << "]";
540 
541  this->c.set_node_callback(
542  view().stuff_list_entry(&node, "basic")
543  .widget("name", cur_str.str())
544  .add(),
546  wml_array_sizes[ch.key]++;
547  }
548 }
549 
551 {
552  widget* w = node.find("name", false);
553  if(label* lbl = dynamic_cast<label*>(w)) {
554  model().set_data(vars()[lbl->get_label().str()]);
555  }
556 }
557 
559 {
560  widget* w = node.find("name", false);
561  if(label* lbl = dynamic_cast<label*>(w)) {
562  const std::string& var = lbl->get_label();
563  std::size_t n_start = var.find_last_of('[') + 1;
564  std::size_t n_len = var.size() - n_start - 1;
565  int n = std::stoi(var.substr(n_start, n_len));
566  model().set_data(config_to_string(vars().child(var.substr(1, n_start - 3), n)));
567  }
568 }
569 
571 {
572  model().clear_data();
573 
574  if(node.count_children() > 0) {
575  return;
576  }
577 
578  for(const auto & cfg : events.child_range(is_wmi ? "menu_item" : "event"))
579  {
580  std::string name = is_wmi ? cfg["id"] : cfg["name"];
581  bool named_event = !is_wmi && !cfg["id"].empty();
582 
583  auto progress = view()
584  .stuff_list_entry(&node, named_event ? "named_event" : "basic")
585  .widget("name", name);
586 
587  if(named_event) {
588  std::ostringstream out;
589  out << "id=\"" << cfg["id"] << '"';
590  progress.widget("id", out.str());
591  }
592 
593  c.set_node_callback(progress.add(), &event_mode_controller::show_event, is_wmi);
594  }
595 
596 }
597 
599 {
600  int n = node.describe_path().back();
601  model().set_data(config_to_string(events.child(is_wmi ? "menu_item" : "event", n)));
602 }
603 
605 {
606 
607  color_t team_color = game_config::tc_info(dc.get_team(u.side()).color())[0];
608  std::stringstream s;
609 
610  s << '(' << u.get_location() << ')';
611  progress.widget("loc", s.str());
612 
613  s.str("");
614  s << font::span_color(team_color);
615  s << "side=" << u.side() << "</span>";
616  progress.widget("side", s.str(), true);
617 
618  if(u.can_recruit()) {
619  progress.widget("leader", "<span color='yellow'>LEADER</span> ", true);
620  }
621 
622  s.str("");
623  s << "id=\"" << u.id() << '"';
624  progress.widget("id", s.str());
625 
626  progress.widget("type", u.type_id());
627 
628  s.str("");
629  s << "L" << u.level();
630  progress.widget("level", s.str());
631 
632  s.str("");
633  s << u.experience() << '/' << u.max_experience() << " xp";
634  progress.widget("xp", s.str());
635 
636  s.str("");
637  s << u.hitpoints() << '/' << u.max_hitpoints() << " hp";
638  progress.widget("hp", s.str());
639 
640  progress.widget("traits", utils::join(u.get_traits_list(), ", "));
641 
642  return progress;
643 }
644 
646 {
647  model().clear_data();
648 
649  if(node.count_children() > 0) {
650  return;
651  }
652 
653  for(unit_map::const_iterator i = dc().units().begin(); i != dc().units().end(); ++i) {
654  auto progress = view().stuff_list_entry(&node, "unit");
655  add_unit_entry(progress, *i, dc());
657  }
658 }
659 
661 {
662  int i = node.describe_path().back();
664  std::advance(u, i);
665  config c_unit;
666  u->write(c_unit);
667  model().set_data(config_to_string(c_unit));
668 }
669 
671 {
672  config&& cfg = dc().get_team(side).to_config();
673  cfg.clear_children("ai");
674  model().set_data(config_to_string(cfg));
675 
676  if(node.count_children() > 0) {
677  return;
678  }
679 
681  view().stuff_list_entry(&node, "basic")
682  .widget("name", "ai")
683  .add(),
685  side);
687  view().stuff_list_entry(&node, "basic")
688  .widget("name", "recall list")
689  .add(),
691  side);
693  view().stuff_list_entry(&node, "basic")
694  .widget("name", "units")
695  .add(),
697  side);
698 }
699 
701 {
702  model().set_data(ai::manager::get_singleton().get_active_ai_overview_for_side(side));
703 
704  if(node.count_children() > 0) {
705  return;
706  }
707 
709  view().stuff_list_entry(&node, "basic")
710  .widget("name", "engines")
711  .add(),
713  side);
715  view().stuff_list_entry(&node, "basic")
716  .widget("name", "stages")
717  .add(),
719  side);
721  view().stuff_list_entry(&node, "basic")
722  .widget("name", "aspects")
723  .add(),
725  side);
727  view().stuff_list_entry(&node, "basic")
728  .widget("name", "goals")
729  .add(),
731  side);
733  view().stuff_list_entry(&node, "basic")
734  .widget("name", "component structure")
735  .add(),
737  side);
738 }
739 
741 {
742  widget* w = node.find("name", false);
743  if(label* lbl = dynamic_cast<label*>(w)) {
744  std::string tag = lbl->get_label();
745  tag.pop_back();
746  model().set_data(config_to_string(ai::manager::get_singleton().to_config(side), tag));
747  }
748 }
749 
751 {
752  model().clear_data();
753 
754  if(node.count_children() > 0) {
755  return;
756  }
757 
758  for(const unit_ptr u : dc().get_team(side).recall_list()) {
759  auto progress = view().stuff_list_entry(&node, "unit");
760  add_unit_entry(progress, *u, dc());
762  }
763 }
764 
766 {
767  int i = node.describe_path().back();
768  auto u = dc().get_team(side).recall_list().begin();
769  std::advance(u, i);
770  config c_unit;
771  (*u)->write(c_unit);
772  model().set_data(config_to_string(c_unit));
773 }
774 
776 {
777  model().set_data(ai::manager::get_singleton().get_active_ai_structure_for_side(side));
778 }
779 
781 {
782  std::ostringstream s;
783  for(unit_map::const_iterator i = dc().units().begin(); i != dc().units().end();
784  ++i) {
785  if(i->side() != side) {
786  continue;
787  }
788  s << '(' << i->get_location() << ") ";
789  if(i->can_recruit()) {
790  s << "LEADER ";
791  }
792 
793  s << "\nid=\"" << i->id() << "\" (" << i->type_id() << ")\n"
794  << "L" << i->level() << "; " << i->experience() << '/'
795  << i->max_experience() << " XP; " << i->hitpoints() << '/'
796  << i->max_hitpoints() << " HP\n";
797  for(const auto & str : i->get_traits_list())
798  {
799  s << "\t" << str << std::endl;
800  }
801  s << std::endl;
802  }
803  model().set_data(s.str());
804 }
805 
807 
809  : title_(title)
810  , vars_(vars)
811  , events_(events)
812  , dc_(dc)
813 {
814  model_.reset(new model);
815 }
816 
818 {
819  view_.reset(new view(window));
820  controller_.reset(new controller(*model_, *view_, vars_, events_, dc_));
821 
822  if(!title_.empty()) {
823  find_widget<styled_widget>(&window, "inspector_name", false).set_label(title_);
824  }
825  controller_->bind(window);
826  view_->update(*model_);
827 }
828 
829 } // namespace dialogs
830 } // namespace gui2
std::map< std::string, string_map > data_
unit_iterator end()
Definition: map.hpp:415
const_all_children_itors all_children_range() const
In-order iteration over all children.
Definition: config.cpp:921
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:477
This class represents a single unit of a specific type.
Definition: unit.hpp:99
bool available()
Whether wesnoth was compiled with support for a clipboard.
Definition: clipboard.cpp:56
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:150
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:460
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:362
Base class for all widgets.
Definition: widget.hpp:47
unit_iterator begin()
Definition: map.hpp:405
void show_recall(tree_view_node &node, int side)
STL namespace.
const std::string & type_id() const
The id of this unit&#39;s type.
Definition: unit.hpp:327
Label showing a text.
Definition: label.hpp:32
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.
-file sdl_utils.hpp
void show_list(tree_view_node &node, bool is_wmi)
event_mode_controller(gamestate_inspector::controller &c)
const_attr_itors attribute_range() const
Definition: config.cpp:809
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.
Generic file dialog.
Definition: field-fwd.hpp:22
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:762
static UNUSEDNOWARN std::string _(const char *str)
Definition: gettext.hpp:91
const game_events::manager & events() const
const std::string & id() const
Gets this unit&#39;s id.
Definition: unit.hpp:344
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:248
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:233
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:490
int level() const
The current level of this unit.
Definition: unit.hpp:520
stuff_list_adder(tree_view_node &stuff_list, const std::string &defn)
Managing the AIs lifecycle - headers TODO: Refactor history handling and internal commands...
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 &))
Various uncategorised dialogs.
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:88
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:933
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:466
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:577
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:24
std::vector< std::string > get_traits_list() const
Gets a list of the traits this unit currently has.
Definition: unit.cpp:902
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:476
Handling of system events.
Definition: manager.hpp:41
#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:35
boost::intrusive_ptr< unit > unit_ptr
Definition: ptr.hpp:29
The user sets the widget visible, that means:
int experience() const
The current number of experience points this unit has.
Definition: unit.hpp:484
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:1266
recall_list_manager & recall_list()
Definition: team.hpp:215
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:304
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:68
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:63
const t_string & user_team_name() const
Definition: team.hpp:298
std::pair< std::string, unsigned > item
Definition: help_impl.hpp:371
config to_config() const
Definition: team.cpp:1034
const display_context & dc() const