The Battle for Wesnoth  1.15.0+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  stuff_list->set_selection_change_callback(std::bind(&gamestate_inspector::controller::handle_stuff_list_item_clicked, this, _1));
402 
404  *copy_button,
406  this));
407 
409  *lua_button,
411  this, std::ref(window)));
412 
414  *left_button,
416  this, false));
417 
419  *right_button,
421  this, true));
422 
423  left_button->set_visible(widget::visibility::invisible);
424  right_button->set_visible(widget::visibility::invisible);
425 
427  copy_button->set_active(false);
428  copy_button->set_tooltip(_("Clipboard support not found, contact your packager"));
429  }
430 
431  build_stuff_list(window);
432  }
433 
435  {
436  set_node_callback(
437  view_.stuff_list_entry(nullptr, "basic")
438  .widget("name", "variables")
439  .add(),
441  set_node_callback(
442  view_.stuff_list_entry(nullptr, "basic")
443  .widget("name", "events")
444  .add(),
446  false);
447  set_node_callback(
448  view_.stuff_list_entry(nullptr, "basic")
449  .widget("name", "menu items")
450  .add(),
452  true);
453  set_node_callback(
454  view_.stuff_list_entry(nullptr, "basic")
455  .widget("name", "units")
456  .add(),
458  int sides = dc_.teams().size();
459  for(int side = 1; side <= sides; side++) {
460  std::ostringstream label;
461  label << "team " << side;
462  const std::string& name = dc_.get_team(side).user_team_name();
463  if(!name.empty()) {
464  label << " (" << name << ")";
465  }
466  set_node_callback(
467  view_.stuff_list_entry(nullptr, "basic")
468  .widget("name", label.str())
469  .add(),
471  side);
472  }
473  // Expand initially selected node
474  callbacks[{0}](find_widget<tree_view>(&window, "stuff_list", false).get_root_node().get_child_at(0));
475  }
476 
477 private:
480  using node_callback = std::function<void(tree_view_node&)>;
481  using node_callback_map = std::map<std::vector<int>, node_callback>;
482  std::vector<std::shared_ptr<single_mode_controller>> controllers;
484  const config& vars_;
487 };
488 
490  return c.model_;
491 }
492 
494  return c.view_;
495 }
496 
498  return c.vars_;
499 }
500 
502  return c.events_;
503 }
504 
506  return c.dc_;
507 }
508 
511 {
513 }
514 
516 {
517  model().clear_data();
518 
519  if(node.count_children() > 0) {
520  return;
521  }
522 
523  for(const auto& attr : vars().attribute_range())
524  {
526  view().stuff_list_entry(&node, "basic")
527  .widget("name", attr.first)
528  .add(),
530  }
531 
532  std::map<std::string, std::size_t> wml_array_sizes;
533 
534  for(const auto& ch : vars().all_children_range())
535  {
536 
537  std::ostringstream cur_str;
538  cur_str << "[" << ch.key << "][" << wml_array_sizes[ch.key] << "]";
539 
540  this->c.set_node_callback(
541  view().stuff_list_entry(&node, "basic")
542  .widget("name", cur_str.str())
543  .add(),
545  wml_array_sizes[ch.key]++;
546  }
547 }
548 
550 {
551  widget* w = node.find("name", false);
552  if(label* lbl = dynamic_cast<label*>(w)) {
553  model().set_data(vars()[lbl->get_label().str()]);
554  }
555 }
556 
558 {
559  widget* w = node.find("name", false);
560  if(label* lbl = dynamic_cast<label*>(w)) {
561  const std::string& var = lbl->get_label();
562  std::size_t n_start = var.find_last_of('[') + 1;
563  std::size_t n_len = var.size() - n_start - 1;
564  int n = std::stoi(var.substr(n_start, n_len));
565  model().set_data(config_to_string(vars().child(var.substr(1, n_start - 3), n)));
566  }
567 }
568 
570 {
571  model().clear_data();
572 
573  if(node.count_children() > 0) {
574  return;
575  }
576 
577  for(const auto & cfg : events.child_range(is_wmi ? "menu_item" : "event"))
578  {
579  std::string name = is_wmi ? cfg["id"] : cfg["name"];
580  bool named_event = !is_wmi && !cfg["id"].empty();
581 
582  auto progress = view()
583  .stuff_list_entry(&node, named_event ? "named_event" : "basic")
584  .widget("name", name);
585 
586  if(named_event) {
587  std::ostringstream out;
588  out << "id=\"" << cfg["id"] << '"';
589  progress.widget("id", out.str());
590  }
591 
592  c.set_node_callback(progress.add(), &event_mode_controller::show_event, is_wmi);
593  }
594 
595 }
596 
598 {
599  int n = node.describe_path().back();
600  model().set_data(config_to_string(events.child(is_wmi ? "menu_item" : "event", n)));
601 }
602 
604 {
605 
606  color_t team_color = game_config::tc_info(dc.get_team(u.side()).color())[0];
607  std::stringstream s;
608 
609  s << '(' << u.get_location() << ')';
610  progress.widget("loc", s.str());
611 
612  s.str("");
613  s << font::span_color(team_color);
614  s << "side=" << u.side() << "</span>";
615  progress.widget("side", s.str(), true);
616 
617  if(u.can_recruit()) {
618  progress.widget("leader", "<span color='yellow'>LEADER</span> ", true);
619  }
620 
621  s.str("");
622  s << "id=\"" << u.id() << '"';
623  progress.widget("id", s.str());
624 
625  progress.widget("type", u.type_id());
626 
627  s.str("");
628  s << "L" << u.level();
629  progress.widget("level", s.str());
630 
631  s.str("");
632  s << u.experience() << '/' << u.max_experience() << " xp";
633  progress.widget("xp", s.str());
634 
635  s.str("");
636  s << u.hitpoints() << '/' << u.max_hitpoints() << " hp";
637  progress.widget("hp", s.str());
638 
639  progress.widget("traits", utils::join(u.get_traits_list(), ", "));
640 
641  return progress;
642 }
643 
645 {
646  model().clear_data();
647 
648  if(node.count_children() > 0) {
649  return;
650  }
651 
652  for(unit_map::const_iterator i = dc().units().begin(); i != dc().units().end(); ++i) {
653  auto progress = view().stuff_list_entry(&node, "unit");
654  add_unit_entry(progress, *i, dc());
656  }
657 }
658 
660 {
661  int i = node.describe_path().back();
663  std::advance(u, i);
664  config c_unit;
665  u->write(c_unit);
666  model().set_data(config_to_string(c_unit));
667 }
668 
670 {
671  config&& cfg = dc().get_team(side).to_config();
672  cfg.clear_children("ai");
673  model().set_data(config_to_string(cfg));
674 
675  if(node.count_children() > 0) {
676  return;
677  }
678 
680  view().stuff_list_entry(&node, "basic")
681  .widget("name", "ai")
682  .add(),
684  side);
686  view().stuff_list_entry(&node, "basic")
687  .widget("name", "recall list")
688  .add(),
690  side);
692  view().stuff_list_entry(&node, "basic")
693  .widget("name", "units")
694  .add(),
696  side);
697 }
698 
700 {
701  model().set_data(ai::manager::get_singleton().get_active_ai_overview_for_side(side));
702 
703  if(node.count_children() > 0) {
704  return;
705  }
706 
708  view().stuff_list_entry(&node, "basic")
709  .widget("name", "engines")
710  .add(),
712  side);
714  view().stuff_list_entry(&node, "basic")
715  .widget("name", "stages")
716  .add(),
718  side);
720  view().stuff_list_entry(&node, "basic")
721  .widget("name", "aspects")
722  .add(),
724  side);
726  view().stuff_list_entry(&node, "basic")
727  .widget("name", "goals")
728  .add(),
730  side);
732  view().stuff_list_entry(&node, "basic")
733  .widget("name", "component structure")
734  .add(),
736  side);
737 }
738 
740 {
741  widget* w = node.find("name", false);
742  if(label* lbl = dynamic_cast<label*>(w)) {
743  std::string tag = lbl->get_label();
744  tag.pop_back();
745  model().set_data(config_to_string(ai::manager::get_singleton().to_config(side), tag));
746  }
747 }
748 
750 {
751  model().clear_data();
752 
753  if(node.count_children() > 0) {
754  return;
755  }
756 
757  for(const unit_ptr u : dc().get_team(side).recall_list()) {
758  auto progress = view().stuff_list_entry(&node, "unit");
759  add_unit_entry(progress, *u, dc());
761  }
762 }
763 
765 {
766  int i = node.describe_path().back();
767  auto u = dc().get_team(side).recall_list().begin();
768  std::advance(u, i);
769  config c_unit;
770  (*u)->write(c_unit);
771  model().set_data(config_to_string(c_unit));
772 }
773 
775 {
776  model().set_data(ai::manager::get_singleton().get_active_ai_structure_for_side(side));
777 }
778 
780 {
781  std::ostringstream s;
782  for(unit_map::const_iterator i = dc().units().begin(); i != dc().units().end();
783  ++i) {
784  if(i->side() != side) {
785  continue;
786  }
787  s << '(' << i->get_location() << ") ";
788  if(i->can_recruit()) {
789  s << "LEADER ";
790  }
791 
792  s << "\nid=\"" << i->id() << "\" (" << i->type_id() << ")\n"
793  << "L" << i->level() << "; " << i->experience() << '/'
794  << i->max_experience() << " XP; " << i->hitpoints() << '/'
795  << i->max_hitpoints() << " HP\n";
796  for(const auto & str : i->get_traits_list())
797  {
798  s << "\t" << str << std::endl;
799  }
800  s << std::endl;
801  }
802  model().set_data(s.str());
803 }
804 
806 
808  : title_(title)
809  , vars_(vars)
810  , events_(events)
811  , dc_(dc)
812 {
813  model_.reset(new model);
814 }
815 
817 {
818  view_.reset(new view(window));
819  controller_.reset(new controller(*model_, *view_, vars_, events_, dc_));
820 
821  if(!title_.empty()) {
822  find_widget<styled_widget>(&window, "inspector_name", false).set_label(title_);
823  }
824  controller_->bind(window);
825  view_->update(*model_);
826 }
827 
828 } // namespace dialogs
829 } // 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:509
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:453
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:326
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
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48
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:343
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:483
int level() const
The current level of this unit.
Definition: unit.hpp:513
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:459
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:570
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:890
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:477
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:1258
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:303
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:92
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:297
std::pair< std::string, unsigned > item
Definition: help_impl.hpp:371
config to_config() const
Definition: team.cpp:1014
const display_context & dc() const