29 #include <qnamespace.h>
50 static bool overview_dirty =
false;
53 static std::unique_ptr<freeciv::map_updates_handler> updates =
nullptr;
65 double *ntl_y,
int gui_x,
int gui_y)
67 const double gui_xd = gui_x, gui_yd = gui_y;
76 map_x = (gui_xd * H + gui_yd * W) / (W * H);
77 map_y = (gui_yd * W - gui_xd * H) / (W * H);
209 p.drawPixmap(ix, iy, *src, 0, 0, x_left, y_top);
210 p.drawPixmap(ix, 0, *src, 0, y_top, x_left, iy);
211 p.drawPixmap(0, iy, *src, x_left, 0, ix, y_top);
212 p.drawPixmap(0, 0, *src, x_left, y_top, ix, iy);
226 for (i = 0; i < 4; i++) {
229 int dst_x = x[(i + 1) % 4];
230 int dst_y = y[(i + 1) % 4];
232 p.drawLine(src_x, src_y, dst_x, dst_y);
238 overview_dirty =
false;
253 if (overview_dirty) {
298 int x,
int y,
int w,
int h)
304 p.fillRect(x, y, w, h, QColor(0, 0, 0, 128));
418 void unqueue_overview_updates()
420 if (updates->full()) {
423 for (
const auto [
tile,
_] : updates->list()) {
436 updates = std::make_unique<freeciv::map_updates_handler>();
439 updates.get(), unqueue_overview_updates, Qt::QueuedConnection);
struct player * city_owner(const struct city *pcity)
Return the owner of the city.
bool can_client_change_view()
Return TRUE if the client can change the view; i.e.
enum known_type client_tile_get_known(const struct tile *ptile)
A tile's "known" field is used by the server to store whether each player knows the tile.
QColor get_color(const struct tileset *t, enum color_std stdcolor)
Return a pointer to the given "standard" color.
QColor get_terrain_color(const struct tileset *t, const struct terrain *pterrain)
Return a pointer to the given "terrain" color.
QColor get_player_color(const struct tileset *t, const struct player *pplayer)
Return the color of the player.
unit * find_visible_unit(const ::tile *ptile)
Return a pointer to a visible unit, if there is one.
#define fc_assert(condition)
#define log_debug(message,...)
bool normalize_map_pos(const struct civ_map *nmap, int *x, int *y)
If the position is real, it will be normalized and TRUE will be returned.
#define current_topo_has_flag(flag)
#define NATURAL_TO_MAP_POS(pmap_x, pmap_y, nat_x, nat_y)
#define do_in_natural_pos(ntl_x, ntl_y, map_x, map_y)
#define MAP_TO_NATURAL_POS(pnat_x, pnat_y, map_x, map_y)
#define whole_map_iterate(_map, _tile)
#define do_in_natural_pos_end
#define whole_map_iterate_end
#define index_to_map_pos(pmap_x, pmap_y, mindex)
void update_minimap(void)
Return a canvas that is the overview window.
client_options * gui_options
@ OLAYER_BORDERS_ON_OCEAN
void overview_init()
Allocates overview resources.
void overview_to_map_pos(int *map_x, int *map_y, int overview_x, int overview_y)
Finds the map coordinates for a given overview (canvas) position.
static void redraw_overview()
Copies the overview image from the backing store to the window and draws the viewrect on top of it.
void gui_to_overview_pos(const struct tileset *t, int *ovr_x, int *ovr_y, int gui_x, int gui_y)
Translate from gui to overview coordinate systems.
void overview_redraw_callback(struct option *option)
Callback to be called when an overview option is changed.
void refresh_overview_canvas()
Redraw the entire backing store for the overview minimap.
void flush_dirty_overview()
Redraw the overview if it is "dirty".
static void overview_update_tile(const tile *ptile)
Redraw the given map position in the overview canvas.
void overview_free()
Free overview resources.
static void put_overview_tile_area(QPixmap *pcanvas, const tile *ptile, int x, int y, int w, int h)
Draws the color for this tile onto the given rectangle of the canvas.
void calculate_overview_dimensions()
Called if the map size is know or changes.
void gui_to_natural_pos(const struct tileset *t, double *ntl_x, double *ntl_y, int gui_x, int gui_y)
Translate from gui to natural coordinate systems.
static void dirty_overview()
Mark the overview as "dirty" so that it will be redrawn soon.
static QColor overview_tile_color(const tile *ptile)
Return color for overview map tile.
#define OVERVIEW_TILE_WIDTH
#define OVERVIEW_TILE_HEIGHT
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
Returns true iff players are allied.
#define FC_WRAP(value, range)
static int recursion[AIT_LAST]
The base class for options.
bool layers[OLAYER_COUNT]
#define is_ocean_tile(ptile)
#define terrain_has_flag(terr, flag)
struct city * tile_city(const struct tile *ptile)
Return the city on this tile (or nullptr), checking for city center.
#define tile_terrain(_tile)
#define tile_owner(_tile)
bool tileset_is_isometric(const struct tileset *t)
Return whether the current tileset is isometric.
int tileset_tile_height(const struct tileset *t)
Return the tile height of the current tileset.
int tileset_tile_width(const struct tileset *t)
Return the tile width of the current tileset.