The Battle for Wesnoth  1.17.21+dev
minimap.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2023
3  by David White <dave@whitevine.net>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #define GETTEXT_DOMAIN "wesnoth-lib"
17 
18 #include "minimap.hpp"
19 
20 #include "color.hpp"
21 #include "display.hpp"
22 #include "draw.hpp"
23 #include "game_board.hpp"
24 #include "gettext.hpp"
25 #include "picture.hpp"
26 #include "log.hpp"
27 #include "map/map.hpp"
28 #include "preferences/general.hpp"
29 #include "resources.hpp"
30 #include "sdl/surface.hpp"
31 #include "sdl/utils.hpp"
32 #include "team.hpp"
33 #include "terrain/type_data.hpp"
34 #include "units/unit.hpp"
35 
36 static lg::log_domain log_display("display");
37 #define DBG_DP LOG_STREAM(debug, log_display)
38 #define WRN_DP LOG_STREAM(warn, log_display)
39 
40 
41 namespace image {
42 
43 surface getMinimap(int w, int h, const gamemap &map, const team *vw, const std::map<map_location,unsigned int> *reach_map, bool ignore_terrain_disabled)
44 {
45  const terrain_type_data & tdata = *map.tdata();
46 
47 
48  const bool preferences_minimap_draw_terrain = preferences::minimap_draw_terrain() || ignore_terrain_disabled;
49  const bool preferences_minimap_terrain_coding = preferences::minimap_terrain_coding();
50  const bool preferences_minimap_draw_villages = preferences::minimap_draw_villages();
51  const bool preferences_minimap_unit_coding = preferences::minimap_movement_coding();
52 
53  const int scale = (preferences_minimap_draw_terrain && preferences_minimap_terrain_coding) ? 24 : 4;
54 
55  DBG_DP << "creating minimap " << int(map.w()*scale*0.75) << "," << map.h()*scale;
56 
57  const std::size_t map_width = map.w()*scale*3/4;
58  const std::size_t map_height = map.h()*scale;
59  if(map_width == 0 || map_height == 0) {
60  return surface(nullptr);
61  }
62 
63  if(!preferences_minimap_draw_villages && !preferences_minimap_draw_terrain)
64  {
65  //return if there is nothing to draw.
66  //(optimisation)
67  double ratio = std::min<double>( w*1.0 / map_width, h*1.0 / map_height);
68  return surface(map_width * ratio, map_height * ratio);
69  }
70 
71  surface minimap(map_width, map_height);
72  if(minimap == nullptr)
73  return surface(nullptr);
74 
75  typedef mini_terrain_cache_map cache_map;
76  cache_map *normal_cache = &mini_terrain_cache;
77  cache_map *fog_cache = &mini_fogged_terrain_cache;
78  cache_map *highlight_cache = &mini_highlighted_terrain_cache;
79 
80  for(int y = 0; y <= map.total_height(); ++y)
81  for(int x = 0; x <= map.total_width(); ++x) {
82 
83  const map_location loc(x,y);
84  if(!map.on_board_with_border(loc))
85  continue;
86 
87  const bool shrouded = (display::get_singleton() != nullptr && display::get_singleton()->is_blindfolded()) || (vw != nullptr && vw->shrouded(loc));
88  // shrouded hex are not considered fogged (no need to fog a black image)
89  const bool fogged = (vw != nullptr && !shrouded && vw->fogged(loc));
90 
91  const bool highlighted = reach_map && reach_map->count(loc) != 0 && !shrouded;
92 
93  const t_translation::terrain_code terrain = shrouded ?
94  t_translation::VOID_TERRAIN : map[loc];
95  const terrain_type& terrain_info = tdata.get_terrain_info(terrain);
96 
97  // we need a balanced shift up and down of the hexes.
98  // if not, only the bottom half-hexes are clipped
99  // and it looks asymmetrical.
100 
101  SDL_Rect maprect {
102  x * scale * 3 / 4 - (scale / 4)
103  , y * scale + scale / 4 * (is_odd(x) ? 1 : -1) - (scale / 4)
104  , 0
105  , 0
106  };
107 
108  if (preferences_minimap_draw_terrain) {
109 
110  if (preferences_minimap_terrain_coding) {
111 
112  surface surf(nullptr);
113 
114  bool need_fogging = false;
115  bool need_highlighting = false;
116 
117  cache_map* cache = fogged ? fog_cache : normal_cache;
118  if (highlighted)
119  cache = highlight_cache;
120  cache_map::iterator i = cache->find(terrain);
121 
122  if (fogged && i == cache->end()) {
123  // we don't have the fogged version in cache
124  // try the normal cache and ask fogging the image
125  cache = normal_cache;
126  i = cache->find(terrain);
127  need_fogging = true;
128  }
129 
130  if (highlighted && i == cache->end()) {
131  // we don't have the highlighted version in cache
132  // try the normal cache and ask fogging the image
133  cache = normal_cache;
134  i = cache->find(terrain);
135  need_highlighting = true;
136  }
137 
138  if(i == cache->end() && !terrain_info.minimap_image().empty()) {
139  std::string base_file =
140  "terrain/" + terrain_info.minimap_image() + ".png";
141  surface tile = get_surface(base_file,image::HEXED);
142 
143  //Compose images of base and overlay if necessary
144  // NOTE we also skip overlay when base is missing (to avoid hiding the error)
145  if(tile != nullptr && tdata.get_terrain_info(terrain).is_combined() && !terrain_info.minimap_image_overlay().empty()) {
146  std::string overlay_file =
147  "terrain/" + terrain_info.minimap_image_overlay() + ".png";
148  surface overlay = get_surface(overlay_file, image::HEXED);
149 
150  if(overlay != nullptr && overlay != tile) {
151  surface combined(tile->w, tile->h);
152  SDL_Rect r {0,0,0,0};
153  sdl_blit(tile, nullptr, combined, &r);
154  r.x = std::max(0, (tile->w - overlay->w)/2);
155  r.y = std::max(0, (tile->h - overlay->h)/2);
156  sdl_blit(overlay, nullptr, combined, &r);
157  tile = combined;
158  }
159  }
160 
161  surf = scale_surface_sharp(tile, scale, scale);
162 
163  i = normal_cache->emplace(terrain, surf).first;
164  }
165 
166  if (i != cache->end())
167  {
168  surf = i->second;
169 
170  if (need_fogging) {
171  surf = adjust_surface_color(surf, -50, -50, -50);
172  fog_cache->emplace(terrain, surf);
173  }
174 
175  if (need_highlighting) {
176  surf = adjust_surface_color(surf, 50, 50, 50);
177  highlight_cache->emplace(terrain, surf);
178  }
179  }
180 
181  if(surf != nullptr)
182  sdl_blit(surf, nullptr, minimap, &maprect);
183 
184  } else {
185 
186  // Despite its name, game_config::team_rgb_range isn't just team colors,
187  // it has "red", "lightblue", "cave", "reef", "fungus", etc.
188  color_t col;
189  std::map<std::string, color_range>::const_iterator it = game_config::team_rgb_range.find(terrain_info.id());
190  if (it == game_config::team_rgb_range.end()) {
191  col = color_t(0,0,0,0);
192  } else
193  col = it->second.rep();
194 
195  bool first = true;
196  const t_translation::ter_list& underlying_terrains = tdata.underlying_union_terrain(terrain);
197  for(const t_translation::terrain_code& underlying_terrain : underlying_terrains) {
198 
199  const std::string& terrain_id = tdata.get_terrain_info(underlying_terrain).id();
200  it = game_config::team_rgb_range.find(terrain_id);
201  if (it == game_config::team_rgb_range.end())
202  continue;
203 
204  color_t tmp = it->second.rep();
205 
206  if (fogged) {
207  if (tmp.b < 50) tmp.b = 0;
208  else tmp.b -= 50;
209  if (tmp.g < 50) tmp.g = 0;
210  else tmp.g -= 50;
211  if (tmp.r < 50) tmp.r = 0;
212  else tmp.r -= 50;
213  }
214 
215  if (highlighted) {
216  if (tmp.b > 205) tmp.b = 255;
217  else tmp.b += 50;
218  if (tmp.g > 205) tmp.g = 255;
219  else tmp.g += 50;
220  if (tmp.r > 205) tmp.r = 255;
221  else tmp.r += 50;
222  }
223 
224  if (first) {
225  first = false;
226  col = tmp;
227  } else {
228  col.r = col.r - (col.r - tmp.r)/2;
229  col.g = col.g - (col.g - tmp.g)/2;
230  col.b = col.b - (col.b - tmp.b)/2;
231  }
232  }
233  SDL_Rect fillrect {maprect.x, maprect.y, scale * 3/4, scale};
234  const uint32_t mapped_col = SDL_MapRGB(minimap->format,col.r,col.g,col.b);
235  sdl::fill_surface_rect(minimap, &fillrect, mapped_col);
236  }
237  }
238 
239  if (terrain_info.is_village() && preferences_minimap_draw_villages) {
240 
241  int side_num = (resources::gameboard ? resources::gameboard->village_owner(loc) : 0); //check needed for mp create dialog
242 
243  // TODO: Add a key to [game_config][colors] for this
244  auto iter = game_config::team_rgb_range.find("white");
245  color_t col(255,255,255);
246  if(iter != game_config::team_rgb_range.end()) {
247  col = iter->second.min();
248  }
249 
250  if (!fogged) {
251  if (side_num > 0) {
252 
253  if (preferences_minimap_unit_coding || !vw ) {
254  col = team::get_minimap_color(side_num);
255  } else {
256 
257  if (vw->owns_village(loc))
259  else if (vw->is_enemy(side_num))
261  else
263  }
264  }
265  }
266 
267  SDL_Rect fillrect {
268  maprect.x
269  , maprect.y
270  , scale * 3/4
271  , scale
272  };
273 
274  const uint32_t mapped_col = SDL_MapRGB(minimap->format,col.r,col.g,col.b);
275  sdl::fill_surface_rect(minimap, &fillrect, mapped_col);
276 
277  }
278 
279  }
280 
281  double wratio = w*1.0 / minimap->w;
282  double hratio = h*1.0 / minimap->h;
283  double ratio = std::min<double>(wratio, hratio);
284 
285  minimap = scale_surface_sharp(minimap,
286  static_cast<int>(minimap->w * ratio), static_cast<int>(minimap->h * ratio));
287 
288  DBG_DP << "done generating minimap";
289 
290  return minimap;
291 }
292 
293 void render_minimap(unsigned dst_w,
294  unsigned dst_h,
295  const gamemap& map,
296  const team* vw,
297  const unit_map* units,
298  const std::map<map_location, unsigned int>* reach_map,
299  bool ignore_terrain_disabled)
300 {
301  // Drawing mode flags.
302  const bool preferences_minimap_draw_terrain = preferences::minimap_draw_terrain() || ignore_terrain_disabled;
303  const bool preferences_minimap_terrain_coding = preferences::minimap_terrain_coding();
304  const bool preferences_minimap_draw_villages = preferences::minimap_draw_villages();
305  const bool preferences_minimap_draw_units = preferences::minimap_draw_units();
306  const bool preferences_minimap_unit_coding = preferences::minimap_movement_coding();
307 
308  const int scale = (preferences_minimap_draw_terrain && preferences_minimap_terrain_coding) ? 24 : 4;
309 
310  DBG_DP << "Creating minimap: " << static_cast<int>(map.w() * scale * 0.75) << ", " << map.h() * scale;
311 
312  const std::size_t map_width = std::max(0, map.w()) * scale * 3 / 4;
313  const std::size_t map_height = std::max(0, map.h()) * scale;
314 
315  // No map!
316  if(map_width == 0 || map_height == 0) {
317  return;
318  }
319 
320  // Nothing to draw!
321  if(!preferences_minimap_draw_villages && !preferences_minimap_draw_terrain) {
322  return;
323  }
324 
325  const display* disp = display::get_singleton();
326  const bool is_blindfolded = disp && disp->is_blindfolded();
327 
328  const auto shrouded = [&](const map_location& loc) {
329  return is_blindfolded || (vw && vw->shrouded(loc));
330  };
331 
332  const auto fogged = [&](const map_location& loc) {
333  // Shrouded hex are not considered fogged (no need to fog a black image)
334  return vw && !shrouded(loc) && vw->fogged(loc);
335  };
336 
337  // Gets a destination rect for drawing at the given coordinates.
338  // We need a balanced shift up and down of the hexes.
339  // If not, only the bottom half-hexes are clipped and it looks asymmetrical.
340  const auto get_dst_rect = [scale](const map_location& loc) {
341  return rect {
342  loc.x * scale * 3 / 4 - (scale / 4),
343  loc.y * scale + scale / 4 * (is_odd(loc.x) ? 1 : -1) - (scale / 4),
344  scale,
345  scale
346  };
347  };
348 
349  // We want to draw the minimap with NN scaling.
350  set_texture_scale_quality("nearest");
351 
352  // Create a temp texture a bit larger than we want. This allows us to compose the minimap and then
353  // scale the whole result down the desired destination texture size.
354  texture minimap(map_width, map_height, SDL_TEXTUREACCESS_TARGET);
355  if(!minimap) {
356  return;
357  }
358 
359  {
360  // Point rendering to the temp minimap texture.
361  const draw::render_target_setter target_setter{minimap};
362 
363  // Clear the minimap texture, as some of it can be left transparent.
364  draw::set_blend_mode(SDL_BLENDMODE_NONE);
365  draw::fill(0, 0, 0, 0);
366  draw::set_blend_mode(SDL_BLENDMODE_BLEND);
367 
368  //
369  // Terrain
370  //
371  if(preferences_minimap_draw_terrain) {
372  map.for_each_loc([&](const map_location& loc) {
373  const bool highlighted = reach_map && reach_map->count(loc) != 0 && !shrouded(loc);
374 
375  const t_translation::terrain_code terrain = shrouded(loc) ? t_translation::VOID_TERRAIN : map[loc];
376  const terrain_type& terrain_info = map.tdata()->get_terrain_info(terrain);
377 
378  // Destination rect for drawing the current hex.
379  rect dest = get_dst_rect(loc);
380 
381  //
382  // Draw map terrain using either terrain images...
383  //
384  if(preferences_minimap_terrain_coding) {
385  if(!terrain_info.minimap_image().empty()) {
386  const std::string base_file = "terrain/" + terrain_info.minimap_image() + ".png";
387  const texture& tile = image::get_texture(base_file); // image::HEXED
388 
389  // TODO: handle fog (was a -50, -50, -50 adjust) and highlight (was a 50, 50, 50 adjust).
390  draw::blit(tile, dest);
391 
392  // NOTE: we skip the overlay when base is missing (to avoid hiding the error)
393  if(tile && map.tdata()->get_terrain_info(terrain).is_combined()
394  && !terrain_info.minimap_image_overlay().empty())
395  {
396  const std::string overlay_file = "terrain/" + terrain_info.minimap_image_overlay() + ".png";
397  const texture& overlay = image::get_texture(overlay_file); // image::HEXED
398 
399  // TODO: crop/center overlays?
400  draw::blit(overlay, dest);
401  }
402  }
403  } else {
404  //
405  // ... or color coding.
406  //
407  color_t col(0, 0, 0, 0);
408 
409  // Despite its name, game_config::team_rgb_range isn't just team colors,
410  // it has "red", "lightblue", "cave", "reef", "fungus", etc.
411  auto it = game_config::team_rgb_range.find(terrain_info.id());
412  if(it != game_config::team_rgb_range.end()) {
413  col = it->second.rep();
414  }
415 
416  bool first = true;
417 
418  for(const auto& underlying_terrain : map.tdata()->underlying_union_terrain(terrain)) {
419  const std::string& terrain_id = map.tdata()->get_terrain_info(underlying_terrain).id();
420 
421  it = game_config::team_rgb_range.find(terrain_id);
422  if(it == game_config::team_rgb_range.end()) {
423  return;
424  }
425 
426  color_t tmp = it->second.rep();
427 
428  if(fogged(loc)) {
429  tmp.r = std::max(0, tmp.r - 50);
430  tmp.g = std::max(0, tmp.g - 50);
431  tmp.b = std::max(0, tmp.b - 50);
432  }
433 
434  if(highlighted) {
435  tmp.r = std::min(255, tmp.r + 50);
436  tmp.g = std::min(255, tmp.g + 50);
437  tmp.b = std::min(255, tmp.b + 50);
438  }
439 
440  if(first) {
441  first = false;
442  col = tmp;
443  } else {
444  col.r = col.r - (col.r - tmp.r) / 2;
445  col.g = col.g - (col.g - tmp.g) / 2;
446  col.b = col.b - (col.b - tmp.b) / 2;
447  }
448  }
449 
450  dest.w = scale * 3 / 4;
451  draw::fill(dest, col);
452  }
453  });
454  }
455 
456  //
457  // Villages
458  //
459  if(preferences_minimap_draw_villages) {
460  for(const map_location& loc : map.villages()) {
461  // Check needed for mp create dialog
462  const int side_num = resources::gameboard ? resources::gameboard->village_owner(loc) : 0;
463 
464  color_t col(255, 255, 255);
465 
466  // TODO: Add a key to [game_config][colors] for this
467  auto iter = game_config::team_rgb_range.find("white");
468  if(iter != game_config::team_rgb_range.end()) {
469  col = iter->second.min();
470  }
471 
472  if(!fogged(loc) && side_num > 0) {
473  if(preferences_minimap_unit_coding || !vw) {
474  col = team::get_minimap_color(side_num);
475  } else {
476  if(vw->owns_village(loc)) {
478  } else if(vw->is_enemy(side_num)) {
480  } else {
482  }
483  }
484  }
485 
486  rect dest = get_dst_rect(loc);
487  dest.w = scale * 3 / 4;
488 
489  draw::fill(dest, col);
490  }
491  }
492 
493  //
494  // Units
495  //
496  if(units && preferences_minimap_draw_units && !is_blindfolded) {
497  for(const auto& u : *units) {
498  const map_location& u_loc = u.get_location();
499  const int side = u.side();
500  const bool is_enemy = vw && vw->is_enemy(side);
501 
502  if((vw && vw->fogged(u_loc)) || (is_enemy && disp && u.invisible(u_loc)) || u.get_hidden()) {
503  continue;
504  }
505 
506  color_t col = team::get_minimap_color(side);
507 
508  if(!preferences_minimap_unit_coding) {
509  auto status = orb_status::allied;
510 
511  if(is_enemy) {
512  status = orb_status::enemy;
513  } else if(vw && vw->side() == side) {
514  status = disp->get_disp_context().unit_orb_status(u);
515  } else {
516  // no-op, status is already set to orb_status::allied;
517  }
518 
520  }
521 
522  rect fillrect = get_dst_rect(u_loc);
523  fillrect.w = scale * 3 / 4;
524 
525  draw::fill(fillrect, col);
526  }
527  }
528  }
529 
530  point raw_size = minimap.get_raw_size();
531 
532  const double wratio = dst_w * 1.0 / raw_size.x;
533  const double hratio = dst_h * 1.0 / raw_size.y;
534 
535  const double ratio = std::min<double>(wratio, hratio);
536 
537  // TODO: maybe add arguments so we can set render origin?
538  // Finally, render the composited minimap texture (scaled down) to the render target,
539  // which should be the passed texture.
540  draw::blit(minimap, {
541  0,
542  0,
543  static_cast<int>(raw_size.x * ratio),
544  static_cast<int>(raw_size.y * ratio)
545  });
546 
547  DBG_DP << "done generating minimap";
548 }
549 
550 }
color_t rep() const
High-contrast shade, intended for the minimap markers.
Definition: color_range.hpp:95
orb_status unit_orb_status(const unit &u) const
Returns an enumurated summary of whether this unit can move and/or attack.
int village_owner(const map_location &loc) const
Given the location of a village, will return the 1-based number of the team that currently owns it,...
Sort-of-Singleton that many classes, both GUI and non-GUI, use to access the game data.
Definition: display.hpp:87
const display_context & get_disp_context() const
Definition: display.hpp:189
bool is_blindfolded() const
Definition: display.cpp:482
static display * get_singleton()
Returns the display object if a display object exists.
Definition: display.hpp:101
A class to manage automatic restoration of the render target.
Definition: draw.hpp:425
int w() const
Effective map width.
Definition: map.hpp:50
int h() const
Effective map height.
Definition: map.hpp:53
void for_each_loc(const F &f) const
Definition: map.hpp:136
int total_width() const
Real width of the map, including borders.
Definition: map.hpp:59
bool on_board_with_border(const map_location &loc) const
Definition: map.cpp:390
int total_height() const
Real height of the map, including borders.
Definition: map.hpp:62
Encapsulates the map of the game.
Definition: map.hpp:172
const std::vector< map_location > & villages() const
Return a list of the locations of villages on the map.
Definition: map.hpp:237
const std::shared_ptr< terrain_type_data > & tdata() const
Definition: map.hpp:204
This class stores all the data for a single 'side' (in game nomenclature).
Definition: team.hpp:76
static color_t get_minimap_color(int side)
Definition: team.cpp:965
int side() const
Definition: team.hpp:176
bool is_enemy(int n) const
Definition: team.hpp:231
bool owns_village(const map_location &loc) const
Definition: team.hpp:173
bool shrouded(const map_location &loc) const
Definition: team.cpp:651
bool fogged(const map_location &loc) const
Definition: team.cpp:660
Contains the database of all known terrain types, both those defined explicitly by WML [terrain_type]...
Definition: type_data.hpp:40
const terrain_type & get_terrain_info(const t_translation::terrain_code &terrain) const
Get the corresponding terrain_type information object for a given type of terrain.
Definition: type_data.cpp:102
const t_translation::ter_list & underlying_union_terrain(const t_translation::terrain_code &terrain) const
Unordered set of all terrains used in either underlying_mvt_terrain or underlying_def_terrain.
Definition: type_data.cpp:143
const std::string & minimap_image() const
Definition: terrain.hpp:45
bool is_combined() const
True for instances created by the terrain_code(base, overlay) constructor.
Definition: terrain.hpp:167
const std::string & id() const
Definition: terrain.hpp:52
bool is_village() const
Definition: terrain.hpp:141
const std::string & minimap_image_overlay() const
Definition: terrain.hpp:46
Wrapper class to encapsulate creation and management of an SDL_Texture.
Definition: texture.hpp:33
point get_raw_size() const
The raw internal texture size.
Definition: texture.cpp:112
Container associating units to locations.
Definition: map.hpp:99
Drawing functions, for drawing things on the screen.
std::size_t i
Definition: function.cpp:968
int w
Standard logging facilities (interface).
constexpr bool is_odd(T num)
Definition: math.hpp:36
static lg::log_domain log_display("display")
#define DBG_DP
Definition: minimap.cpp:37
void fill(const SDL_Rect &rect, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
Fill an area with the given colour.
Definition: draw.cpp:41
void set_blend_mode(SDL_BlendMode b)
Set the blend mode used for drawing operations such as fill() and line().
Definition: draw.cpp:109
void blit(const texture &tex, const SDL_Rect &dst)
Draws a texture, or part of a texture, at the given location.
Definition: draw.cpp:301
std::map< std::string, color_range > team_rgb_range
Colors defined by WML [color_range] tags.
const color_range & color_info(const std::string &name)
Functions to load and save images from/to disk.
mini_terrain_cache_map mini_highlighted_terrain_cache
Definition: picture.cpp:223
mini_terrain_cache_map mini_terrain_cache
Definition: picture.cpp:221
mini_terrain_cache_map mini_fogged_terrain_cache
Definition: picture.cpp:222
surface get_surface(const image::locator &i_locator, TYPE type, bool skip_cache)
Returns an image surface suitable for software manipulation.
Definition: picture.cpp:686
std::map< t_translation::terrain_code, surface > mini_terrain_cache_map
Definition: picture.hpp:166
@ HEXED
Standard hexagonal tile mask applied, removing portions that don't fit.
Definition: picture.hpp:235
texture get_texture(const image::locator &i_locator, TYPE type, bool skip_cache)
Returns an image texture suitable for hardware-accelerated rendering.
Definition: picture.cpp:985
void render_minimap(unsigned dst_w, unsigned dst_h, const gamemap &map, const team *vw, const unit_map *units, const std::map< map_location, unsigned int > *reach_map, bool ignore_terrain_disabled)
Renders the minimap to the screen.
Definition: minimap.cpp:293
surface getMinimap(int w, int h, const gamemap &map, const team *vw, const std::map< map_location, unsigned int > *reach_map, bool ignore_terrain_disabled)
function to create the minimap for a given map the surface returned must be freed by the user
Definition: minimap.cpp:43
std::string get_orb_color(orb_status os)
Wrapper for the various preferences::unmoved_color(), moved_color(), etc methods, using the enum inst...
Definition: orb_status.cpp:40
bool minimap_movement_coding()
Definition: general.cpp:835
bool minimap_draw_villages()
Definition: general.cpp:865
bool minimap_terrain_coding()
Definition: general.cpp:845
bool minimap_draw_terrain()
Definition: general.cpp:875
std::string enemy_color()
Definition: general.cpp:342
std::string allied_color()
Definition: general.cpp:322
std::string unmoved_color()
Definition: general.cpp:362
bool minimap_draw_units()
Definition: general.cpp:855
game_board * gameboard
Definition: resources.cpp:21
void fill_surface_rect(surface &dst, SDL_Rect *dst_rect, const uint32_t color)
Fill a rectangle on a given surface.
Definition: utils.hpp:49
const terrain_code VOID_TERRAIN
VOID_TERRAIN is used for shrouded hexes.
std::vector< terrain_code > ter_list
Definition: translation.hpp:77
std::string::const_iterator iterator
Definition: tokenizer.hpp:25
void scale(size_t factor, const uint32_t *src, uint32_t *trg, int srcWidth, int srcHeight, const ScalerCfg &cfg=ScalerCfg(), int yFirst=0, int yLast=std::numeric_limits< int >::max())
Definition: xbrz.cpp:1190
@ allied
Belongs to a friendly side.
@ enemy
Belongs to a non-friendly side; normally visualised by not displaying an orb.
The basic class for representing 8-bit RGB or RGBA colour values.
Definition: color.hpp:59
Encapsulates the map of the game.
Definition: location.hpp:38
Holds a 2D point.
Definition: point.hpp:25
An abstract description of a rectangle with integer coordinates.
Definition: rect.hpp:47
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...
Definition: translation.hpp:49
void set_texture_scale_quality(const char *value)
Sets the texture scale quality.
Definition: texture.hpp:227
surface adjust_surface_color(const surface &surf, int red, int green, int blue)
Definition: utils.cpp:484
surface scale_surface_sharp(const surface &surf, int w, int h)
Scale a surface using modified nearest neighbour algorithm.
Definition: utils.cpp:395
void sdl_blit(const surface &src, const SDL_Rect *src_rect, surface &dst, SDL_Rect *dst_rect)
Definition: utils.hpp:57
#define h