Freeciv-3.3: /fast/freeciv/nightly/main/client/overview_common.c Source File

Freeciv-3.3

Loading...
Searching...
No Matches
overview_common.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996-2005 - Freeciv Development Team
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18#include <math.h> /* floor */
19
20/* utility */
21#include "log.h"
22
23/* client */
24#include "client_main.h" /* can_client_change_view() */
25#include "climap.h"
26#include "control.h"
27#include "mapview_g.h"
28#include "options.h"
29#include "zoom.h"
30
31#include "overview_common.h"
32
33 int OVERVIEW_TILE_SIZE = 2;
34#if 0
35struct overview overview = {
36 /* These are the default values. All others are zeroed automatically. */
37 .fog = TRUE,
38 .layers = {[OLAYER_BACKGROUND] = TRUE,
39 [OLAYER_UNITS] = TRUE,
40 [OLAYER_CITIES] = TRUE,
41 [OLAYER_BORDERS_ON_OCEAN] = TRUE}
42};
43#endif
44
45/*
46 * Set to TRUE if the backing store is more recent than the version
47 * drawn into overview.window.
48 */
49 static bool overview_dirty = FALSE;
50
51/************************************************************************/
56 static void gui_to_natural_pos(const struct tileset *t,
57 double *ntl_x, double *ntl_y,
58 int gui_x, int gui_y)
59{
60 const double gui_xd = gui_x, gui_yd = gui_y;
61 const double W = tileset_tile_width(t) * map_zoom;
62 const double H = tileset_tile_height(t) * map_zoom;
63 double map_x, map_y;
64
65 /* First convert to map positions. This ignores hex conversions; we're
66 * not looking for an exact tile. */
67 if (tileset_is_isometric(t)) {
68 /* Includes hex cases. */
69 map_x = (gui_xd * H + gui_yd * W) / (W * H);
70 map_y = (gui_yd * W - gui_xd * H) / (W * H);
71 } else {
72 map_x = gui_xd / W;
73 map_y = gui_yd / H;
74 }
75
76 /* Now convert to natural positions. Note this assumes the macro form
77 * of the conversion will work with floating-point values. */
78 MAP_TO_NATURAL_POS(ntl_x, ntl_y, map_x, map_y);
79}
80
81/************************************************************************/
84 static void gui_to_overview_pos(const struct tileset *t,
85 int *ovr_x, int *ovr_y,
86 int gui_x, int gui_y)
87{
88 double ntl_x, ntl_y;
89
90 gui_to_natural_pos(t, &ntl_x, &ntl_y, gui_x, gui_y);
91
92 /* Now convert straight to overview coordinates. */
93 *ovr_x = floor((ntl_x - (double)gui_options.overview.map_x0) * OVERVIEW_TILE_SIZE);
94 *ovr_y = floor((ntl_y - (double)gui_options.overview.map_y0) * OVERVIEW_TILE_SIZE);
95
96 /* Now do additional adjustments. See map_to_overview_pos(). */
97 if (current_wrap_has_flag(WRAP_X)) {
98 *ovr_x = FC_WRAP(*ovr_x, MAP_NATURAL_WIDTH * OVERVIEW_TILE_SIZE);
99 } else {
100 if (MAP_IS_ISOMETRIC) {
101 /* HACK: For iso-maps that don't wrap in the X direction we clip
102 * a half-tile off of the left and right of the overview.
103 * This means some tiles only are halfway shown. However it means we
104 * don't show any unreal tiles, which we'd otherwise be doing.
105 * The rest of the code can't handle unreal tiles in the overview. */
106 *ovr_x -= OVERVIEW_TILE_SIZE;
107 }
108 }
109
110 if (current_wrap_has_flag(WRAP_Y)) {
111 *ovr_y = FC_WRAP(*ovr_y, MAP_NATURAL_HEIGHT * OVERVIEW_TILE_SIZE);
112 }
113}
114
115/************************************************************************/
118 static struct color *overview_tile_color(struct tile *ptile)
119{
120 if (gui_options.overview.layers[OLAYER_CITIES]) {
121 struct city *pcity = tile_city(ptile);
122
123 if (pcity) {
124 if (NULL == client.conn.playing
125 || city_owner(pcity) == client.conn.playing) {
126 return get_color(tileset, COLOR_OVERVIEW_MY_CITY);
127 } else if (pplayers_allied(city_owner(pcity), client.conn.playing)) {
128 /* Includes teams. */
129 return get_color(tileset, COLOR_OVERVIEW_ALLIED_CITY);
130 } else {
131 return get_color(tileset, COLOR_OVERVIEW_ENEMY_CITY);
132 }
133 }
134 }
135 if (gui_options.overview.layers[OLAYER_UNITS]) {
136 struct unit *punit = find_visible_unit(ptile);
137
138 if (punit) {
139 if (NULL == client.conn.playing
140 || unit_owner(punit) == client.conn.playing) {
141 return get_color(tileset, COLOR_OVERVIEW_MY_UNIT);
142 } else if (pplayers_allied(unit_owner(punit), client.conn.playing)) {
143 /* Includes teams. */
144 return get_color(tileset, COLOR_OVERVIEW_ALLIED_UNIT);
145 } else {
146 return get_color(tileset, COLOR_OVERVIEW_ENEMY_UNIT);
147 }
148 }
149 }
150 if (gui_options.overview.layers[OLAYER_BORDERS]) {
151 struct player *owner = tile_owner(ptile);
152
153 if (owner) {
154 if (gui_options.overview.layers[OLAYER_BORDERS_ON_OCEAN]) {
155 return get_player_color(tileset, owner);
156 } else if (!is_ocean_tile(ptile)) {
157 return get_player_color(tileset, owner);
158 }
159 }
160 }
161 if (gui_options.overview.layers[OLAYER_RELIEF]
162 && tile_terrain(ptile) != T_UNKNOWN) {
163 return get_terrain_color(tileset, tile_terrain(ptile));
164 }
165 if (gui_options.overview.layers[OLAYER_BACKGROUND]
166 && tile_terrain(ptile) != T_UNKNOWN) {
167 if (terrain_has_flag(tile_terrain(ptile), TER_FROZEN)) {
168 return get_color(tileset, COLOR_OVERVIEW_FROZEN);
169 } else {
170 if (is_ocean_tile(ptile)) {
171 return get_color(tileset, COLOR_OVERVIEW_OCEAN);
172 } else {
173 return get_color(tileset, COLOR_OVERVIEW_LAND);
174 }
175 }
176 }
177
178 return get_color(tileset, COLOR_OVERVIEW_UNKNOWN);
179}
180
181/************************************************************************/
185 void refresh_overview_from_canvas(void)
186{
187 struct canvas *dest = get_overview_window();
188
189 if (!dest) {
190 return;
191 }
192 canvas_copy(dest, gui_options.overview.window,
193 0, 0, 0, 0,
194 gui_options.overview.width, gui_options.overview.height);
195}
196
197/************************************************************************/
201 static void redraw_overview(void)
202{
203 int i, x[4], y[4];
204
205 if (!gui_options.overview.map) {
206 return;
207 }
208
209 {
210 struct canvas *src = gui_options.overview.map;
211 struct canvas *dst = gui_options.overview.window;
212 int x_left = gui_options.overview.map_x0 * OVERVIEW_TILE_SIZE;
213 int y_top = gui_options.overview.map_y0 * OVERVIEW_TILE_SIZE;
214 int ix = gui_options.overview.width - x_left;
215 int iy = gui_options.overview.height - y_top;
216
217 canvas_copy(dst, src, 0, 0, ix, iy, x_left, y_top);
218 canvas_copy(dst, src, 0, y_top, ix, 0, x_left, iy);
219 canvas_copy(dst, src, x_left, 0, 0, iy, ix, y_top);
220 canvas_copy(dst, src, x_left, y_top, 0, 0, ix, iy);
221 }
222
223 gui_to_overview_pos(tileset, &x[0], &y[0],
224 mapview.gui_x0, mapview.gui_y0);
225 gui_to_overview_pos(tileset, &x[1], &y[1],
226 mapview.gui_x0 + mapview.width, mapview.gui_y0);
227 gui_to_overview_pos(tileset, &x[2], &y[2],
228 mapview.gui_x0 + mapview.width,
229 mapview.gui_y0 + mapview.height);
230 gui_to_overview_pos(tileset, &x[3], &y[3],
231 mapview.gui_x0, mapview.gui_y0 + mapview.height);
232
233 for (i = 0; i < 4; i++) {
234 int src_x = x[i];
235 int src_y = y[i];
236 int dst_x = x[(i + 1) % 4];
237 int dst_y = y[(i + 1) % 4];
238
239 canvas_put_line(gui_options.overview.window,
240 get_color(tileset, COLOR_OVERVIEW_VIEWRECT),
241 LINE_NORMAL,
242 src_x, src_y, dst_x - src_x, dst_y - src_y);
243 }
244
245 refresh_overview_from_canvas();
246
247 overview_dirty = FALSE;
248}
249
250/************************************************************************/
253 static void dirty_overview(void)
254{
255 overview_dirty = TRUE;
256}
257
258/************************************************************************/
261 void flush_dirty_overview(void)
262{
263 /* Currently this function is called from mapview_common. However it
264 * should be made static eventually. */
265 if (overview_dirty) {
266 redraw_overview();
267 }
268}
269
270/************************************************************************/
273 static double wrap_double(double value, double wrap)
274{
275 while (value < 0) {
276 value += wrap;
277 }
278 while (value >= wrap) {
279 value -= wrap;
280 }
281 return value;
282}
283
284/************************************************************************/
287 void center_tile_overviewcanvas(void)
288{
289 double ntl_x, ntl_y;
290 int ox, oy;
291
292 gui_to_natural_pos(tileset, &ntl_x, &ntl_y,
293 mapview.gui_x0 + mapview.width / 2,
294 mapview.gui_y0 + mapview.height / 2);
295
296 /* NOTE: this embeds the map wrapping in the overview code. This is
297 * basically necessary for the overview to be efficiently
298 * updated. */
299 if (current_wrap_has_flag(WRAP_X)) {
300 gui_options.overview.map_x0
301 = wrap_double(ntl_x - (double)MAP_NATURAL_WIDTH / 2.0,
302 MAP_NATURAL_WIDTH);
303 } else {
304 gui_options.overview.map_x0 = 0;
305 }
306 if (current_wrap_has_flag(WRAP_Y)) {
307 gui_options.overview.map_y0
308 = wrap_double(ntl_y - (double)MAP_NATURAL_HEIGHT / 2.0,
309 MAP_NATURAL_HEIGHT);
310 } else {
311 gui_options.overview.map_y0 = 0;
312 }
313
314 redraw_overview();
315
316 gui_to_overview_pos(tileset, &ox, &oy,
317 mapview.gui_x0, mapview.gui_y0);
318 update_overview_scroll_window_pos(ox, oy);
319}
320
321/************************************************************************/
324 void map_to_overview_pos(int *overview_x, int *overview_y,
325 int map_x, int map_y)
326{
327 /* The map position may not be normal, for instance when the mapview
328 * origin is not a normal position.
329 *
330 * NOTE: this embeds the map wrapping in the overview code. */
331 do_in_natural_pos(ntl_x, ntl_y, map_x, map_y) {
332 int ovr_x = ntl_x - gui_options.overview.map_x0;
333 int ovr_y = ntl_y - gui_options.overview.map_y0;
334
335 if (current_wrap_has_flag(WRAP_X)) {
336 ovr_x = FC_WRAP(ovr_x, MAP_NATURAL_WIDTH);
337 } else {
338 if (MAP_IS_ISOMETRIC) {
339 /* HACK: For iso-maps that don't wrap in the X direction we clip
340 * a half-tile off of the left and right of the overview.
341 * This means some tiles only are halfway shown. However it means we
342 * don't show any unreal tiles, which we'd otherwise be doing.
343 * The rest of the code can't handle unreal tiles in the overview. */
344 ovr_x--;
345 }
346 }
347 if (current_wrap_has_flag(WRAP_Y)) {
348 ovr_y = FC_WRAP(ovr_y, MAP_NATURAL_HEIGHT);
349 }
350 *overview_x = OVERVIEW_TILE_SIZE * ovr_x;
351 *overview_y = OVERVIEW_TILE_SIZE * ovr_y;
352 } do_in_natural_pos_end;
353}
354
355/************************************************************************/
358 void overview_to_map_pos(int *map_x, int *map_y,
359 int overview_x, int overview_y)
360{
361 int ntl_x = overview_x / OVERVIEW_TILE_SIZE + gui_options.overview.map_x0;
362 int ntl_y = overview_y / OVERVIEW_TILE_SIZE + gui_options.overview.map_y0;
363
364 if (MAP_IS_ISOMETRIC && !current_wrap_has_flag(WRAP_X)) {
365 /* Clip half tile left and right. See comment in map_to_overview_pos(). */
366 ntl_x++;
367 }
368
369 NATURAL_TO_MAP_POS(map_x, map_y, ntl_x, ntl_y);
370 /* All positions on the overview should be valid. */
371 fc_assert(normalize_map_pos(&(wld.map), map_x, map_y));
372}
373
374/************************************************************************/
377 void refresh_overview_canvas(void)
378{
379 if (!can_client_change_view()) {
380 return;
381 }
382 whole_map_iterate(&(wld.map), ptile) {
383 overview_update_tile(ptile);
384 } whole_map_iterate_end;
385 redraw_overview();
386}
387
388/************************************************************************/
394 static void put_overview_tile_area(struct canvas *pcanvas,
395 struct tile *ptile,
396 int x, int y, int w, int h)
397{
398 canvas_put_rectangle(pcanvas,
399 overview_tile_color(ptile),
400 x, y, w, h);
401 if (gui_options.overview.fog
402 && TILE_KNOWN_UNSEEN == client_tile_get_known(ptile)) {
403 canvas_put_sprite(pcanvas, x, y, get_basic_fog_sprite(tileset),
404 0, 0, w, h);
405 }
406}
407
408/************************************************************************/
411 void overview_update_tile(struct tile *ptile)
412{
413 int tile_x, tile_y;
414
415 /* Base overview positions are just like natural positions, but scaled to
416 * the overview tile dimensions. */
417 index_to_map_pos(&tile_x, &tile_y, tile_index(ptile));
418 do_in_natural_pos(ntl_x, ntl_y, tile_x, tile_y) {
419 int overview_y = ntl_y * OVERVIEW_TILE_SIZE;
420 int overview_x = ntl_x * OVERVIEW_TILE_SIZE;
421
422 if (MAP_IS_ISOMETRIC) {
423 if (current_wrap_has_flag(WRAP_X)) {
424 if (overview_x > gui_options.overview.width - OVERVIEW_TILE_WIDTH) {
425 /* This tile is shown half on the left and half on the right
426 * side of the overview. So we have to draw it in two parts. */
427 put_overview_tile_area(gui_options.overview.map, ptile,
428 overview_x - gui_options.overview.width,
429 overview_y,
430 OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
431 }
432 } else {
433 /* Clip half tile left and right.
434 * See comment in map_to_overview_pos(). */
435 overview_x -= OVERVIEW_TILE_SIZE;
436 }
437 }
438
439 put_overview_tile_area(gui_options.overview.map, ptile,
440 overview_x, overview_y,
441 OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT);
442
443 dirty_overview();
444 } do_in_natural_pos_end;
445}
446
447/************************************************************************/
450 void calculate_overview_dimensions(void)
451{
452 int w, h;
453 int xfact = MAP_IS_ISOMETRIC ? 2 : 1;
454
455 static int recursion = 0; /* Just to be safe. */
456
457 /* Clip half tile left and right. See comment in map_to_overview_pos(). */
458 int shift = (MAP_IS_ISOMETRIC && !current_wrap_has_flag(WRAP_X)) ? -1 : 0;
459
460 if (recursion > 0 || MAP_NATIVE_WIDTH <= 0 || MAP_NATIVE_HEIGHT <= 0) {
461 return;
462 }
463 recursion++;
464
465 get_overview_area_dimensions(&w, &h);
466 get_overview_area_dimensions(&w, &h);
467
468 /* Set the scale of the overview map. This attempts to limit the
469 * overview to the size of the area available.
470 *
471 * It rounds up since this gives good results with the default settings.
472 * It may need tweaking if the panel resizes itself. */
473 OVERVIEW_TILE_SIZE = MIN((w - 1) / (MAP_NATIVE_WIDTH * xfact) + 1,
474 (h - 1) / MAP_NATIVE_HEIGHT + 1);
475 OVERVIEW_TILE_SIZE = MAX(OVERVIEW_TILE_SIZE, 1);
476
477 log_debug("Map size %d,%d - area size %d,%d - scale: %d", MAP_NATIVE_WIDTH,
478 MAP_NATIVE_HEIGHT, w, h, OVERVIEW_TILE_SIZE);
479
480 gui_options.overview.width
481 = OVERVIEW_TILE_WIDTH * MAP_NATIVE_WIDTH + shift * OVERVIEW_TILE_SIZE;
482 gui_options.overview.height = OVERVIEW_TILE_HEIGHT * MAP_NATIVE_HEIGHT;
483
484 if (gui_options.overview.map) {
485 canvas_free(gui_options.overview.map);
486 canvas_free(gui_options.overview.window);
487 }
488 gui_options.overview.map = canvas_create(gui_options.overview.width,
489 gui_options.overview.height);
490 gui_options.overview.window = canvas_create(gui_options.overview.width,
491 gui_options.overview.height);
492 canvas_put_rectangle(gui_options.overview.map,
493 get_color(tileset, COLOR_OVERVIEW_UNKNOWN),
494 0, 0,
495 gui_options.overview.width, gui_options.overview.height);
496 update_map_canvas_scrollbars_size();
497
498 /* Call gui specific function. */
499 overview_size_changed();
500
501 if (can_client_change_view()) {
502 refresh_overview_canvas();
503 }
504
505 recursion--;
506}
507
508/************************************************************************/
511 void overview_free(void)
512{
513 if (gui_options.overview.map) {
514 canvas_free(gui_options.overview.map);
515 canvas_free(gui_options.overview.window);
516 gui_options.overview.map = NULL;
517 gui_options.overview.window = NULL;
518 }
519}
520
521/************************************************************************/
524 void overview_redraw_callback(struct option *option)
525{
526 /* This is called once for each option changed so it is slower than
527 * necessary. If this becomes a problem it could be switched to use a
528 * queue system like the mapview drawing code does. */
529 refresh_overview_canvas();
530}
canvas_put_rectangle
struct canvas int int int int struct sprite *sprite canvas_put_rectangle
Definition canvas_g.h:55
canvas_put_line
struct canvas int int int int struct sprite *sprite struct canvas struct color int int int int height canvas_put_line
Definition canvas_g.h:62
canvas_put_sprite
canvas_put_sprite
Definition canvas_g.h:42
pcanvas
struct canvas * pcanvas
Definition canvas_g.h:42
LINE_NORMAL
@ LINE_NORMAL
Definition canvas_g.h:26
city_owner
#define city_owner(_pcity_)
Definition city.h:563
client
struct civclient client
Definition client_main.c:150
can_client_change_view
bool can_client_change_view(void)
Definition client_main.c:1312
client_main.h
client_tile_get_known
enum known_type client_tile_get_known(const struct tile *ptile)
Definition climap.c:36
climap.h
get_player_color
struct color * get_player_color(const struct tileset *t, const struct player *pplayer)
Definition colors_common.c:125
get_color
struct color * get_color(const struct tileset *t, enum color_std stdcolor)
Definition colors_common.c:100
get_terrain_color
struct color * get_terrain_color(const struct tileset *t, const struct terrain *pterrain)
Definition colors_common.c:137
incite_cost
char * incite_cost
Definition comments.c:74
find_visible_unit
struct unit * find_visible_unit(struct tile *ptile)
Definition control.c:804
control.h
punit
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:74
wld
struct world wld
Definition game.c:63
canvas_free
void canvas_free(struct canvas *store)
Definition canvas.c:44
canvas_copy
void canvas_copy(struct canvas *dest, struct canvas *src, int src_x, int src_y, int dest_x, int dest_y, int width, int height)
Definition canvas.c:76
canvas_create
struct canvas * canvas_create(int width, int height)
Definition canvas.c:28
owner
struct city * owner
Definition citydlg.c:220
update_map_canvas_scrollbars_size
void update_map_canvas_scrollbars_size(void)
Definition mapview.c:696
get_overview_area_dimensions
void get_overview_area_dimensions(int *width, int *height)
Definition mapview.c:317
update_overview_scroll_window_pos
void update_overview_scroll_window_pos(int x, int y)
Definition mapview.c:657
overview_size_changed
void overview_size_changed(void)
Definition mapview.c:326
get_overview_window
struct canvas * get_overview_window(void)
Definition mapview.c:337
log.h
fc_assert
#define fc_assert(condition)
Definition log.h:176
log_debug
#define log_debug(message,...)
Definition log.h:115
normalize_map_pos
bool normalize_map_pos(const struct civ_map *nmap, int *x, int *y)
Definition map.c:991
NATURAL_TO_MAP_POS
#define NATURAL_TO_MAP_POS(pmap_x, pmap_y, nat_x, nat_y)
Definition map.h:171
do_in_natural_pos
#define do_in_natural_pos(ntl_x, ntl_y, map_x, map_y)
Definition map.h:203
MAP_TO_NATURAL_POS
#define MAP_TO_NATURAL_POS(pnat_x, pnat_y, map_x, map_y)
Definition map.h:177
whole_map_iterate
#define whole_map_iterate(_map, _tile)
Definition map.h:531
current_wrap_has_flag
#define current_wrap_has_flag(flag)
Definition map.h:46
do_in_natural_pos_end
#define do_in_natural_pos_end
Definition map.h:210
whole_map_iterate_end
#define whole_map_iterate_end
Definition map.h:540
index_to_map_pos
#define index_to_map_pos(pmap_x, pmap_y, mindex)
Definition map.h:218
mapview
struct view mapview
Definition mapview_common.c:75
mapview_g.h
H
#define H(x, y, z)
Definition md5.c:92
gui_options
struct client_options gui_options
Definition options.c:71
options.h
OLAYER_BORDERS
@ OLAYER_BORDERS
Definition options.h:83
OLAYER_BACKGROUND
@ OLAYER_BACKGROUND
Definition options.h:81
OLAYER_CITIES
@ OLAYER_CITIES
Definition options.h:86
OLAYER_BORDERS_ON_OCEAN
@ OLAYER_BORDERS_ON_OCEAN
Definition options.h:84
OLAYER_UNITS
@ OLAYER_UNITS
Definition options.h:85
OLAYER_RELIEF
@ OLAYER_RELIEF
Definition options.h:82
wrap_double
static double wrap_double(double value, double wrap)
Definition overview_common.c:273
gui_to_overview_pos
static void gui_to_overview_pos(const struct tileset *t, int *ovr_x, int *ovr_y, int gui_x, int gui_y)
Definition overview_common.c:84
flush_dirty_overview
void flush_dirty_overview(void)
Definition overview_common.c:261
overview_to_map_pos
void overview_to_map_pos(int *map_x, int *map_y, int overview_x, int overview_y)
Definition overview_common.c:358
gui_to_natural_pos
static void gui_to_natural_pos(const struct tileset *t, double *ntl_x, double *ntl_y, int gui_x, int gui_y)
Definition overview_common.c:56
overview_redraw_callback
void overview_redraw_callback(struct option *option)
Definition overview_common.c:524
refresh_overview_canvas
void refresh_overview_canvas(void)
Definition overview_common.c:377
overview_dirty
static bool overview_dirty
Definition overview_common.c:49
center_tile_overviewcanvas
void center_tile_overviewcanvas(void)
Definition overview_common.c:287
refresh_overview_from_canvas
void refresh_overview_from_canvas(void)
Definition overview_common.c:185
redraw_overview
static void redraw_overview(void)
Definition overview_common.c:201
overview_tile_color
static struct color * overview_tile_color(struct tile *ptile)
Definition overview_common.c:118
overview_update_tile
void overview_update_tile(struct tile *ptile)
Definition overview_common.c:411
OVERVIEW_TILE_SIZE
int OVERVIEW_TILE_SIZE
Definition overview_common.c:33
put_overview_tile_area
static void put_overview_tile_area(struct canvas *pcanvas, struct tile *ptile, int x, int y, int w, int h)
Definition overview_common.c:394
calculate_overview_dimensions
void calculate_overview_dimensions(void)
Definition overview_common.c:450
overview_free
void overview_free(void)
Definition overview_common.c:511
dirty_overview
static void dirty_overview(void)
Definition overview_common.c:253
map_to_overview_pos
void map_to_overview_pos(int *overview_x, int *overview_y, int map_x, int map_y)
Definition overview_common.c:324
overview_common.h
OVERVIEW_TILE_WIDTH
#define OVERVIEW_TILE_WIDTH
Definition overview_common.h:32
OVERVIEW_TILE_HEIGHT
#define OVERVIEW_TILE_HEIGHT
Definition overview_common.h:33
pplayers_allied
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1409
FC_WRAP
#define FC_WRAP(value, range)
Definition shared.h:65
MIN
#define MIN(x, y)
Definition shared.h:55
MAX
#define MAX(x, y)
Definition shared.h:54
y
struct sprite int int y
Definition sprite_g.h:31
x
struct sprite int x
Definition sprite_g.h:31
recursion
static int recursion[AIT_LAST]
Definition srv_log.c:45
canvas
Definition canvas.h:22
city
Definition city.h:320
civclient::conn
struct connection conn
Definition client_main.h:96
client_options::overview
struct overview overview
Definition options.h:463
color
Definition colors.h:21
connection::playing
struct player * playing
Definition connection.h:151
option
Definition options.c:514
overview
Definition options.h:91
overview::map_y0
double map_y0
Definition options.h:93
overview::map_x0
double map_x0
Definition options.h:93
overview::fog
bool fog
Definition options.h:102
overview::layers
bool layers[OLAYER_COUNT]
Definition options.h:103
overview::map
struct canvas * map
Definition options.h:97
overview::width
int width
Definition options.h:94
overview::window
struct canvas * window
Definition options.h:100
overview::height
int height
Definition options.h:94
player
Definition player.h:249
tile
Definition tile.h:50
tileset
Definition tilespec.c:481
unit
Definition unit.h:140
view::height
int height
Definition mapview_common.h:38
view::gui_x0
float gui_x0
Definition mapview_common.h:37
view::gui_y0
float gui_y0
Definition mapview_common.h:37
view::width
int width
Definition mapview_common.h:38
world::map
struct civ_map map
Definition world_object.h:38
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
T_UNKNOWN
#define T_UNKNOWN
Definition terrain.h:62
is_ocean_tile
#define is_ocean_tile(ptile)
Definition terrain.h:196
terrain_has_flag
#define terrain_has_flag(terr, flag)
Definition terrain.h:176
tile_city
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
tile_index
#define tile_index(_pt_)
Definition tile.h:89
TILE_KNOWN_UNSEEN
@ TILE_KNOWN_UNSEEN
Definition tile.h:37
tile_terrain
#define tile_terrain(_tile)
Definition tile.h:111
tile_owner
#define tile_owner(_tile)
Definition tile.h:97
get_basic_fog_sprite
struct sprite * get_basic_fog_sprite(const struct tileset *t)
Definition tilespec.c:7071
tileset_is_isometric
bool tileset_is_isometric(const struct tileset *t)
Definition tilespec.c:712
tileset_tile_height
int tileset_tile_height(const struct tileset *t)
Definition tilespec.c:765
tileset_tile_width
int tileset_tile_width(const struct tileset *t)
Definition tilespec.c:753
unit_owner
#define unit_owner(_pu)
Definition unit.h:396
MAP_NATIVE_WIDTH
#define MAP_NATIVE_WIDTH
Definition world_object.h:55
MAP_IS_ISOMETRIC
#define MAP_IS_ISOMETRIC
Definition world_object.h:46
MAP_NATURAL_HEIGHT
#define MAP_NATURAL_HEIGHT
Definition world_object.h:60
MAP_NATURAL_WIDTH
#define MAP_NATURAL_WIDTH
Definition world_object.h:59
MAP_NATIVE_HEIGHT
#define MAP_NATIVE_HEIGHT
Definition world_object.h:56
map_zoom
float map_zoom
Definition zoom.c:25
zoom.h