The Battle for Wesnoth  1.15.0-dev
drawer.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2018 by Chris Beck <render787@gmail.com>
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 #include "units/drawer.hpp"
16 
17 #include "color.hpp"
18 #include "display.hpp"
19 #include "display_context.hpp"
20 #include "formatter.hpp"
21 #include "halo.hpp"
22 #include "map/location.hpp"
23 #include "map/map.hpp"
24 #include "preferences/game.hpp"
25 #include "sdl/rect.hpp"
26 #include "sdl/texture.hpp"
27 #include "team.hpp"
28 #include "units/animation.hpp"
30 #include "units/frame.hpp"
31 #include "units/unit.hpp"
32 
34  : disp(thedisp)
35  , dc(disp.current_display_context())
36  , map(dc.map())
37  , teams(dc.teams())
38  , halo_man(disp.get_halo_manager())
39  , viewing_team(disp.viewing_team())
40  , playing_team(disp.playing_team())
41  , viewing_team_ref(teams[viewing_team])
42  , playing_team_ref(teams[playing_team])
43  , is_blindfolded(disp.is_blindfolded())
44  , show_everything(disp.show_everything())
45  , sel_hex(disp.selected_hex())
46  , mouse_hex(disp.mouseover_hex())
47  , zoom_factor(disp.get_zoom_factor())
48  , hex_size(disp.hex_size())
49  , hex_size_by_2(disp.hex_size() / 2)
50 {
51 }
52 
53 // NOTE: surfaces were scaled to zoom
54 void unit_drawer::redraw_unit(const unit & u) const
55 {
57  map_location loc = u.get_location();
58 
59  int side = u.side();
60 
61  bool hidden = u.get_hidden();
62  bool is_flying = u.is_flying();
63 
64  map_location::DIRECTION facing = u.facing();
65 
66  int hitpoints = u.hitpoints();
67  int max_hitpoints = u.max_hitpoints();
68  int movement_left = u.movement_left();
69  int total_movement = u.total_movement();
70 
71  bool can_recruit = u.can_recruit();
72  bool can_advance = u.can_advance();
73 
74  int experience = u.experience();
75  int max_experience = u.max_experience();
76 
77  bool emit_zoc = u.emits_zoc();
78 
79  color_t hp_color = u.hp_color();
80  color_t xp_color = u.xp_color();
81 
82  std::string ellipse=u.image_ellipse();
83 
85  ac.clear_haloes();
86  if(ac.anim_) {
87  ac.anim_->update_last_draw_time();
88  }
89 
90  return;
91  }
92 
93  if(!ac.anim_) {
94  ac.set_standing();
95  if(!ac.anim_) {
96  return;
97  }
98  }
99 
100  if(ac.refreshing_) {
101  return;
102  }
103 
104  ac.refreshing_ = true;
105 
106  ac.anim_->update_last_draw_time();
107 
108  const t_translation::terrain_code terrain = map.get_terrain(loc);
109  const terrain_type& terrain_info = map.get_terrain_info(terrain);
110 
111  frame_parameters params;
112 
113  // Do not set to 0 so we can distinguish the flying from the "not on submerge terrain"
114  // instead use -1.0 (as in "negative depth", it will be ignored by rendering)
115  params.submerge= is_flying ? -1.0 : terrain_info.unit_submerge();
116 
117  if(u.invisible(loc) && params.highlight_ratio > 0.6) {
118  params.highlight_ratio = 0.6;
119  }
120 
121  if(loc == sel_hex && params.highlight_ratio == 1.0) {
122  params.highlight_ratio = 1.5;
123  }
124 
125  int height_adjust = static_cast<int>(terrain_info.unit_height_adjust() * zoom_factor);
126  if(is_flying && height_adjust < 0) {
127  height_adjust = 0;
128  }
129 
130  params.y -= height_adjust;
131  params.halo_y -= height_adjust;
132 
133  int red = 0,green = 0,blue = 0,tints = 0;
134  double blend_ratio = 0;
135 
136  // Add future colored states here
137  if(u.poisoned()) {
138  green += 255;
139  blend_ratio += 0.25;
140  tints += 1;
141  }
142 
143  if(u.slowed()) {
144  red += 191;
145  green += 191;
146  blue += 255;
147  blend_ratio += 0.25;
148  tints += 1;
149  }
150 
151  if(tints > 0) {
152  params.blend_with = color_t((red / tints), (green / tints), (blue / tints));
153  params.blend_ratio = blend_ratio / tints;
154  }
155 
156  // Hackish: see unit_frame::merge_parameters.
157  // We use image_mod on the primary image and halo_mod on secondary images and all haloes
158  params.image_mod = u.image_mods();
159  params.halo_mod = u.TC_image_mods();
160  params.image = u.default_anim_image();
161 
162  if(u.incapacitated()) {
163  params.image_mod +="~GS()";
164  }
165 
166  params.primary_frame = true;
167 
168  const frame_parameters adjusted_params = ac.anim_->get_current_params(params);
169 
170  const map_location dst = loc.get_direction(facing);
171  const int xsrc = disp.get_location_x(loc);
172  const int ysrc = disp.get_location_y(loc);
173  const int xdst = disp.get_location_x(dst);
174  const int ydst = disp.get_location_y(dst);
175 
176  const int x = static_cast<int>(adjusted_params.offset * xdst + (1.0 - adjusted_params.offset) * xsrc) + hex_size_by_2;
177  const int y = static_cast<int>(adjusted_params.offset * ydst + (1.0 - adjusted_params.offset) * ysrc) + hex_size_by_2;
178 
179  bool has_halo = ac.unit_halo_ && ac.unit_halo_->valid();
180  if(!has_halo && !u.image_halo().empty()) {
181  ac.unit_halo_ = halo_man.add(x, y - height_adjust, u.image_halo()+u.TC_image_mods(), map_location(-1, -1));
182  }
183 
184  if(has_halo && u.image_halo().empty()) {
186  ac.unit_halo_.reset();
187  } else if(has_halo) {
188  halo_man.set_location(ac.unit_halo_, x, y - height_adjust);
189  }
190 
191  // We draw bars only if wanted, visible on the map view
192  bool draw_bars = ac.draw_bars_ ;
193  if(draw_bars) {
194  SDL_Rect unit_rect {xsrc, ysrc + adjusted_params.y, hex_size, hex_size};
195  draw_bars = sdl::rects_overlap(unit_rect, disp.map_outside_area());
196  }
197 
198  texture ellipse_front(nullptr);
199  texture ellipse_back(nullptr);
200 
201  int ellipse_floating = 0;
202 
203  // Always show the ellipse for selected units.
204  if(draw_bars && (preferences::show_side_colors() || sel_hex == loc)) {
205  if(adjusted_params.submerge > 0.0) {
206  // The division by 2 seems to have no real meaning. It just works fine with the current center
207  // of the ellipse and prevents an overadjustment if submerge == 1.0.
208  ellipse_floating = static_cast<int>(adjusted_params.submerge * hex_size_by_2);
209  }
210 
211  if(ellipse.empty()) {
212  ellipse = "misc/ellipse";
213  }
214 
215  if(ellipse != "none") {
216  // check if the unit has a ZoC or can recruit
217  const std::string nozoc = !emit_zoc ? "nozoc-" : "";
218  const std::string leader = can_recruit ? "leader-" : "";
219  const std::string selected = sel_hex == loc ? "selected-" : "";
220  const std::string tc = team::get_side_color_id(side);
221 
222  const std::string ellipse_top = formatter() <<
223  ellipse << "-" << leader << nozoc << selected << "top.png~RC(ellipse_red>" << tc << ")";
224 
225  const std::string ellipse_bot = formatter() <<
226  ellipse << "-" << leader << nozoc << selected << "bottom.png~RC(ellipse_red>" << tc << ")";
227 
228  // Load the ellipse parts recolored to match team color
229  ellipse_back = image::get_texture(ellipse_top /*, image::SCALED_TO_ZOOM)*/);
230  ellipse_front = image::get_texture(ellipse_bot /*, image::SCALED_TO_ZOOM)*/);
231  }
232  }
233 
234  if(ellipse_back != nullptr) {
235  //disp.drawing_queue_add(drawing_queue::LAYER_UNIT_BG, loc,
236  //disp.drawing_queue_add(drawing_queue::LAYER_UNIT_FIRST, loc,
237  // xsrc, ysrc +adjusted_params.y-ellipse_floating, ellipse_back);
238 
239  disp.render_scaled_to_zoom(ellipse_back, xsrc, ysrc + adjusted_params.y - ellipse_floating);
240  }
241 
242  if(ellipse_front != nullptr) {
243  //disp.drawing_queue_add(drawing_queue::LAYER_UNIT_FG, loc,
244  //disp.drawing_queue_add(drawing_queue::LAYER_UNIT_FIRST, loc,
245  // xsrc, ysrc +adjusted_params.y-ellipse_floating, ellipse_front);
246 
247  disp.render_scaled_to_zoom(ellipse_front, xsrc, ysrc + adjusted_params.y - ellipse_floating);
248  }
249 
250  // Smooth unit movements from terrain of different elevation.
251  // TODO: see if having this here actually makes the healthbars bob up and and down.
252 
253  const t_translation::terrain_code terrain_dst = map.get_terrain(dst);
254  const terrain_type& terrain_dst_info = map.get_terrain_info(terrain_dst);
255 
256  int height_adjust_unit = static_cast<int>((
257  terrain_info.unit_height_adjust() * (1.0 - adjusted_params.offset) +
258  terrain_dst_info.unit_height_adjust() * adjusted_params.offset
259  ) * zoom_factor);
260 
261  if(is_flying && height_adjust_unit < 0) {
262  height_adjust_unit = 0;
263  }
264 
265  params.y -= height_adjust_unit - height_adjust;
266  params.halo_y -= height_adjust_unit - height_adjust;
267 
268  ac.anim_->redraw(params, halo_man);
269 
270  if(draw_bars) {
271  const texture unit_img = image::get_texture(u.default_anim_image());
272 
273  const texture::info unit_img_info = unit_img.get_info();
274 
275  const auto& type_cfg = u.type().get_cfg();
276  const auto& cfg_offset_x = type_cfg["bar_offset_x"];
277  const auto& cfg_offset_y = type_cfg["bar_offset_y"];
278 
279  int xoff;
280  int yoff;
281 
282  if(cfg_offset_x.empty() && cfg_offset_y.empty()) {
283  xoff = unit_img.null() ? 0 : (hex_size - (unit_img_info.w * zoom_factor))/2;
284  yoff = unit_img.null() ? 0 : (hex_size - (unit_img_info.h * zoom_factor))/2;
285  } else {
286  xoff = cfg_offset_x.to_int();
287  yoff = cfg_offset_y.to_int();
288  }
289 
290  const image::locator partmoved_orb(
291  game_config::images::orb + "~RC(magenta>" + preferences::partial_color() + ")");
292  const image::locator moved_orb(
293  game_config::images::orb + "~RC(magenta>" + preferences::moved_color() + ")");
294  const image::locator ally_orb(
295  game_config::images::orb + "~RC(magenta>" + preferences::allied_color() + ")");
296  const image::locator enemy_orb(
297  game_config::images::orb + "~RC(magenta>" + preferences::enemy_color() + ")");
298  const image::locator unmoved_orb(
299  game_config::images::orb + "~RC(magenta>" + preferences::unmoved_color() + ")");
300 
301  const image::locator* orb_img = nullptr;
302 
303 
304  if(static_cast<std::size_t>(side) != viewing_team + 1) {
305  if(disp.team_valid() && viewing_team_ref.is_enemy(side)) {
307  orb_img = &enemy_orb;
308  }
309  } else {
311  orb_img = &ally_orb;
312  }
313  }
314  } else {
316  orb_img = &moved_orb;
317  }
318 
319  if(playing_team == viewing_team && !u.user_end_turn()) {
320  if(movement_left == total_movement) {
322  orb_img = &unmoved_orb;
323  }
324  } else if(dc.unit_can_move(u)) {
326  orb_img = &partmoved_orb;
327  }
328  }
329  }
330  }
331 
332  if(orb_img != nullptr) {
333  texture orb(image::get_texture(*orb_img));
334  //disp.drawing_queue_add(drawing_queue::LAYER_UNIT_BAR,
335  // loc, xsrc + xoff, ysrc + yoff + adjusted_params.y, orb);
336  disp.render_scaled_to_zoom(orb, xsrc + xoff, ysrc + yoff + adjusted_params.y);
337  }
338 
339  double unit_energy = 0.0;
340  if(max_hitpoints > 0) {
341  unit_energy = static_cast<double>(hitpoints)/static_cast<double>(max_hitpoints);
342  }
343 
344  const int bar_shift = static_cast<int>(-5*zoom_factor);
345  const int hp_bar_height = static_cast<int>(max_hitpoints * u.hp_bar_scaling());
346 
347  // TODO: stop using fixed-point stuff.
348  const fixed_t bar_alpha = (loc == mouse_hex || loc == sel_hex) ? ftofxp(1.0): ftofxp(0.8);
349 
350  // HP bar
351  draw_bar(
352  xsrc + xoff + bar_shift,
353  ysrc + yoff + adjusted_params.y,
354  hp_bar_height, unit_energy, hp_color, bar_alpha
355  );
356 
357  if(experience > 0 && can_advance) {
358  const double filled = static_cast<double>(experience) / static_cast<double>(max_experience);
359  const int xp_bar_height = static_cast<int>(max_experience * u.xp_bar_scaling() / std::max<int>(u.level(),1));
360 
361  // XP bar
362  draw_bar(
363  xsrc + xoff,
364  ysrc + yoff + adjusted_params.y,
365  xp_bar_height, filled, xp_color, bar_alpha
366  );
367  }
368 
369  if(can_recruit) {
371  if(crown != nullptr) {
372  //if(bar_alpha != ftofxp(1.0)) {
373  // crown = adjust_surface_alpha(crown, bar_alpha);
374  //}
375  //disp.drawing_queue_add(drawing_queue::LAYER_UNIT_BAR,
376  // loc, xsrc+xoff, ysrc+yoff+adjusted_params.y, crown);
377  disp.render_scaled_to_zoom(crown, xsrc + xoff, ysrc + yoff + adjusted_params.y);
378  }
379  }
380 
381  for(const std::string& ov : u.overlays()) {
382  const texture ov_img(image::get_texture(ov));
383  if(ov_img != nullptr) {
384  //disp.drawing_queue_add(drawing_queue::LAYER_UNIT_BAR,
385  // loc, xsrc+xoff, ysrc+yoff+adjusted_params.y, ov_img);
386  disp.render_scaled_to_zoom(ov_img, xsrc + xoff, ysrc + yoff + adjusted_params.y);
387  }
388  }
389  }
390 
391  ac.refreshing_ = false;
392 }
393 
394 void unit_drawer::draw_bar(int xpos, int ypos, std::size_t height, double filled, color_t col, fixed_t alpha) const
395 {
396  // Magic width number
397  static unsigned int bar_width = 4;
398 
399  static const color_t bar_color_bg {0, 0, 0 , 80};
400  static const color_t bar_color_border {213, 213, 213, 200};
401 
402  // Override the filled area's color's alpha.
403  col.a = std::min<unsigned>(alpha, 255);
404 
405  // Bar dimensions.
406  // Note about the magic x, y additions: we used to use an image for the bar instead of drawing
407  // it procedurally. Its x,y position within the file was 19,13, so we offset the origin by that
408  // much to make it line up with the crowns as before. Should probably compensate for this better
409  // in the future.
410  SDL_Rect bar_rect;
411  bar_rect.x = xpos + (19 * zoom_factor);
412  bar_rect.y = ypos + (13 * zoom_factor);
413  bar_rect.w = bar_width * zoom_factor;
414  bar_rect.h = height * zoom_factor;
415 
416  filled = utils::clamp<double>(filled, 0.0, 1.0);
417  const std::size_t unfilled = static_cast<std::size_t>(bar_rect.h * (1.0 - filled));
418 
419  // Filled area dimensions.
420  SDL_Rect fill_rect;
421  fill_rect.x = bar_rect.x;
422  fill_rect.y = bar_rect.y + unfilled;
423  fill_rect.w = bar_rect.w;
424  fill_rect.h = bar_rect.h - unfilled;
425 
426  // Tinted background.
427  sdl::fill_rectangle(bar_rect, bar_color_bg);
428 
429  // Filled area.
430  sdl::fill_rectangle(fill_rect, col);
431 
432  // Bar outline.
433  sdl::draw_rectangle(bar_rect, bar_color_border);
434 }
bool refreshing_
avoid infinite recursion. flag used for drawing / animation
std::string unmoved_color()
Definition: general.cpp:345
All parameters from a frame at a given instant.
Definition: frame.hpp:34
image::locator image
Definition: frame.hpp:40
bool is_blindfolded
Definition: drawer.hpp:58
This class represents a single unit of a specific type.
Definition: unit.hpp:99
bool is_flying() const
Check if the unit is a flying unit.
Definition: unit.hpp:1283
bool rects_overlap(const SDL_Rect &rect1, const SDL_Rect &rect2)
Tests whether two rectangles overlap.
Definition: rect.cpp:33
std::unique_ptr< unit_animation > anim_
The current animation.
double unit_submerge() const
Definition: terrain.hpp:62
int hitpoints() const
The current number of hitpoints this unit has.
Definition: unit.hpp:414
Frame for unit&#39;s animation sequence.
bool show_enemy_orb()
Definition: general.cpp:265
int hex_size
Definition: drawer.hpp:64
bool show_allied_orb()
Definition: general.cpp:258
halo::manager & halo_man
Definition: drawer.hpp:53
const SDL_Rect map_outside_area() const
Returns the available area for a map, this may differ from the above.
Definition: display.cpp:475
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...
Definition: translation.hpp:50
const terrain_type & get_terrain_info(const t_translation::terrain_code &terrain) const
Definition: map.cpp:96
map_location::DIRECTION facing() const
The current directin this unit is facing within its hex.
Definition: unit.hpp:1190
bool draw_bars_
bool indicating whether to draw bars with the unit
const config & get_cfg() const
Definition: types.hpp:269
std::string image_ellipse() const
Get the unit&#39;s ellipse image.
Definition: unit.hpp:1382
-file sdl_utils.hpp
bool unit_can_move(const unit &u) const
Will return true iff the unit u has any possible moves it can do (including attacking etc)...
bool show_side_colors()
Definition: game.cpp:761
bool get_hidden() const
Gets whether this unit is currently hidden on the map.
Definition: unit.hpp:601
double hp_bar_scaling() const
The factor by which the HP bar should be scaled.
Definition: unit.hpp:613
Wrapper class to encapsulate creation and management of an SDL_Texture.
Definition: texture.hpp:26
t_translation::terrain_code get_terrain(const map_location &loc) const
Looks up terrain at a particular location.
Definition: map.cpp:292
map_location get_direction(DIRECTION dir, unsigned int n=1u) const
Definition: location.cpp:402
bool team_valid() const
Definition: display.cpp:604
const unit_type & type() const
This unit&#39;s type, accounting for gender and variation.
Definition: unit.hpp:277
color_t hp_color() const
Color for this unit&#39;s current hitpoints.
Definition: unit.cpp:1074
bool poisoned() const
Check if the unit has been poisoned.
Definition: unit.hpp:775
static const std::string & leader_crown()
The path to the leader crown overlay.
Definition: unit.cpp:1026
void clear_haloes()
Clear the haloes associated to the unit.
int unit_height_adjust() const
Definition: terrain.hpp:61
bool null() const
Definition: texture.hpp:79
std::string halo_mod
Definition: frame.hpp:49
std::ostringstream wrapper.
Definition: formatter.hpp:38
color_t xp_color() const
Color for this unit&#39;s XP.
Definition: unit.cpp:1084
void draw_rectangle(const SDL_Rect &rect, const color_t &color)
Draw a rectangle outline.
Definition: rect.cpp:57
std::string selected
int hex_size_by_2
Definition: drawer.hpp:65
const gamemap & map
Definition: drawer.hpp:51
int max_experience() const
The max number of experience points this unit can have.
Definition: unit.hpp:438
uint8_t a
Alpha value.
Definition: color.hpp:186
bool is_enemy(int n) const
Definition: team.hpp:243
int level() const
The current level of this unit.
Definition: unit.hpp:462
map_display and display: classes which take care of displaying the map and game-data on the screen...
display & disp
Definition: drawer.hpp:49
std::string default_anim_image() const
The default image to use for animation frames with no defined image.
Definition: unit.cpp:2290
const std::vector< std::string > & overlays() const
Get the unit&#39;s overlay images.
Definition: unit.hpp:1416
void draw_bar(int xpos, int ypos, std::size_t height, double filled, color_t col, fixed_t alpha) const
draw a health/xp bar of a unit
Definition: drawer.cpp:394
int32_t fixed_t
Definition: math.hpp:292
bool show_moved_orb()
Definition: general.cpp:272
static std::string get_side_color_id(unsigned side)
Definition: team.cpp:962
handle add(int x, int y, const std::string &image, const map_location &loc, halo::ORIENTATION orientation=NORMAL, bool infinite=true)
Add a haloing effect using &#39;image centered on (x,y).
Definition: halo.cpp:299
#define ftofxp(x)
IN: float or int - OUT: fixed_t.
Definition: math.hpp:297
Encapsulates the map of the game.
Definition: location.hpp:42
bool user_end_turn() const
Check whether the user ended their turn.
Definition: unit.hpp:673
bool invisible(const map_location &loc, bool see_all=true) const
Definition: unit.cpp:2317
boost::optional< color_t > blend_with
Definition: frame.hpp:54
std::string allied_color()
Definition: general.cpp:305
double highlight_ratio
Definition: frame.hpp:57
unit_animation_component & anim_comp() const
Definition: unit.hpp:1361
int max_hitpoints() const
The max number of hitpoints this unit can have.
Definition: unit.hpp:420
std::string moved_color()
Definition: general.cpp:335
void render_scaled_to_zoom(const texture &tex, const int x_pos, const int y_pos, T &&... extra_args) const
Renders a texture directly to the screen (or current rendering target) scaled to the current zoom fac...
Definition: display.hpp:743
std::string image_mod
Definition: frame.hpp:43
bool can_recruit() const
Whether this unit can recruit other units - ie, are they a leader unit.
Definition: unit.hpp:502
int get_location_y(const map_location &loc) const
Definition: display.cpp:624
const team & viewing_team_ref
Definition: drawer.hpp:56
DIRECTION
Valid directions which can be moved in our hexagonal world.
Definition: location.hpp:44
const display_context & dc
Definition: drawer.hpp:50
const info get_info() const
Queries metadata about the texture, such as its dimensions.
Definition: texture.hpp:55
std::size_t viewing_team
Definition: drawer.hpp:54
void set_location(const handle &h, int x, int y)
Set the position of an existing haloing effect, according to its handle.
Definition: halo.cpp:306
bool is_visible_to_team(const team &team, bool const see_all=true) const
Definition: unit.cpp:2360
double blend_ratio
Definition: frame.hpp:56
double xp_bar_scaling() const
The factor by which the XP bar should be scaled.
Definition: unit.hpp:622
double submerge
Definition: frame.hpp:59
std::string image_halo() const
Get the unit&#39;s halo image.
Definition: unit.hpp:1373
double offset
Definition: frame.hpp:58
std::string partial_color()
Definition: general.cpp:355
int get_location_x(const map_location &loc) const
Functions to get the on-screen positions of hexes.
Definition: display.cpp:619
Contains the SDL_Rect helper code.
void redraw_unit(const unit &u) const
draw a unit.
Definition: drawer.cpp:54
unit_drawer(display &thedisp)
Definition: drawer.cpp:33
int experience() const
The current number of experience points this unit has.
Definition: unit.hpp:432
const map_location & get_location() const
The current map location this unit is at.
Definition: unit.hpp:1174
void fill_rectangle(const SDL_Rect &rect, const color_t &color)
Draws a filled rectangle.
Definition: rect.cpp:65
bool can_advance() const
Checks whether this unit has any options to advance to.
Definition: unit.hpp:193
bool incapacitated() const
Check if the unit has been petrified.
Definition: unit.hpp:784
halo::handle unit_halo_
handle to the halo of this unit
int total_movement() const
The maximum moves this unit has.
Definition: unit.hpp:1090
bool emits_zoc() const
Tests whether the unit has a zone-of-control, considering incapacitated.
Definition: unit.hpp:1156
int side() const
The side this unit belongs to.
Definition: unit.hpp:265
void set_standing(bool with_bars=true)
Sets the animation state to standing.
bool show_unmoved_orb()
Definition: general.cpp:279
std::size_t playing_team
Definition: drawer.hpp:55
bool show_partial_orb()
Definition: general.cpp:286
bool slowed() const
Check if the unit has been slowed.
Definition: unit.hpp:793
double zoom_factor
Definition: drawer.hpp:62
bool show_everything
Definition: drawer.hpp:59
std::string TC_image_mods() const
Constructs a recolor (RC) IPF string for this unit&#39;s team color.
Definition: unit.cpp:2463
boost::tribool primary_frame
Definition: frame.hpp:68
int movement_left() const
Gets how far a unit can move, considering the incapacitated flag.
Definition: unit.hpp:1100
std::string image_mods() const
Gets an IPF string containing all IPF image mods.
Definition: unit.cpp:2468
std::string enemy_color()
Definition: general.cpp:325
Small wrapper that queries metadata about the provided texture.
Definition: texture.hpp:44
texture get_texture(const image::locator &i_locator, TYPE type)
Definition: picture.cpp:1424
map_location mouse_hex
Definition: drawer.hpp:61
void remove(const handle &h)
Remove the halo with the given handle.
Definition: halo.cpp:311
map_location sel_hex
Definition: drawer.hpp:60