62#define SPECHASH_TAG gotoline
63#define SPECHASH_IKEY_TYPE struct tile *
64#define SPECHASH_IDATA_TYPE struct gotoline_counter *
65#define SPECHASH_IDATA_FREE gotoline_counter_destroy
67#define gotoline_hash_iterate(hash, ptile, pglc) \
68 TYPED_HASH_ITERATE(struct tile *, struct gotoline_counter *, \
70#define gotoline_hash_iterate_end HASH_ITERATE_END
87 const int canvas_x0,
const int canvas_y0,
169#define SPECLIST_TAG animation
170#define SPECLIST_TYPE struct animation
190 size_t last = animation_list_size(
animations);
192 for (i = 0; i < last; i++) {
195 switch (anim->
type) {
237 float start_x, start_y;
240 double mytime =
MIN(time_gone, timing_sec);
252 if (anim->
old_x >= 0) {
261 if (time_gone >= timing_sec) {
279 double time_per_step;
285 if (time_gone >= timing_sec) {
295 step = time_gone / time_per_step;
351 int frame = time_gone / time_per_frame;
357 if (anim->
old_x >= 0) {
362 spr = *sprite_vector_get(anim->
expl.
sprites, frame);
378 if (time_gone >= timing_sec) {
416 if (time_gone > 1.0) {
437 if (anim->
old_x >= 0) {
452 switch (anim->
type) {
495 bool full_refresh,
bool write_to_screen)
502 if (write_to_screen) {
511 bool full_refresh,
bool write_to_screen)
520 if (write_to_screen) {
532 bool full_refresh,
bool write_to_screen)
539 if (write_to_screen) {
554 float *gui_dx,
float *gui_dy,
int map_dx,
int map_dy)
583 float *gui_x,
float *gui_y,
int map_x,
int map_y)
598 int *map_x,
int *map_y,
float gui_x,
float gui_y)
603 if (HH > 0 || HW > 0) {
608 int xmult, ymult, mod, compar;
612 x =
DIVIDE((
int)gui_x, (
int)W);
613 y =
DIVIDE((
int)gui_y, (
int)
H);
618 xmult = (dx >= W / 2) ? -1 : 1;
619 ymult = (dy >=
H / 2) ? -1 : 1;
620 dx = (dx >= W / 2) ? (W - 1 - dx) : dx;
621 dy = (dy >=
H / 2) ? (
H - 1 - dy) : dy;
625 compar = (dx - HW / 2) * (
H / 2) - (
H / 2 - 1 - dy) * (W / 2 - HW);
627 compar = (dy - HH / 2) * (W / 2) - (W / 2 - 1 - dx) * (
H / 2 - HH);
629 mod = (compar < 0) ? -1 : 0;
631 *map_x = (x + y) + mod * (xmult + ymult) / 2;
632 *map_y = (y - x) + mod * (ymult - xmult) / 2;
662 *map_x =
DIVIDE((
int)(gui_x *
H + gui_y * W), (
int)(W *
H));
663 *map_y =
DIVIDE((
int)(gui_y * W - gui_x *
H), (
int)(W *
H));
667 *map_x =
DIVIDE((
int)gui_x, (
int)W);
668 *map_y =
DIVIDE((
int)gui_y, (
int)
H);
695 const struct tile *ptile)
697 int center_map_x, center_map_y, dx, dy, tile_x, tile_y;
782 float *gui_x,
float *gui_y)
784 int map_x, map_y,
nat_x,
nat_y, diff_x, diff_y;
785 float gui_x0, gui_y0;
791 diff_x = *gui_x - gui_x0;
792 diff_y = *gui_y - gui_y0;
818 float *gui_dx,
float *gui_dy,
819 float gui_x0,
float gui_y0,
820 float gui_x1,
float gui_y1)
822 int map_x0, map_y0, map_x1, map_y1;
823 float gui_x0_base, gui_y0_base, gui_x1_base, gui_y1_base;
824 int gui_x0_diff, gui_y0_diff, gui_x1_diff, gui_y1_diff;
838 map_to_gui_pos(t, zoom, &gui_x0_base, &gui_y0_base, map_x0, map_y0);
839 map_to_gui_pos(t, zoom, &gui_x1_base, &gui_y1_base, map_x1, map_y1);
841 gui_x0_diff = gui_x0 - gui_x0_base;
842 gui_y0_diff = gui_y0 - gui_y0_base;
843 gui_x1_diff = gui_x1 - gui_x1_base;
844 gui_y1_diff = gui_y1 - gui_y1_base;
853 *gui_dx += gui_x1_diff - gui_x0_diff;
854 *gui_dy += gui_y1_diff - gui_y0_diff;
863 float old_gui_x0, old_gui_y0;
866 int common_x0, common_x1, common_y0, common_y1;
867 int update_x0, update_x1, update_y0, update_y1;
882 old_gui_x0 = gui_x0 - dx;
883 old_gui_y0 = gui_y0 - dy;
891 common_x0 =
MAX(old_gui_x0, gui_x0);
892 common_x1 =
MIN(old_gui_x0, gui_x0) +
width;
893 common_y0 =
MAX(old_gui_y0, gui_y0);
894 common_y1 =
MIN(old_gui_y0, gui_y0) +
height;
897 && common_x1 > common_x0 && common_y1 > common_y0) {
903 if (old_gui_x0 < gui_x0) {
904 update_x0 =
MAX(old_gui_x0 +
width, gui_x0);
905 update_x1 = gui_x0 +
width;
908 update_x1 =
MIN(old_gui_x0, gui_x0 +
width);
910 if (old_gui_y0 < gui_y0) {
911 update_y0 =
MAX(old_gui_y0 +
height, gui_y0);
912 update_y1 = gui_y0 +
height;
915 update_y1 =
MIN(old_gui_y0, gui_y0 +
height);
920 common_x0 - old_gui_x0,
921 common_y0 - old_gui_y0,
922 common_x0 - gui_x0, common_y0 - gui_y0,
923 common_x1 - common_x0, common_y1 - common_y0);
927 if (update_y1 > update_y0) {
929 width, update_y1 - update_y0);
931 if (update_x1 > update_x0) {
933 update_x1 - update_x0, common_y1 - common_y0);
964 float xmin, ymin, xmax, ymax;
975 *gui_x0 =
CLIP(xmin, *gui_x0, xmax - xsize);
979 *gui_y0 =
CLIP(ymin, *gui_y0, ymax - ysize);
1004 float diff_x, diff_y;
1018 static double total_frames = 0.01;
1019 static double total_time = 0.0001;
1022 &diff_x, &diff_y, start_x, start_y, gui_x0, gui_y0);
1037 currtime += total_time / total_frames;
1039 mytime =
MIN(currtime, timing_sec);
1041 start_y + diff_y * (mytime / timing_sec),
1046 }
while (currtime < timing_sec);
1049 total_frames += frames;
1050 total_time += currtime;
1051 log_debug(
"Got %d frames in %f seconds: %f FPS (avg %f).",
1052 frames, currtime, (
double)frames / currtime,
1053 total_frames / total_time);
1058 total_frames *= 0.99;
1094 float *xmax,
float *ymax,
1095 int *xsize,
int *ysize)
1133 float gui_x1, gui_y1, gui_x2, gui_y2, gui_x3, gui_y3, gui_x4, gui_y4;
1157 diff = *xsize - (*xmax - *xmin);
1160 *xmax += (diff + 1) / 2;
1163 diff = *ysize - (*ymax - *ymin);
1166 *ymax += (diff + 1) / 2;
1169 log_debug(
"x: %f<-%d->%f; y: %f<-%f->%d",
1170 *xmin, *xsize, *xmax, *ymin, *ymax, *ysize);
1202 int gui_x0 = scroll_x, gui_y0 = scroll_y;
1226 static bool first =
TRUE;
1251 float dummy_x, dummy_y;
1270 float xmin, ymin, xmax, ymax;
1271 int xsize, ysize, scroll_x, scroll_y;
1320 for (i = 0; i < count; i++) {
1326 if (
fog && pdrawn[i].foggable) {
1350 enum mapview_layer layer,
1351 const struct tile *ptile,
1356 const struct city *citymode,
1361 ptile, pedge, pcorner,
1362 punit, pcity, citymode, putype);
1409 NULL, NULL, NULL, NULL, pcity,
1468#define NUM_CITY_COLORS tileset_num_city_colors(tileset)
1563 const struct city *citymode)
1574 if (anim != NULL &&
punit != NULL
1596 const struct tile *ptile2,
1601 if (!ptile1 || !ptile2 || !
lines) {
1626 const struct tile *ptile2,
1627 enum color_std
color)
1633 if (!ptile1 || !ptile2) {
1646 const struct tile *tmp;
1653 for (i = 0; i < line_count; i++) {
1673 if (pcity_dest != NULL) {
1675 COLOR_MAPVIEW_TRADE_ROUTE_LINE);
1752 log_debug(
"update_map_canvas(pos=(%d,%d), size=(%d,%d))",
1777 if (layer == LAYER_TILELABEL) {
1780 if (layer == LAYER_CITYBAR) {
1787 ptile, pedge, pcorner, gui_x, gui_y,
map_zoom) {
1794 NULL, NULL, cx, cy, NULL, NULL);
1795 }
else if (pcorner) {
1797 NULL, NULL, cx, cy, NULL, NULL);
1881 const int canvas_x0,
const int canvas_y0,
1885 static char name[512], growth[32], prod[512],
size[32], trade_routes[32];
1886 enum color_std growth_color;
1887 enum color_std production_color;
1893 enum color_std trade_routes_color = COLOR_MAPVIEW_CITYTEXT;
1894 struct color *owner_color;
1897 } name_rect = {0, 0, 0, 0}, growth_rect = {0, 0, 0, 0},
1898 prod_rect = {0, 0, 0, 0}, size_rect = {0, 0, 0, 0},
1899 flag_rect = {0, 0, 0, 0}, occupy_rect = {0, 0, 0, 0},
1900 food_rect = {0, 0, 0, 0}, shield_rect = {0, 0, 0, 0},
1901 trade_routes_rect = {0,}, trade_rect = {0,};
1902 int width1 = 0, width2 = 0, height1 = 0, height2 = 0;
1905 struct sprite *occupy = NULL;
1906 int bg_w, bg_h, x, y;
1909 const int border = 6;
1914 const bool can_see_inside
1916 const bool should_draw_productions
1919 const bool should_draw_trade_routes = can_see_inside
1921 const bool should_draw_lower_bar
1922 = should_draw_productions || should_draw_growth
1923 || should_draw_trade_routes;
1939 growth,
sizeof(growth),
1940 &growth_color, &production_color);
1949 int count = unit_list_size(pcity->
tile->
units);
1966 width1 = (flag_rect.w + occupy_rect.w + name_rect.w
1967 + 2 * border + size_rect.w);
1968 height1 =
MAX(flag_rect.h,
1970 MAX(name_rect.h + border,
1971 size_rect.h + border)));
1974 if (should_draw_lower_bar) {
1978 if (should_draw_productions) {
1984 width2 += shield_rect.w + prod_rect.w + border;
1985 height2 =
MAX(height2, shield_rect.h);
1986 height2 =
MAX(height2, prod_rect.h + border);
1989 if (should_draw_growth) {
1993 width2 += food_rect.w + growth_rect.w + border;
1994 height2 =
MAX(height2, food_rect.h);
1995 height2 =
MAX(height2, growth_rect.h + border);
1998 if (should_draw_trade_routes) {
2000 sizeof(trade_routes),
2001 &trade_routes_color);
2006 width2 += trade_rect.w + trade_routes_rect.w + border;
2007 height2 =
MAX(height2, trade_rect.h);
2008 height2 =
MAX(height2, trade_routes_rect.h + border);
2013 *
height = height1 + height2;
2019 flag_rect.y =
canvas_y + (height1 - flag_rect.h) / 2;
2021 occupy_rect.x = flag_rect.x + flag_rect.w;
2022 occupy_rect.y =
canvas_y + (height1 - occupy_rect.h) / 2;
2024 name_rect.x =
canvas_x + (flag_rect.w + occupy_rect.w
2025 - name_rect.w - size_rect.w - border) / 2;
2026 name_rect.y =
canvas_y + (height1 - name_rect.h) / 2;
2028 size_rect.x =
canvas_x + (*
width + 1) / 2 - size_rect.w - border / 2;
2029 size_rect.y =
canvas_y + (height1 - size_rect.h) / 2;
2032 if (should_draw_lower_bar) {
2033 if (should_draw_productions) {
2035 shield_rect.y =
canvas_y + height1 + (height2 - shield_rect.h) / 2;
2037 prod_rect.x = shield_rect.x + shield_rect.w + border / 2;
2038 prod_rect.y =
canvas_y + height1 + (height2 - prod_rect.h) / 2;
2041 if (should_draw_trade_routes) {
2043 - trade_routes_rect.w - border / 2;
2044 trade_routes_rect.y =
canvas_y + height1
2045 + (height2 - trade_routes_rect.h) / 2;
2047 trade_rect.x = trade_routes_rect.x - border / 2 - trade_rect.w;
2048 trade_rect.y =
canvas_y + height1 + (height2 - trade_rect.h) / 2;
2051 if (should_draw_growth) {
2053 - growth_rect.w - border / 2;
2054 if (trade_routes_rect.w > 0) {
2055 growth_rect.x = growth_rect.x
2056 - trade_routes_rect.w - border / 2 - trade_rect.w - border / 2;
2058 growth_rect.y =
canvas_y + height1 + (height2 - growth_rect.h) / 2;
2060 food_rect.x = growth_rect.x - border / 2 - food_rect.w;
2061 food_rect.y =
canvas_y + height1 + (height2 - food_rect.h) / 2;
2069 for (x = 0; x < *
width; x += bg_w) {
2070 for (y = 0; y < *
height; y += bg_h) {
2089 (flag_rect.x + flag_rect.w) - 1,
2099 (size_rect.x - border / 2) /
map_zoom,
2106 struct color *textcolors[2] = {
2118 if (should_draw_lower_bar) {
2120 if (should_draw_productions) {
2129 if (should_draw_trade_routes) {
2139 if (should_draw_growth) {
2187 static char name[512], growth[32], prod[512], trade_routes[32];
2188 enum color_std growth_color;
2189 enum color_std production_color;
2195 enum color_std trade_routes_color = COLOR_MAPVIEW_CITYTEXT;
2198 } name_rect = {0, 0, 0, 0}, growth_rect = {0, 0, 0, 0},
2199 prod_rect = {0, 0, 0, 0}, trade_routes_rect = {0,};
2200 int total_width, total_height;
2201 int spacer_width = 0;
2211 growth,
sizeof(growth), &growth_color,
2225 total_width += name_rect.w;
2226 total_height =
MAX(total_height, name_rect.h);
2230 total_width += spacer_width + growth_rect.w;
2231 total_height =
MAX(total_height, growth_rect.h);
2236 sizeof(trade_routes),
2237 &trade_routes_color);
2240 total_width += spacer_width + trade_routes_rect.w;
2241 total_height =
MAX(total_height, trade_routes_rect.h);
2245 drawposx -= total_width / 2;
2249 drawposx += name_rect.w;
2252 drawposx += spacer_width;
2257 drawposx += growth_rect.w;
2261 drawposx += spacer_width;
2271 *
height += total_height + 3;
2278 total_width = prod_rect.w;
2279 total_height = prod_rect.h;
2329#define COLOR_MAPVIEW_TILELABEL COLOR_MAPVIEW_CITYTEXT
2339#undef COLOR_MAPVIEW_TILELABEL
2346 int width_base,
int height_base)
2384 width_base + dx, height_base + dy -
offset_y,
2385 ptile, pedge, pcorner, gui_x, gui_y,
map_zoom) {
2405 new_max_width =
MAX(
width, new_max_width);
2406 new_max_height =
MAX(
height, new_max_height);
2420 int width_base,
int height_base)
2428 width_base + dx, height_base + dy,
2429 ptile, pedge, pcorner, gui_x, gui_y,
map_zoom) {
2433 if (ptile && ptile->label != NULL) {
2438 log_debug(
"Drawing label %s.", ptile->label);
2445 log_debug(
"Re-queuing tile label %s drawing.", ptile->label);
2448 new_max_width =
MAX(
width, new_max_width);
2449 new_max_height =
MAX(
height, new_max_height);
2479 if (ptile == NULL) {
2482 log_warn(
"Unit orders with illegal tile.");
2488 switch (
order->order) {
2547 struct unit *punit1,
int hp1)
2549 struct unit *losing_unit = (hp0 == 0 ? punit0 : punit1);
2557 punit0->
hp =
MAX(punit0->
hp, hp0);
2558 punit1->
hp =
MAX(punit1->
hp, hp1);
2564 struct unit *winning_unit;
2569 if (losing_unit == punit1) {
2570 winning_unit = punit0;
2571 winner_end_hp = hp0;
2573 winning_unit = punit1;
2574 winner_end_hp = hp1;
2600 anim->
id = winning_unit->
id;
2609 const int num_tiles_explode_unit = sprite_vector_size(anim);
2611 while (punit0->
hp > hp0 || punit1->
hp > hp1) {
2612 const int diff0 = punit0->
hp - hp0, diff1 = punit1->
hp - hp1;
2617 if (
fc_rand(diff0 + diff1) < diff0) {
2632 if (num_tiles_explode_unit > 0
2642 for (i = 0; i < num_tiles_explode_unit; i++) {
2685 struct tile *src_tile,
int dx,
int dy)
2687 struct tile *dest_tile;
2688 int dest_x, dest_y, src_x, src_y;
2695 if (dx < -1 || dx > 1 || dy < -1 || dy > 1 || (dx == 0 && dy == 0)) {
2700 dest_x = src_x + dx;
2701 dest_y = src_y + dy;
2709 float start_x, start_y;
2710 float canvas_dx, canvas_dy;
2757 mytime =
MIN(asecs, timing_sec);
2759 new_x = start_x +
canvas_dx * (mytime / timing_sec);
2760 new_y = start_y +
canvas_dy * (mytime / timing_sec);
2762 if (new_x != prev_x || new_y != prev_y) {
2765 new_x, new_y, new_x, new_y,
2778 new_x, new_y, new_x, new_y,
2787 }
while (mytime < timing_sec);
2807 struct city *closest_city;
2809 struct unit *closest_settler = NULL, *best_settler = NULL;
2818 if (pcity && pcity->
tile) {
2830 closest_city = NULL;
2849 if (!closest_city) {
2850 closest_city = pcity;
2856 if (closest_city || !
punit) {
2857 return closest_city;
2869 if (closest_settler == NULL) {
2870 closest_settler = psettler;
2872 if (best_settler == NULL && psettler->client.colored) {
2873 best_settler = psettler;
2879 if (best_settler != NULL) {
2881 *
punit = best_settler;
2882 }
else if (closest_settler != NULL) {
2884 *
punit = closest_settler;
2907 char *buffer,
int buffer_len)
2909 if (!pcity || !buffer || buffer_len < 1) {
2925 char *buffer,
size_t buffer_len)
2951 char *trade_routes_buffer,
2952 size_t trade_routes_buffer_len,
2955 int num_trade_routes;
2958 if (!trade_routes_buffer || trade_routes_buffer_len <= 0) {
2963 trade_routes_buffer[0] =
'\0';
2965 *
pcolor = COLOR_MAPVIEW_CITYTEXT;
2970 num_trade_routes = trade_route_list_size(pcity->
routes);
2973 fc_snprintf(trade_routes_buffer, trade_routes_buffer_len,
2974 "%d/%d", num_trade_routes, max_routes);
2977 if (num_trade_routes == max_routes) {
2978 *
pcolor = COLOR_MAPVIEW_TRADE_ROUTES_ALL_BUILT;
2979 }
else if (num_trade_routes == 0) {
2980 *
pcolor = COLOR_MAPVIEW_TRADE_ROUTES_NO_BUILT;
2982 *
pcolor = COLOR_MAPVIEW_TRADE_ROUTES_SOME_BUILT;
3095 {-W / 2, -
H / 2, 2 * W, 2 *
H},
3096 {(W - UW) / 2,
H - UH, UW, UH},
3098 {-(city_width - W) / 2, -(city_height -
H) / 2, city_width, city_height},
3111 log_debug(
"unqueue_mapview_update: needed_updates=%d",
3133 int max_x = 0, max_y = 0;
3136 if (my_tile_updates[i]) {
3145 xr = xl + area[i].w;
3146 yb = yt + area[i].h;
3150 min_x =
MIN(min_x, xl);
3151 min_y =
MIN(min_y, yt);
3152 max_x =
MAX(max_x, xr);
3153 max_y =
MAX(max_y, yb);
3164 if (min_x < max_x && min_y < max_y) {
3171 if (my_tile_updates[i]) {
3172 tile_list_destroy(my_tile_updates[i]);
3177 if (write_to_screen) {
3189 size_t name_buffer_len,
3190 char *growth_buffer,
3191 size_t growth_buffer_len,
3192 enum color_std *growth_color,
3193 enum color_std *production_color)
3197 *production_color = COLOR_MAPVIEW_CITYTEXT;
3203 fc_snprintf(growth_buffer, growth_buffer_len,
"X");
3205 fc_snprintf(growth_buffer, growth_buffer_len,
"-");
3209 fc_snprintf(growth_buffer, growth_buffer_len,
"%d", abs(turns));
3214 *growth_color = COLOR_MAPVIEW_CITYGROWTH_BLOCKED;
3216 *growth_color = COLOR_MAPVIEW_CITYTEXT;
3220 *production_color = COLOR_MAPVIEW_CITYPROD_NEGATIVE;
3223 growth_buffer[0] =
'\0';
3224 *growth_color = COLOR_MAPVIEW_CITYTEXT;
3343 bool changed =
FALSE;
3448 const struct tile *ptile_dest;
3452 || !(dir <= direction8_max())) {
3480 enum direction8 dir)
3483 bool changed =
FALSE;
3486 || !(dir <= direction8_max())) {
3504 if (ptile != NULL) {
3518 const struct tile *ptile;
3551 enum direction8 dir)
3555 if (!ptile || !(dir <= direction8_max())
3580 if (pglc->line_count[dir] > 0) {
3604 bool tile_size_changed, size_changed, redrawn =
FALSE;
3619 tile_size_changed = (tile_width != old_tile_width
3620 || tile_height != old_tile_height);
3621 size_changed = (
width != old_width ||
height != old_height);
3624 if (tile_size_changed) {
3642 if (tile_size_changed) {
3716 const struct player *pplayer)
3729 0, 0, w * 7, h * 7);
3732 const int j = i / 3;
3733 const int k = i % 3;
3750 const int j = i / 2;
3751 const int k = i % 2;
3753 if ((k == 0 && j >= ship->
fuel)
3793#define SPECLIST_TAG link_mark
3794#define SPECLIST_TYPE struct link_mark
3796#define link_marks_iterate(pmark) \
3797 TYPED_LIST_ITERATE(struct link_mark, link_marks, pmark)
3798#define link_marks_iterate_end LIST_ITERATE_END
3808 if (pmark->type ==
type && pmark->id ==
id) {
3844 switch (pmark->
type) {
3848 return pcity ? pcity->
tile : NULL;
3866 switch (pmark->
type) {
3887 int x_left, x_right, y_top, y_bottom;
3965 if (--pmark->turn_counter <= 0) {
4022 int tileset_topology;
4026 tileset_topology = TF_HEX | TF_ISO;
4029 tileset_topology = TF_HEX;
4031 tileset_topology = TF_ISO;
4033 tileset_topology = 0;
4036 if (tset_topo != NULL) {
4037 *tset_topo = tileset_topology;
4040 if (tileset_topology & TF_HEX) {
4041 if ((topology_id & (TF_HEX | TF_ISO)) == tileset_topology) {
4049 if (topology_id & TF_HEX) {
4053 if ((topology_id & TF_ISO) != (tileset_topology & TF_ISO)) {
4066 if (topo & TF_ISO) {
4067 if (topo & TF_HEX) {
4068 return _(
"ISO|Hex");
4072 if (topo & TF_HEX) {
4076 return _(
"Overhead");
4104 if (old_tile != NULL) {
4107 if (ptile != NULL) {
#define BV_ISSET(bv, bit)
struct canvas int int struct sprite int int int int height
struct canvas int int struct sprite bool int int fog_y struct canvas struct sprite struct color * pcolor
struct canvas int int canvas_y
struct canvas int canvas_x
struct canvas int int struct sprite bool int int fog_y struct canvas struct sprite struct color int int canvas_y struct canvas struct color enum line_type ltype int start_x int start_y int dx int dy enum client_font
struct canvas int int struct sprite int int int width
struct canvas int int struct sprite int int offset_y
struct canvas int int struct sprite int offset_x
struct canvas int int struct sprite bool fog
const char * city_name_get(const struct city *pcity)
bool city_production_has_flag(const struct city *pcity, enum impr_flag_id flag)
int city_production_turns_to_build(const struct city *pcity, bool include_shield_stock)
bool city_can_be_built_here(const struct civ_map *nmap, const struct tile *ptile, const struct unit *punit, bool hut_test)
int rs_max_city_radius_sq(void)
int city_turns_to_grow(const struct city *pcity)
#define cities_iterate_end
#define city_list_iterate(citylist, pcity)
#define city_tile(_pcity_)
#define cities_iterate(pcity)
static citizens city_size_get(const struct city *pcity)
#define output_type_iterate(output)
#define city_owner(_pcity_)
#define city_list_iterate_end
#define city_tile_iterate(_nmap, _radius_sq, _city_tile, _tile)
#define city_tile_iterate_end
#define output_type_iterate_end
int get_citydlg_canvas_width(void)
bool city_can_buy(const struct city *pcity)
int get_citydlg_canvas_height(void)
bool client_is_global_observer(void)
bool can_client_change_view(void)
enum known_type client_tile_get_known(const struct tile *ptile)
bool client_city_can_work_tile(const struct city *pcity, const struct tile *ptile)
struct color * color_best_contrast(struct color *subject, struct color **candidates, int ncandidates)
struct color * get_player_color(const struct tileset *t, const struct player *pplayer)
struct color * get_color(const struct tileset *t, enum color_std stdcolor)
void set_units_in_combat(struct unit *pattacker, struct unit *pdefender)
enum cursor_hover_state hover_state
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
bool editor_is_active(void)
bool editor_tile_is_selected(const struct tile *ptile)
struct unit * game_unit_by_number(int id)
struct city * game_city_by_number(int id)
void canvas_put_rectangle(struct canvas *pcanvas, struct color *pcolor, int canvas_x, int canvas_y, int width, int height)
void canvas_put_sprite_full(struct canvas *pcanvas, int canvas_x, int canvas_y, struct sprite *sprite)
void canvas_set_zoom(struct canvas *store, float zoom)
void canvas_mapview_init(struct canvas *store)
void get_text_size(int *width, int *height, enum client_font font, const char *text)
void canvas_free(struct canvas *store)
void canvas_put_line(struct canvas *pcanvas, struct color *pcolor, enum line_type ltype, int start_x, int start_y, int dx, int dy)
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)
struct canvas * canvas_create(int width, int height)
void add_idle_callback(void(callback)(void *), void *data)
void create_line_at_mouse_pos(void)
void update_rect_at_mouse_pos(void)
void update_map_canvas_scrollbars_size(void)
void update_map_canvas_scrollbars(void)
void get_sprite_dimensions(struct sprite *sprite, int *width, int *height)
#define fc_assert_ret(condition)
#define log_warn(message,...)
#define fc_assert(condition)
#define log_debug(message,...)
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
struct tile * map_pos_to_tile(const struct civ_map *nmap, int map_x, int map_y)
void base_map_distance_vector(int *dx, int *dy, int x0dv, int y0dv, int x1dv, int y1dv)
struct tile * mapstep(const struct civ_map *nmap, const struct tile *ptile, enum direction8 dir)
struct tile * nearest_real_tile(const struct civ_map *nmap, int x, int y)
bool normalize_map_pos(const struct civ_map *nmap, int *x, int *y)
#define current_topo_has_flag(flag)
#define adjc_dir_iterate(nmap, center_tile, itr_tile, dir_itr)
#define MAP_TO_NATIVE_POS(pnat_x, pnat_y, map_x, map_y)
#define NATIVE_TO_MAP_POS(pmap_x, pmap_y, nat_x, nat_y)
#define adjc_dir_iterate_end
#define adjc_dir_base_iterate(nmap, center_tile, dir_itr)
#define adjc_dir_base_iterate_end
#define index_to_map_pos(pmap_x, pmap_y, mindex)
void mapdeco_set_highlight(const struct tile *ptile, bool highlight)
void link_mark_restore(enum text_link_type type, int id)
void put_nuke_mushroom_pixmaps(struct tile *ptile)
void init_mapcanvas_and_overview(void)
static struct gotoline_counter * gotoline_counter_new(void)
struct city * find_city_or_settler_near_tile(const struct tile *ptile, struct unit **punit)
void put_drawn_sprites(struct canvas *pcanvas, float zoom, int canvas_x, int canvas_y, int count, struct drawn_sprite *pdrawn, bool fog)
void update_map_canvas_visible(void)
bool tile_visible_mapcanvas(struct tile *ptile)
void set_mapview_origin(float gui_x0, float gui_y0, float zoom)
void put_terrain(struct tile *ptile, struct canvas *pcanvas, float zoom, int canvas_x, int canvas_y)
static const int MAX_TRADE_ROUTE_DRAW_LINES
void map_to_gui_vector(const struct tileset *t, float zoom, float *gui_dx, float *gui_dy, int map_dx, int map_dy)
void update_tile_label(struct tile *ptile)
@ TILE_UPDATE_TILE_SINGLE
#define COLOR_MAPVIEW_TILELABEL
#define gotoline_hash_iterate(hash, ptile, pglc)
void mapdeco_set_crosshair(const struct tile *ptile, bool crosshair)
enum topo_comp_lvl tileset_map_topo_compatible(int topology_id, struct tileset *tset, int *tset_topo)
static int max_desc_width
static void link_mark_draw(const struct link_mark *pmark)
static void base_set_mapview_origin(float gui_x0, float gui_y0, float zoom)
static void queue_callback(void *data)
void refresh_city_mapcanvas(struct city *pcity, struct tile *ptile, bool full_refresh, bool write_to_screen)
static void draw_trade_routes(void)
static void draw_trade_routes_for_city(const struct city *pcity_src)
void put_city(struct city *pcity, struct canvas *pcanvas, float zoom, int canvas_x, int canvas_y)
struct tile * get_center_tile_mapcanvas(void)
static struct link_mark * link_mark_new(enum text_link_type type, int id, int turns)
struct tile * canvas_pos_to_tile(float canvas_x, float canvas_y, float zoom)
@ UPDATE_CITY_DESCRIPTIONS
@ UPDATE_MAP_CANVAS_VISIBLE
void put_unit(const struct unit *punit, struct canvas *pcanvas, float zoom, int canvas_x, int canvas_y)
struct city * find_city_near_tile(const struct tile *ptile)
void free_mapcanvas_and_overview(void)
struct gotoline_hash * mapdeco_gotoline_table
static bool movement_animation(struct animation *anim, double time_gone)
void get_mapview_scroll_pos(int *scroll_x, int *scroll_y)
bool mapdeco_is_highlight_set(const struct tile *ptile)
static void put_one_tile(struct canvas *pcanvas, enum mapview_layer layer, struct tile *ptile, int canvas_x, int canvas_y, const struct city *citymode)
void get_mapview_scroll_window(float *xmin, float *ymin, float *xmax, float *ymax, int *xsize, int *ysize)
static void show_small_citybar(struct canvas *pcanvas, int canvas_x, int canvas_y, struct city *pcity, int *width, int *height)
static bool frame_by_frame_animation
void move_unit_map_canvas(struct unit *punit, struct tile *src_tile, int dx, int dy)
static void link_mark_destroy(struct link_mark *pmark)
void mapdeco_set_gotoroute(const struct unit *punit)
void unqueue_mapview_updates(bool write_to_screen)
void get_mapview_scroll_step(int *xstep, int *ystep)
void draw_segment(struct tile *src_tile, enum direction8 dir)
void show_city_descriptions(int canvas_base_x, int canvas_base_y, int width_base, int height_base)
void set_mapview_scroll_pos(int scroll_x, int scroll_y, float zoom)
static void gui_distance_vector(const struct tileset *t, float zoom, float *gui_dx, float *gui_dy, float gui_x0, float gui_y0, float gui_x1, float gui_y1)
void client_infratile_set(struct tile *ptile)
static void queue_add_callback(void)
static void static void show_city_desc(struct canvas *pcanvas, int canvas_x, int canvas_y, struct city *pcity, int *width, int *height) fc__attribute((nonnull(5
void get_city_mapview_trade_routes(struct city *pcity, char *trade_routes_buffer, size_t trade_routes_buffer_len, enum color_std *pcolor)
void put_unittype(const struct unit_type *putype, struct canvas *pcanvas, float zoom, int canvas_x, int canvas_y)
void mapdeco_clear_gotoroutes(void)
bool show_unit_orders(struct unit *punit)
static enum update_type needed_updates
void put_unit_city_overlays(struct unit *punit, struct canvas *pcanvas, int canvas_x, int canvas_y, int *upkeep_cost, int happy_cost)
void put_one_element(struct canvas *pcanvas, float zoom, enum mapview_layer layer, const struct tile *ptile, const struct tile_edge *pedge, const struct tile_corner *pcorner, const struct unit *punit, const struct city *pcity, int canvas_x, int canvas_y, const struct city *citymode, const struct unit_type *putype)
bool mapdeco_is_gotoline_set(const struct tile *ptile, enum direction8 dir)
#define link_marks_iterate(pmark)
static bool nuke_animation(struct animation *anim, double time_gone)
void center_tile_mapcanvas(const struct tile *ptile)
void animations_init(void)
static int max_label_height
static bool battle_animation(struct animation *anim, double time_gone)
void update_animation(void)
void toggle_city_color(struct city *pcity)
struct tile * canvas_pos_to_nearest_tile(float canvas_x, float canvas_y, float zoom)
void mapdeco_add_gotoline(const struct tile *ptile, enum direction8 dir)
void update_map_canvas(int canvas_x, int canvas_y, int width, int height)
static struct color * link_mark_color(const struct link_mark *pmark)
const struct tile * center_tile
void link_marks_decrease_turn_counters(void)
static void normalize_gui_pos(const struct tileset *t, float zoom, float *gui_x, float *gui_y)
#define link_marks_iterate_end
void mapdeco_clear_crosshairs(void)
void get_city_mapview_production(struct city *pcity, char *buffer, size_t buffer_len)
static void base_canvas_to_map_pos(float zoom, int *map_x, int *map_y, float canvas_x, float canvas_y)
void link_marks_draw_all(void)
void update_city_description(struct city *pcity)
void link_marks_init(void)
struct tile * client_infratile(void)
void set_frame_by_frame_animation(void)
void mapdeco_clear_highlights(void)
void link_marks_clear_all(void)
const char * describe_topology(int topo)
static int trade_route_to_canvas_lines(const struct tile *ptile1, const struct tile *ptile2, struct trade_route_line *lines)
static void queue_mapview_update(enum update_type update)
static int max_label_width
struct animation_list * animations
void toggle_unit_color(struct unit *punit)
static struct link_mark * link_mark_find(enum text_link_type type, int id)
void animations_free(void)
struct tile_hash * mapdeco_highlight_table
static struct timer * anim_timer
static void queue_mapview_tile_update(struct tile *ptile, enum tile_update_type type)
static bool callback_queued
static void show_full_citybar(struct canvas *pcanvas, const int canvas_x0, const int canvas_y0, struct city *pcity, int *width, int *height) fc__attribute((nonnull(5
static void map_to_gui_pos(const struct tileset *t, float zoom, float *gui_x, float *gui_y, int map_x, int map_y)
static int max_desc_height
bool map_canvas_resized(int width, int height)
void link_mark_add_new(enum text_link_type type, int id)
void refresh_tile_mapcanvas(struct tile *ptile, bool full_refresh, bool write_to_screen)
static void draw_trade_route_line(const struct tile *ptile1, const struct tile *ptile2, enum color_std color)
void refresh_unit_mapcanvas(struct unit *punit, struct tile *ptile, bool full_refresh, bool write_to_screen)
static bool explosion_animation(struct animation *anim, double time_gone)
struct tile_list * tile_updates[TILE_UPDATE_COUNT]
bool tile_to_canvas_pos(float *canvas_x, float *canvas_y, float zoom, const struct tile *ptile)
static struct link_mark_list * link_marks
void get_spaceship_dimensions(int *width, int *height)
void decrease_unit_hp_smooth(struct unit *punit0, int hp0, struct unit *punit1, int hp1)
static void show_tile_label(struct canvas *pcanvas, int canvas_x, int canvas_y, struct tile *ptile, int *width, int *height)
static void animation_add(struct animation *anim)
void get_city_mapview_name_and_growth(struct city *pcity, char *name_buffer, size_t name_buffer_len, char *growth_buffer, size_t growth_buffer_len, enum color_std *growth_color, enum color_std *production_color)
bool tile_visible_and_not_on_border_mapcanvas(struct tile *ptile)
struct tile_hash * mapdeco_crosshair_table
void put_spaceship(struct canvas *pcanvas, int canvas_x, int canvas_y, const struct player *pplayer)
static struct tile * link_mark_tile(const struct link_mark *pmark)
static void append_city_buycost_string(const struct city *pcity, char *buffer, int buffer_len)
void mapdeco_remove_gotoline(const struct tile *ptile, enum direction8 dir)
#define gotoline_hash_iterate_end
static bool can_do_cached_drawing(void)
bool mapdeco_is_crosshair_set(const struct tile *ptile)
void link_marks_free(void)
void show_tile_labels(int canvas_base_x, int canvas_base_y, int width_base, int height_base)
static bool calc_mapview_origin(float *gui_x0, float *gui_y0, float zoom)
static void gotoline_counter_destroy(struct gotoline_counter *pglc)
static void gui_to_map_pos(const struct tileset *t, float zoom, int *map_x, int *map_y, float gui_x, float gui_y)
#define gui_rect_iterate_coord(GRI_x0, GRI_y0, GRI_width, GRI_height, _t, _e, _c, _x, _y, _zoom)
#define gui_rect_iterate_coord_end
#define gui_rect_iterate_end
#define gui_rect_iterate(GRI_x0, GRI_y0, GRI_width, GRI_height, _t, _e, _c, _zoom)
#define fc_calloc(n, esz)
struct client_options gui_options
void flush_dirty_overview(void)
void refresh_overview_canvas(void)
void center_tile_overviewcanvas(void)
void overview_update_tile(struct tile *ptile)
bool can_player_see_units_in_city(const struct player *pplayer, const struct city *pcity)
const char * universal_name_translation(const struct universal *psource, char *buf, size_t bufsz)
#define CLIP(lower, current, upper)
#define FC_WRAP(value, range)
const struct sship_part_info structurals_info[NUM_SS_STRUCTURALS]
const struct sship_part_info modules_info[NUM_SS_MODULES]
const struct sship_part_info components_info[NUM_SS_COMPONENTS]
#define NUM_SS_COMPONENTS
#define NUM_SS_STRUCTURALS
const struct sprite_vector * sprites
struct tile * winner_tile
struct animation::@216::@221 nuke
struct animation::@216::@219 battle
struct animation::@216::@218 movement
struct unit * virt_winner
struct animation::@216::@220 expl
struct trade_route_list * routes
struct universal production
struct city::@17::@20 client
struct sprite * background
struct sprite_vector occupancy
struct packet_scenario_info scenario
int smooth_center_slide_msec
bool draw_city_productions
int smooth_move_unit_msec
bool draw_city_trade_routes
int smooth_combat_step_msec
int line_count[DIR8_MAGIC_MAX]
bv_spaceship_structure structure
enum spaceship_state state
struct city_list * cities
struct player_spaceship spaceship
struct unit::@80::@82 client
bool can_do_cached_drawing
struct canvas * tmp_store
int fc_snprintf(char *str, size_t n, const char *format,...)
size_t fc_strlcpy(char *dest, const char *src, size_t n)
void fc_usleep(unsigned long usec)
int cat_snprintf(char *str, size_t n, const char *format,...)
struct city * tile_city(const struct tile *ptile)
#define tile_hash_iterate(hash, ptile)
#define tile_worked(_tile)
#define tile_list_iterate(tile_list, ptile)
#define tile_hash_iterate_end
#define tile_list_iterate_end
struct sprite * get_nuke_explode_sprite(const struct tileset *t)
int tileset_hex_width(const struct tileset *t)
int tileset_unit_width(const struct tileset *t)
struct unit * get_drawable_unit(const struct tileset *t, struct tile *ptile, const struct city *citymode)
int tileset_unit_height(const struct tileset *t)
struct sprite * get_city_flag_sprite(const struct tileset *t, const struct city *pcity)
int tileset_full_tile_height(const struct tileset *t)
struct sprite * get_unit_upkeep_sprite(const struct tileset *t, Output_type_id otype, const struct unit *punit, const int *upkeep_cost)
int tileset_citybar_offset_y(const struct tileset *t)
bool unit_drawn_with_city_outline(const struct unit *punit, bool check_focus)
const struct sprite_vector * get_unit_explode_animation(const struct tileset *t)
bool tileset_is_isometric(const struct tileset *t)
int tileset_tile_height(const struct tileset *t)
struct sprite * get_spaceship_sprite(const struct tileset *t, enum spaceship_part part)
int tileset_hex_height(const struct tileset *t)
const struct citybar_sprites * get_citybar_sprites(const struct tileset *t)
struct sprite * get_unit_unhappy_sprite(const struct tileset *t, const struct unit *punit, int happy_cost)
int fill_sprite_array(struct tileset *t, struct drawn_sprite *sprs, enum mapview_layer layer, const struct tile *ptile, const struct tile_edge *pedge, const struct tile_corner *pcorner, const struct unit *punit, const struct city *pcity, const struct city *citymode, const struct unit_type *putype)
int tileset_tile_width(const struct tileset *t)
int tileset_tilelabel_offset_y(const struct tileset *t)
#define mapview_layer_iterate(layer)
#define mapview_layer_iterate_end
void timer_usleep_since_start(struct timer *t, long usec)
void timer_start(struct timer *t)
double timer_read_seconds(struct timer *t)
struct timer * timer_renew(struct timer *t, enum timer_timetype type, enum timer_use use)
unsigned max_trade_routes(const struct city *pcity)
#define trade_partners_iterate_end
#define trade_partners_iterate(c, p)
bool unit_can_do_action(const struct unit *punit, const action_id act_id)
struct unit * unit_virtual_create(struct player *pplayer, struct city *pcity, const struct unit_type *punittype, int veteran_level)
void unit_virtual_destroy(struct unit *punit)
bool unit_has_orders(const struct unit *punit)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
const struct unit_type * unit_type_get(const struct unit *punit)
#define zoom_is_enabled()