The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
label.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2016 by David White <[email protected]>
3  Part of the Battle for Wesnoth Project http://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 #include "global.hpp"
16 
17 #include "display.hpp"
18 #include "floating_label.hpp"
19 #include "game_board.hpp"
20 #include "game_data.hpp"
21 #include "map/label.hpp"
22 #include "resources.hpp"
23 #include "tooltips.hpp"
24 #include "formula/string_utils.hpp"
25 
26 //Our definition of map labels being obscured is if the tile is obscured,
27 //or the tile below is obscured. This is because in the case where the tile
28 //itself is visible, but the tile below is obscured, the bottom half of the
29 //tile will still be shrouded, and the label being drawn looks weird.
30 inline bool is_shrouded(const display& disp, const map_location& loc)
31 {
32  return disp.shrouded(loc) || disp.shrouded(map_location(loc.x,loc.y+1));
33 }
34 
35 /// Rather simple test for a hex being fogged.
36 /// This only exists because is_shrouded() does. (The code looks nicer if
37 /// the test for being fogged looks similar to the test for being shrouded.)
38 inline bool is_fogged(const display& disp, const map_location& loc)
39 {
40  return disp.fogged(loc);
41 }
42 
43 map_labels::map_labels(const display &disp, const team *team) :
44  disp_(disp), team_(team), labels_(), enabled_(true), categories_dirty(true)
45 {
46 }
47 
49  disp_(other.disp_), team_(other.team_), labels_(), enabled_(true)
50 {
51  config cfg;
52  other.write(cfg);
53  read(cfg);
54 }
55 
57 {
58  clear_all();
59 }
60 
62 {
63  if(this != &other) {
64  this->~map_labels();
65  new (this) map_labels(other);
66  }
67  return *this;
68 }
69 
71 {
72  for (team_label_map::const_iterator labs = labels_.begin(); labs != labels_.end(); ++labs)
73  {
74  for(label_map::const_iterator i = labs->second.begin(); i != labs->second.end(); ++i) {
75  config item;
76  i->second->write(item);
77 
78 
79  res.add_child("label",item);
80  }
81  }
82 }
83 
84 void map_labels::read(const config &cfg)
85 {
86  clear_all();
87 
88  for (const config &i : cfg.child_range("label"))
89  {
91  terrain_label *label = new terrain_label(*this, i);
92  add_label(loc, label);
93  }
95 }
96 
97 const terrain_label* map_labels::get_label(const map_location& loc, const std::string& team_name) const
98 {
99  team_label_map::const_iterator label_map = labels_.find(team_name);
100  if (label_map != labels_.end()) {
101  map_labels::label_map::const_iterator itor = label_map->second.find(loc);;
102  if (itor != label_map->second.end())
103  return itor->second;
104  }
105  return nullptr;
106 }
107 
109 {
110  const terrain_label* res = get_label(loc, team_name());
111  // no such team label, we try global label, except if it's what we just did
112  // NOTE: This also avoid infinite recursion
113  if (res == nullptr && team_name() != "") {
114  return get_label(loc, "");
115  }
116  return res;
117 }
118 
119 
120 const display& map_labels::disp() const
121 {
122  return disp_;
123 }
124 
126 {
127  if (team_)
128  {
129  return team_->team_name();
130  }
131  static const std::string empty;
132  return empty;
133 }
134 
136 {
137  if ( team_ != team )
138  {
139  team_ = team;
140  categories_dirty = true;
141  }
142 }
143 
144 
146  const t_string& text,
147  const int creator,
148  const std::string& team_name,
149  const SDL_Color color,
150  const bool visible_in_fog,
151  const bool visible_in_shroud,
152  const bool immutable,
153  const std::string& category,
154  const t_string& tooltip )
155 {
156  terrain_label* res = nullptr;
157 
158  // See if there is already a label in this location for this team.
159  // (We do not use get_label_private() here because we might need
160  // the label_map as well as the terrain_label.)
161  team_label_map::iterator current_label_map = labels_.find(team_name);
162  label_map::iterator current_label;
163 
164  if ( current_label_map != labels_.end()
165  && (current_label = current_label_map->second.find(loc)) != current_label_map->second.end() )
166  {
167  // Found old checking if need to erase it
168  if(text.str().empty())
169  {
170  // Erase the old label.
171  delete current_label->second;
172  current_label_map->second.erase(current_label);
173 
174  // Restore the global label in the same spot, if any.
175  if ( terrain_label* global_label = get_label_private(loc, "") )
176  global_label->recalculate();
177  }
178  else
179  {
180  current_label->second->update_info(text, creator, tooltip, team_name, color, visible_in_fog, visible_in_shroud, immutable, category);
181  res = current_label->second;
182  }
183  }
184  else if(!text.str().empty())
185  {
186  // See if we will be replacing a global label.
187  terrain_label* global_label = get_label_private(loc, "");
188 
189  // Add the new label.
190  res = new terrain_label(text,
191  creator,
192  team_name,
193  loc,
194  *this,
195  color,
196  visible_in_fog,
197  visible_in_shroud,
198  immutable,
199  category,
200  tooltip);
201  add_label(loc, res);
202 
203  // Hide the old label.
204  if ( global_label != nullptr )
205  global_label->recalculate();
206  }
207  categories_dirty = true;
208  return res;
209 }
210 
212 {
213  labels_[new_label->team_name()][loc] = new_label;
214  categories_dirty = true;
215 }
216 
217 void map_labels::clear(const std::string& team_name, bool force)
218 {
219  team_label_map::iterator i = labels_.find(team_name);
220  if (i != labels_.end())
221  {
222  clear_map(i->second, force);
223  }
224 
225  i = labels_.find("");
226  if (i != labels_.end())
227  {
228  clear_map(i->second, force);
229  }
230  categories_dirty = true;
231 }
232 
234 {
235  label_map::iterator i = m.begin();
236  while (i != m.end())
237  {
238  if (!i->second->immutable() || force) {
239  delete i->second;
240  m.erase(i++);
241  } else ++i;
242  }
243  categories_dirty = true;
244 }
245 
247 {
248  for (team_label_map::value_type &m : labels_)
249  {
250  clear_map(m.second, true);
251  }
252  labels_.clear();
253 }
254 
256 {
257  for (team_label_map::value_type &m : labels_)
258  {
259  for (label_map::value_type &l : m.second)
260  {
261  l.second->recalculate();
262  }
263  }
264 }
265 
266 void map_labels::enable(bool is_enabled) {
267  if (is_enabled != enabled_) {
268  enabled_ = is_enabled;
270  }
271 }
272 
273 /**
274  * Returns whether or not a global (non-team) label can be shown at a
275  * specified location.
276  * (Global labels are suppressed in favor of team labels.)
277  */
279 {
280  const team_label_map::const_iterator glabels = labels_.find(team_name());
281  return glabels == labels_.end()
282  || glabels->second.find(loc) == glabels->second.end();
283 }
284 
286 {
287  for (team_label_map::value_type &m : labels_)
288  {
289  for (label_map::value_type &l : m.second)
290  {
291  l.second->calculate_shroud();
292  }
293  }
294 }
295 
296 const std::vector<std::string>& map_labels::all_categories() const {
297  if(categories_dirty) {
298  categories_dirty = false;
299  categories.clear();
300  categories.push_back("team");
301  for(size_t i = 1; i <= resources::teams->size(); i++) {
302  categories.push_back("side:" + std::to_string(i));
303  }
304  std::set<std::string> unique_cats;
305  for (const team_label_map::value_type& m : labels_) {
306  for (const label_map::value_type& l : m.second) {
307  if(l.second->category().empty()) continue;
308  unique_cats.insert("cat:" + l.second->category());
309  }
310  }
311  std::copy(unique_cats.begin(), unique_cats.end(), std::back_inserter(categories));
312  }
313  return categories;
314 }
315 
316 
317 /// creating new label
319  const int creator,
320  const std::string& team_name,
321  const map_location& loc,
322  const map_labels& parent,
323  const SDL_Color color,
324  const bool visible_in_fog,
325  const bool visible_in_shroud,
326  const bool immutable,
327  const std::string& category,
328  const t_string& tooltip ) :
329  handle_(0),
330  text_(text),
331  tooltip_(tooltip),
332  category_(category),
333  team_name_(team_name),
334  visible_in_fog_(visible_in_fog),
335  visible_in_shroud_(visible_in_shroud),
336  immutable_(immutable),
337  creator_(creator),
338  color_(color),
339  parent_(&parent),
340  loc_(loc)
341 {
342  draw();
343 }
344 
345 /// Load label from config
346 terrain_label::terrain_label(const map_labels &parent, const config &cfg) :
347  handle_(0),
348  text_(),
349  tooltip_(),
350  team_name_(),
351  visible_in_fog_(true),
352  visible_in_shroud_(false),
353  immutable_(true),
354  creator_(-1),
355  color_(),
356  parent_(&parent),
357  loc_()
358 {
359  read(cfg);
360 }
361 
362 
364 {
365  clear();
366 }
367 
368 void terrain_label::read(const config &cfg)
369 {
370  const variable_set &vs = *resources::gamedata;
371  loc_ = map_location(cfg, &vs);
372  SDL_Color color = font::LABEL_COLOR;
373 
374  std::string tmp_color = cfg["color"];
375 
376  text_ = cfg["text"];
377  tooltip_ = cfg["tooltip"];
378  team_name_ = cfg["team_name"].str();
379  visible_in_fog_ = cfg["visible_in_fog"].to_bool(true);
380  visible_in_shroud_ = cfg["visible_in_shroud"].to_bool();
381  immutable_ = cfg["immutable"].to_bool(true);
382  category_ = cfg["category"].str();
383 
384  int side = cfg["side"].to_int(-1);
385  if(side >= 0) {
386  creator_ = side - 1;
387  } else if(cfg["side"].str() == "current") {
388  config::attribute_value current_side = vs.get_variable_const("side_number");
389  if(!current_side.empty()) {
390  creator_ = current_side.to_int();
391  }
392  }
393 
394  text_ = utils::interpolate_variables_into_tstring(text_, vs); // Not moved to rendering, as that would depend on variables at render-time
396  tmp_color = utils::interpolate_variables_into_string(tmp_color, vs);
397 
398  if(!tmp_color.empty()) {
399  color = string_to_color(tmp_color);
400  }
401 
402  color_ = color;
403 }
404 
405 void terrain_label::write(config& cfg) const
406 {
407  loc_.write(cfg);
408  cfg["text"] = text();
409  cfg["tooltip"] = tooltip();
410  cfg["team_name"] = (this->team_name());
411  cfg["color"] = cfg_color();
412  cfg["visible_in_fog"] = visible_in_fog_;
413  cfg["visible_in_shroud"] = visible_in_shroud_;
414  cfg["immutable"] = immutable_;
415  cfg["category"] = category_;
416  cfg["side"] = creator_ + 1;
417 }
418 
420 {
421  return text_;
422 }
423 
425 {
426  return tooltip_;
427 }
428 
430 {
431  return creator_;
432 }
433 
435 {
436  return category_;
437 }
438 
440 {
441  return team_name_;
442 }
443 
445 {
446  return visible_in_fog_;
447 }
448 
450 {
451  return visible_in_shroud_;
452 }
453 
455 {
456  return immutable_;
457 }
458 
460 {
461  return loc_;
462 }
463 
464 const SDL_Color& terrain_label::color() const
465 {
466  return color_;
467 }
468 
470 {
471  std::stringstream buf;
472  const unsigned int red = static_cast<unsigned int>(color_.r);
473  const unsigned int green = static_cast<unsigned int>(color_.g);
474  const unsigned int blue = static_cast<unsigned int>(color_.b);
475  const unsigned int alpha = static_cast<unsigned int>(color_.a);
476  buf << red << "," << green << "," << blue << "," << alpha;
477  return buf.str();
478 }
479 
481 {
482  text_ = text;
483 }
484 
486  const int creator,
487  const t_string& tooltip,
488  const std::string& team_name,
489  const SDL_Color color)
490 {
491  color_ = color;
492  text_ = text;
493  tooltip_ = tooltip;
495  creator_ = creator;
496  draw();
497 }
498 
500  const int creator,
501  const t_string& tooltip,
502  const std::string& team_name,
503  const SDL_Color color,
504  const bool visible_in_fog,
505  const bool visible_in_shroud,
506  const bool immutable,
507  const std::string& category)
508 {
513  update_info(text, creator, tooltip, team_name, color);
514 }
515 
517 {
518  draw();
519 }
520 
522 {
523  if (handle_) {
525  }
526 
527  if (tooltip_.empty() || hidden()) {
529  tooltip_handle_ = 0;
530  return;
531  }
532 
533  //tooltips::update_tooltip(tooltip_handle, get_rect(), tooltip_.str(), "", true);
534 
535  if (tooltip_handle_)
537  else
539 }
540 
541 SDL_Rect terrain_label::get_rect() const
542 {
543  SDL_Rect rect;
544  int hex_size = parent_->disp().hex_size();
545 
546  rect.x = parent_->disp().get_location_x(loc_) + hex_size / 4;
547  rect.y = parent_->disp().get_location_y(loc_);
548  rect.h = parent_->disp().hex_size();
549  rect.w = parent_->disp().hex_size() - hex_size/2;
550 
551  return rect;
552 }
553 
555 {
556  if (text_.empty() && tooltip_.empty())
557  return;
558  clear();
559 
560  if ( !viewable(parent_->disp().get_disp_context()) )
561  return;
562 
563  const map_location loc_nextx(loc_.x+1,loc_.y);
564  const map_location loc_nexty(loc_.x,loc_.y+1);
565  const int xloc = (parent_->disp().get_location_x(loc_) +
566  parent_->disp().get_location_x(loc_nextx)*2)/3;
567  const int yloc = parent_->disp().get_location_y(loc_nexty) - font::SIZE_NORMAL;
568 
569  // If a color is specified don't allow to override it with markup. (prevents faking map labels for example)
570  // FIXME: @todo Better detect if it's team label and not provided by
571  // the scenario.
572  bool use_markup = color_ == font::LABEL_COLOR;
573 
574  font::floating_label flabel(text_.str());
575  flabel.set_color(color_);
576  flabel.set_position(xloc, yloc);
577  flabel.set_clip_rect(parent_->disp().map_outside_area());
578  flabel.set_width(font::SIZE_NORMAL * 13);
579  flabel.set_height(font::SIZE_NORMAL * 4);
580  flabel.set_scroll_mode(font::ANCHOR_LABEL_MAP);
581  flabel.use_markup(use_markup);
582 
584 
586 }
587 
588 /**
589  * This is a lightweight test used to see if labels are revealed as a result
590  * of unit actions (i.e. fog/shroud clearing). It should not contain any tests
591  * that are invariant during unit movement (disregarding potential WML events);
592  * those belong in visible().
593  */
595 {
596  // Respect user's label preferences
597  std::string category = "cat:" + category_;
598  std::string creator = "side:" + std::to_string(creator_ + 1);
599  const std::vector<std::string>& hidden_categories = parent_->disp().get_disp_context().hidden_label_categories();
600 
601  if(std::find(hidden_categories.begin(), hidden_categories.end(), category) != hidden_categories.end())
602  return true;
603  if(creator_ >= 0 && std::find(hidden_categories.begin(), hidden_categories.end(), creator) != hidden_categories.end())
604  return true;
605  if(!team_name().empty() && std::find(hidden_categories.begin(), hidden_categories.end(), "team") != hidden_categories.end())
606  return true;
607 
608  // Fog can hide some labels.
609  if ( !visible_in_fog_ && is_fogged(parent_->disp(), loc_) )
610  return true;
611 
612  // Shroud can hide some labels.
614  return true;
615 
616  return false;
617 }
618 
619 /**
620  * This is a test used to see if we should bother with the overhead of actually
621  * creating a label. Conditions that can change during unit movement (disregarding
622  * potential WML events) should not be listed here; they belong in hidden().
623  */
625 {
626  if ( !parent_->enabled() )
627  return false;
628 
629  // In the editor, all labels are viewable.
630  if ( dc.teams().empty() )
631  return true;
632 
633  // Observers are not privvy to team labels.
634  const bool can_see_team_labels = !dc.is_observer();
635 
636  // Global labels are shown unless covered by a team label.
637  if ( team_name_.empty() )
638  return !can_see_team_labels || parent_->visible_global_label(loc_);
639 
640  // Team labels are only shown to members of the team.
641  return can_see_team_labels && parent_->team_name() == team_name_;
642 }
643 
645 {
646  if (handle_)
647  {
649  handle_ = 0;
650  }
651  if (tooltip_handle_)
652  {
654  tooltip_handle_ = 0;
655  }
656 }
const map_labels * parent_
Definition: label.hpp:180
child_itors child_range(const std::string &key)
Definition: config.cpp:613
void recalculate_shroud()
Definition: label.cpp:285
bool fogged(const map_location &loc) const
Returns true if location (x,y) is covered in fog.
Definition: display.hpp:353
std::map< map_location, terrain_label * > label_map
Definition: label.hpp:32
std::string cfg_color() const
Definition: label.cpp:469
int creator_
Definition: label.hpp:176
std::string interpolate_variables_into_string(const std::string &str, const string_map *const symbols)
Function which will interpolate variables, starting with '$' in the string 'str' with the equivalent ...
map_labels & operator=(const map_labels &)
Definition: label.cpp:61
GLsizei GLenum * categories
Definition: glew.h:2499
const std::vector< std::string > & all_categories() const
Definition: label.cpp:296
void write(config &res) const
Definition: label.cpp:70
bool enabled() const
Definition: label.hpp:58
void show_floating_label(int handle, bool value)
hides or shows a floating label
t_string tooltip_
Definition: label.hpp:170
bool visible_in_fog_
Definition: label.hpp:173
const map_location & location() const
Definition: label.cpp:459
void remove_tooltip(int id)
Definition: tooltips.cpp:174
void remove_floating_label(int handle)
removes the floating label given by 'handle' from the screen
SDL_Color color_
Definition: font.cpp:605
bool hidden() const
This is a lightweight test used to see if labels are revealed as a result of unit actions (i...
Definition: label.cpp:594
int get_location_x(const map_location &loc) const
Functions to get the on-screen positions of hexes.
Definition: display.cpp:713
team_label_map labels_
Definition: label.hpp:94
bool empty() const
Tests for an attribute that either was never set or was set to "".
Definition: config.cpp:375
tformula< t_string > text_
The text to draw.
Definition: canvas.cpp:1268
Variant for storing WML attributes.
Definition: config.hpp:223
void update_info(const t_string &, const int creator, const t_string &, const std::string &, const SDL_Color)
Definition: label.cpp:485
int creator() const
Definition: label.cpp:429
game_data * gamedata
Definition: resources.cpp:22
int get_location_y(const map_location &loc) const
Definition: display.cpp:718
GLdouble l
Definition: glew.h:6966
const int SIZE_NORMAL
Definition: font.hpp:58
const terrain_label * set_label(const map_location &loc, const t_string &text, const int creator=-1, const std::string &team="", const SDL_Color color=font::NORMAL_COLOR, const bool visible_in_fog=true, const bool visible_in_shroud=false, const bool immutable=false, const std::string &category="", const t_string &tooltip="")
Definition: label.cpp:145
bool immutable() const
Definition: label.cpp:454
map_location loc_
const std::string & team_name() const
Definition: label.cpp:439
bool is_fogged(const display &disp, const map_location &loc)
Rather simple test for a hex being fogged.
Definition: label.cpp:38
bool visible_in_shroud_
Definition: label.hpp:174
const SDL_Color & color() const
Definition: label.cpp:464
This class stores all the data for a single 'side' (in game nomenclature).
Definition: team.hpp:50
const t_string & text() const
Definition: label.cpp:419
std::vector< std::string > categories
Definition: label.hpp:97
GLclampf GLclampf blue
Definition: glew.h:1488
const std::string & category() const
Definition: label.cpp:434
std::vector< team > * teams
Definition: resources.cpp:29
GLclampf green
Definition: glew.h:1488
bool viewable(const display_context &dc) const
This is a test used to see if we should bother with the overhead of actually creating a label...
Definition: label.cpp:624
void clear(const std::string &, bool force)
Definition: label.cpp:217
map_labels(const map_labels &)
Definition: label.cpp:48
const team * team_
Definition: label.hpp:92
void clear()
Definition: label.cpp:644
bool is_shrouded(const display &disp, const map_location &loc)
Definition: label.cpp:30
terrain_label(const t_string &text, const int creator, const std::string &team_name, const map_location &loc, const map_labels &parent, const SDL_Color color=font::NORMAL_COLOR, const bool visible_in_fog=true, const bool visible_in_shroud=false, const bool immutable=false, const std::string &category="", const t_string &tooltip="")
creating new label
Definition: label.cpp:318
void set_color(const SDL_Color &color)
const std::string & team_name() const
Definition: team.hpp:297
config & add_child(const std::string &key)
Definition: config.cpp:743
GLclampf GLclampf GLclampf alpha
Definition: glew.h:1488
std::string category_
Definition: label.hpp:171
GLenum GLuint GLsizei const char * buf
Definition: glew.h:2498
void enable(bool is_enabled)
Definition: label.cpp:266
terrain_label * get_label_private(const map_location &loc, const std::string &team_name)
For our private use, a wrapper for get_label() that can return a pointer to a non-const terrain_label...
Definition: label.hpp:86
const std::string & team_name() const
Definition: label.cpp:125
map_display and display: classes which take care of displaying the map and game-data on the screen...
bool immutable_
Definition: label.hpp:175
bool enabled_
Definition: label.hpp:95
int tooltip_handle_
Definition: label.hpp:167
const display & disp() const
Definition: label.cpp:120
SDL_Color color_
Definition: label.hpp:178
GLuint color
Definition: glew.h:5801
const terrain_label * get_label(const map_location &loc, const std::string &team_name) const
Definition: label.cpp:97
void write(config &cfg) const
Definition: location.cpp:205
Encapsulates the map of the game.
Definition: location.hpp:38
void set_team(const team *)
Definition: label.cpp:135
~map_labels()
Definition: label.cpp:56
void add_label(const map_location &, terrain_label *)
Definition: label.cpp:211
void recalculate_labels()
Definition: label.cpp:255
GLuint res
Definition: glew.h:9258
virtual const std::vector< team > & teams() const =0
std::map< std::string, tfilter >::iterator itor
Definition: filter.cpp:199
void read(const config &cfg)
Definition: label.cpp:368
bool visible_in_shroud() const
Definition: label.cpp:449
bool shrouded(const map_location &loc) const
Returns true if location (x,y) is covered in shroud.
Definition: display.hpp:349
const SDL_Color LABEL_COLOR
Definition: font.cpp:574
void clear_map(label_map &, bool)
Definition: label.cpp:233
size_t i
Definition: function.cpp:1057
int add_floating_label(const floating_label &flabel)
add a label floating on the screen above everything else.
bool visible_in_fog() const
Definition: label.cpp:444
void write(config &res) const
Definition: label.cpp:405
const display & disp_
Definition: label.hpp:91
void draw()
Definition: label.cpp:554
void read(const config &cfg)
Definition: label.cpp:84
std::string team_name_
Definition: label.hpp:172
To store label data Class implements logic for rendering.
Definition: label.hpp:103
void recalculate()
Definition: label.cpp:516
virtual config::attribute_value get_variable_const(const std::string &id) const =0
const GLdouble * m
Definition: glew.h:6968
t_string text_
Definition: label.hpp:169
bool find(E event, F functor)
Tests whether an event handler is available.
display & disp_
Definition: dialogs.cpp:98
~terrain_label()
Definition: label.cpp:363
const SDL_Rect & map_outside_area() const
Returns the available area for a map, this may differ from the above.
Definition: display.hpp:248
const t_string & tooltip() const
Definition: label.cpp:424
bool is_observer() const
Check if we are an observer in this game.
int to_int(int def=0) const
Definition: config.cpp:308
const display_context & get_disp_context() const
Definition: display.hpp:167
void calculate_shroud()
Definition: label.cpp:521
SDL_Color string_to_color(const std::string &cmp_str)
Return the color the string represents.
Definition: help_impl.cpp:1206
void clear_all()
Definition: label.cpp:246
const std::string & str() const
Definition: tstring.hpp:170
void set_text(const t_string &)
Definition: label.cpp:480
virtual const std::vector< std::string > & hidden_label_categories() const =0
std::string::const_iterator iterator
Definition: tokenizer.hpp:21
bool visible_global_label(const map_location &) const
Returns whether or not a global (non-team) label can be shown at a specified location.
Definition: label.cpp:278
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
int hex_size() const
Function which returns the size of a hex in pixels (from top tip to bottom tip or left edge to right ...
Definition: display.hpp:266
bool update_tooltip(int id, const SDL_Rect &rect, const std::string &message, const std::string &action, bool use_markup)
Definition: tooltips.cpp:149
t_string interpolate_variables_into_tstring(const t_string &tstr, const variable_set &variables)
Function that does the same as the above, for t_stringS.
int add_tooltip(const SDL_Rect &rect, const std::string &message, const std::string &action, bool use_markup, const surface &foreground)
Definition: tooltips.cpp:180
SDL_Rect get_rect() const
Definition: label.cpp:541
GLsizei const GLcharARB ** string
Definition: glew.h:4503
bool empty() const
Definition: tstring.hpp:166
map_location loc_
Definition: label.hpp:181
bool categories_dirty
Definition: label.hpp:98