Freeciv-3.3: /fast/freeciv/nightly/main/client/gui-sdl3/mapview.c Source File

Freeciv-3.3

Loading...
Searching...
No Matches
mapview.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
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/***********************************************************************
15 mapview.c - description
16 -------------------
17 begin : Aug 10 2002
18 copyright : (C) 2002 by Rafał Bursig
19 email : Rafał Bursig <bursig@poczta.fm>
20***********************************************************************/
21
22#ifdef HAVE_CONFIG_H
23#include <fc_config.h>
24#endif
25
26/* SDL3 */
27#include <SDL3/SDL.h>
28
29/* utility */
30#include "astring.h"
31#include "bugs.h"
32#include "fcintl.h"
33#include "log.h"
34
35/* common */
36#include "calendar.h"
37#include "game.h"
38#include "goto.h"
39#include "government.h"
40#include "movement.h"
41#include "research.h"
42#include "unitlist.h"
43
44/* client */
45#include "citydlg_common.h"
46#include "client_main.h"
47#include "climisc.h"
48#include "overview_common.h"
49#include "pages_g.h"
50#include "text.h"
51
52/* gui-sdl3 */
53#include "colors.h"
54#include "dialogs.h"
55#include "graphics.h"
56#include "gui_id.h"
57#include "gui_main.h"
58#include "gui_mouse.h"
59#include "gui_tilespec.h"
60#include "mapctrl.h"
61#include "sprite.h"
62#include "themespec.h"
63#include "widget.h"
64
65#include "mapview.h"
66
67extern SDL_Rect *info_area;
68
69 int overview_start_x = 0;
70 int overview_start_y = 0;
71
72 static struct canvas *overview_canvas;
73 static struct canvas *city_map_canvas = NULL;
74 static struct canvas *terrain_canvas;
75
76/* ================================================================ */
77
78 void update_map_canvas_scrollbars_size(void)
79{
80 /* No scrollbars */
81}
82
83 static bool is_flush_queued = FALSE;
84
85/**********************************************************************/
88 static void flush_mapcanvas(int canvas_x, int canvas_y,
89 int pixel_width, int pixel_height)
90{
91 SDL_Rect rect = {canvas_x, canvas_y, pixel_width, pixel_height};
92
93 alphablit(mapview.store->surf, &rect, main_data.map, &rect, 255);
94}
95
96/**********************************************************************/
99 void flush_rect(SDL_Rect *rect, bool force_flush)
100{
101 if (is_flush_queued && !force_flush) {
102 dirty_sdl_rect(rect);
103 } else {
104 static SDL_Rect src, dst;
105
106 if (correct_rect_region(rect)) {
107 static int i = 0;
108
109 dst = *rect;
110 if (C_S_RUNNING == client_state()) {
111 flush_mapcanvas(dst.x, dst.y, dst.w, dst.h);
112 }
113 screen_blit(main_data.map, rect, &dst, 255);
114 if (main_data.guis) {
115 while ((i < main_data.guis_count) && main_data.guis[i]) {
116 src = *rect;
117 screen_rect_to_layer_rect(main_data.guis[i], &src);
118 dst = *rect;
119 screen_blit(main_data.guis[i++]->surface, &src, &dst, 255);
120 }
121 }
122 i = 0;
123
124 /* flush main buffer to framebuffer */
125#if 0
126 SDL_UpdateRect(main_data.screen, rect->x, rect->y, rect->w, rect->h);
127#endif /* 0 */
128 }
129 }
130}
131
132/**********************************************************************/
136 void unqueue_flush(void)
137{
138 flush_dirty();
139 redraw_selection_rectangle();
140 is_flush_queued = FALSE;
141}
142
143/**********************************************************************/
148 void queue_flush(void)
149{
150 if (!is_flush_queued) {
151 if (flush_event()) {
152 is_flush_queued = TRUE;
153 } else {
154 /* We don't want to set is_flush_queued in this case, since then
155 * the flush code would simply stop working. But this means the
156 * below message may be repeated many times. */
157 bugreport_request(_("Failed to add events to SDL3 event buffer: %s"),
158 SDL_GetError());
159 }
160 }
161}
162
163/**********************************************************************/
166 void dirty_rect(int canvas_x, int canvas_y,
167 int pixel_width, int pixel_height)
168{
169 SDL_Rect Rect = {canvas_x, canvas_y, pixel_width, pixel_height};
170
171 dirty_sdl_rect(&Rect);
172}
173
174/**********************************************************************/
177 void dirty_sdl_rect(SDL_Rect *Rect)
178{
179 if ((main_data.rects_count < RECT_LIMIT) && correct_rect_region(Rect)) {
180 main_data.rects[main_data.rects_count++] = *Rect;
181 queue_flush();
182 }
183}
184
185/**********************************************************************/
188 void dirty_all(void)
189{
190 main_data.rects_count = RECT_LIMIT;
191 queue_flush();
192}
193
194/**********************************************************************/
197 void flush_all(void)
198{
199 is_flush_queued = FALSE;
200 main_data.rects_count = RECT_LIMIT;
201 flush_dirty();
202}
203
204/**********************************************************************/
208 void flush_dirty(void)
209{
210 static int j = 0;
211
212 if (!main_data.rects_count) {
213 return;
214 }
215
216 if (main_data.rects_count >= RECT_LIMIT) {
217
218 if ((C_S_RUNNING == client_state())
219 && (get_client_page() == PAGE_GAME)) {
220 flush_mapcanvas(0, 0, main_window_width(), main_window_height());
221 refresh_overview();
222 }
223 screen_blit(main_data.map, NULL, NULL, 255);
224 if (main_data.guis) {
225 while ((j < main_data.guis_count) && main_data.guis[j]) {
226 SDL_Rect dst = main_data.guis[j]->dest_rect;
227
228 screen_blit(main_data.guis[j++]->surface, NULL, &dst, 255);
229 }
230 }
231 j = 0;
232
233 draw_mouse_cursor();
234
235 /* Render to screen */
236 update_main_screen();
237 } else {
238 static int i;
239 static SDL_Rect src, dst;
240
241 for (i = 0; i < main_data.rects_count; i++) {
242
243 dst = main_data.rects[i];
244 if (C_S_RUNNING == client_state()) {
245 flush_mapcanvas(dst.x, dst.y, dst.w, dst.h);
246 }
247 screen_blit(main_data.map, &main_data.rects[i], &dst, 255);
248
249 if (main_data.guis) {
250 while ((j < main_data.guis_count) && main_data.guis[j]) {
251 src = main_data.rects[i];
252 screen_rect_to_layer_rect(main_data.guis[j], &src);
253 dst = main_data.rects[i];
254 screen_blit(main_data.guis[j++]->surface, &src, &dst, 255);
255 }
256 }
257 j = 0;
258
259 /* restore widget info label if it overlaps with this area */
260 dst = main_data.rects[i];
261 if (info_area && !(((dst.x + dst.w) < info_area->x)
262 || (dst.x > (info_area->x + info_area->w))
263 || ((dst.y + dst.h) < info_area->y)
264 || (dst.y > (info_area->y + info_area->h)))) {
265 redraw_widget_info_label(&dst);
266 }
267 }
268
269 draw_mouse_cursor();
270
271 /* Render to screen */
272 update_main_screen();
273#if 0
274 SDL_UpdateRects(main_data.screen, main_data.rects_count, main_data.rects);
275#endif
276 }
277 main_data.rects_count = 0;
278}
279
280/**********************************************************************/
283 void gui_flush(void)
284{
285 if (C_S_RUNNING == client_state()) {
286 refresh_overview();
287 }
288}
289
290/* ===================================================================== */
291
292/**********************************************************************/
297 void set_indicator_icons(struct sprite *bulb, struct sprite *sol,
298 struct sprite *flake, struct sprite *gov)
299{
300 struct widget *buf = NULL;
301 char cbuf[128];
302
303 buf = get_widget_pointer_from_main_list(ID_WARMING_ICON);
304 FREESURFACE(buf->theme);
305 buf->theme = adj_surf(GET_SURF(sol));
306 widget_redraw(buf);
307 widget_mark_dirty(buf);
308
309 buf = get_widget_pointer_from_main_list(ID_COOLING_ICON);
310 FREESURFACE(buf->theme);
311 buf->theme = adj_surf(GET_SURF(flake));
312 widget_redraw(buf);
313 widget_mark_dirty(buf);
314
315 buf = get_revolution_widget();
316 set_new_icon2_theme(buf, adj_surf(GET_SURF(gov)), TRUE);
317
318 if (NULL != client.conn.playing) {
319 fc_snprintf(cbuf, sizeof(cbuf), "%s (%s)\n%s",
320 _("Revolution"), "Ctrl+Shift+G",
321 government_name_for_player(client.conn.playing));
322 } else {
323 fc_snprintf(cbuf, sizeof(cbuf), "%s (%s)\n%s",
324 _("Revolution"), "Ctrl+Shift+G",
325 Q_("?gov:None"));
326 }
327 copy_chars_to_utf8_str(buf->info_label, cbuf);
328
329 widget_redraw(buf);
330 widget_mark_dirty(buf);
331
332 buf = get_tax_rates_widget();
333 if (!buf->theme) {
334 set_new_icon2_theme(buf, get_tax_surface(O_GOLD), TRUE);
335 }
336
337 buf = get_research_widget();
338
339 if (NULL == client.conn.playing) {
340 /* TRANS: Research report action */
341 fc_snprintf(cbuf, sizeof(cbuf), "%s (%s)\n%s (%d/%d)", _("Research"), "F6",
342 Q_("?tech:None"), 0, 0);
343 } else {
344 const struct research *presearch = research_get(client_player());
345
346 if (A_UNSET != presearch->researching) {
347 /* TRANS: Research report action */
348 fc_snprintf(cbuf, sizeof(cbuf), "%s (%s)\n%s (%d/%d)",
349 _("Research"), "F6",
350 research_advance_name_translation(presearch,
351 presearch->researching),
352 presearch->bulbs_researched,
353 presearch->client.researching_cost);
354 } else {
355 /* TRANS: Research report action */
356 fc_snprintf(cbuf, sizeof(cbuf), "%s (%s)\n%s (%d/%d)",
357 _("Research"), "F6",
358 research_advance_name_translation(presearch,
359 presearch->researching),
360 presearch->bulbs_researched,
361 0);
362 }
363 }
364
365 copy_chars_to_utf8_str(buf->info_label, cbuf);
366
367 set_new_icon2_theme(buf, adj_surf(GET_SURF(bulb)), TRUE);
368
369 widget_redraw(buf);
370 widget_mark_dirty(buf);
371}
372
373/**********************************************************************/
379 void overview_size_changed(void)
380{
381 map_canvas_resized(main_window_width(), main_window_height());
382
383 if (overview_canvas) {
384 canvas_free(overview_canvas);
385 }
386 overview_canvas = canvas_create(gui_options.overview.width,
387 gui_options.overview.height);
388
389 resize_minimap();
390}
391
392/**********************************************************************/
397 void update_info_label(void)
398{
399 SDL_Color bg_color = {0, 0, 0, 80};
400 SDL_Surface *tmp = NULL;
401 char buffer[512];
402#ifdef GUI_SDL3_SMALL_SCREEN
403 SDL_Rect area = {0, 0, 0, 0};
404#else
405 SDL_Rect area = {0, 3, 0, 0};
406#endif
407 struct utf8_str *ptext;
408
409 if (get_current_client_page() != PAGE_GAME) {
410 return;
411 }
412
413 ptext = create_utf8_str_fonto(NULL, 0, FONTO_DEFAULT);
414
415 /* Set text settings */
416 ptext->style |= TTF_STYLE_BOLD;
417 ptext->fgcol = *get_theme_color(COLOR_THEME_MAPVIEW_INFO_TEXT);
418 ptext->bgcol = (SDL_Color) {0, 0, 0, 0};
419
420 if (NULL != client.conn.playing) {
421#ifdef GUI_SDL3_SMALL_SCREEN
422 fc_snprintf(buffer, sizeof(buffer),
423 _("%s Population: %s Year: %s "
424 "Gold %d "),
425 nation_adjective_for_player(client.conn.playing),
426 population_to_text(civ_population(client.conn.playing)),
427 calendar_text(),
428 client.conn.playing->economic.gold);
429#else /* GUI_SDL3_SMALL_SCREEN */
430 fc_snprintf(buffer, sizeof(buffer),
431 _("%s Population: %s Year: %s "
432 "Gold %d Tax: %d Lux: %d Sci: %d "),
433 nation_adjective_for_player(client.conn.playing),
434 population_to_text(civ_population(client.conn.playing)),
435 calendar_text(),
436 client.conn.playing->economic.gold,
437 client.conn.playing->economic.tax,
438 client.conn.playing->economic.luxury,
439 client.conn.playing->economic.science);
440#endif /* GUI_SDL3_SMALL_SCREEN */
441
442 /* Convert to utf8_str and create text surface */
443 copy_chars_to_utf8_str(ptext, buffer);
444 tmp = create_text_surf_from_utf8(ptext);
445
446 area.x = (main_window_width() - tmp->w) / 2 - adj_size(5);
447 area.w = tmp->w + adj_size(8);
448 area.h = tmp->h + adj_size(4);
449
450 SDL_FillSurfaceRect(main_data.gui->surface, &area,
451 map_rgba(main_data.gui->surface->format, bg_color));
452
453 /* Horizontal lines */
454 create_line(main_data.gui->surface,
455 area.x + 1, area.y, area.x + area.w - 2, area.y,
456 get_theme_color(COLOR_THEME_MAPVIEW_INFO_FRAME));
457 create_line(main_data.gui->surface,
458 area.x + 1, area.y + area.h - 1, area.x + area.w - 2,
459 area.y + area.h - 1,
460 get_theme_color(COLOR_THEME_MAPVIEW_INFO_FRAME));
461
462 /* Vertical lines */
463 create_line(main_data.gui->surface,
464 area.x + area.w - 1, area.y + 1, area.x + area.w - 1,
465 area.y + area.h - 2,
466 get_theme_color(COLOR_THEME_MAPVIEW_INFO_FRAME));
467 create_line(main_data.gui->surface,
468 area.x, area.y + 1, area.x, area.y + area.h - 2,
469 get_theme_color(COLOR_THEME_MAPVIEW_INFO_FRAME));
470
471 /* Blit text to screen */
472 blit_entire_src(tmp, main_data.gui->surface, area.x + adj_size(5),
473 area.y + adj_size(2));
474
475 dirty_sdl_rect(&area);
476
477 FREESURFACE(tmp);
478 }
479
480 set_indicator_icons(client_research_sprite(),
481 client_warming_sprite(),
482 client_cooling_sprite(),
483 client_government_sprite());
484
485 update_timeout_label();
486
487 FREEUTF8STR(ptext);
488
489 queue_flush();
490}
491
492/**********************************************************************/
495 static int focus_units_info_callback(struct widget *pwidget)
496{
497 if (PRESSED_EVENT(main_data.event)) {
498 struct unit *punit = pwidget->data.unit;
499
500 if (punit) {
501 request_new_unit_activity(punit, ACTIVITY_IDLE);
502 unit_focus_set(punit);
503 }
504 }
505
506 return -1;
507}
508
509/**********************************************************************/
513 void redraw_unit_info_label(struct unit_list *punitlist)
514{
515 struct widget *info_window;
516 SDL_Rect src, area;
517 SDL_Rect dest;
518 SDL_Surface *buf_surf;
519 utf8_str *pstr;
520 struct canvas *destcanvas;
521 struct unit *punit;
522
523 if (punitlist != NULL && unit_list_size(punitlist) > 0) {
524 punit = unit_list_get(punitlist, 0);
525 } else {
526 punit = NULL;
527 }
528
529 if (sdl3_client_flags & CF_UNITINFO_SHOWN) {
530 info_window = get_unit_info_window_widget();
531
532 /* Blit theme surface */
533 widget_redraw(info_window);
534
535 if (punit) {
536 SDL_Surface *name, *vet_name = NULL, *info, *info2 = NULL;
537 int sy, y, width, height, n;
538 bool right;
539 char buffer[512];
540 struct tile *ptile = unit_tile(punit);
541 const char *vetname;
542
543 /* Get and draw unit name (with veteran status) */
544 pstr = create_utf8_from_char_fonto(unit_name_translation(punit),
545 FONTO_ATTENTION);
546 pstr->style |= TTF_STYLE_BOLD;
547 pstr->bgcol = (SDL_Color) {0, 0, 0, 0};
548 name = create_text_surf_from_utf8(pstr);
549
550 pstr->style &= ~TTF_STYLE_BOLD;
551
552 if (info_window->size.w > 1.8 *
553 ((info_window->size.w - info_window->area.w) + DEFAULT_UNITS_W)) {
554 width = info_window->area.w / 2;
555 right = TRUE;
556 } else {
557 width = info_window->area.w;
558 right = FALSE;
559 }
560
561 change_fonto_utf8(pstr, FONTO_DEFAULT);
562 vetname = utype_veteran_name_translation(unit_type_get(punit),
563 punit->veteran);
564 if (vetname != NULL) {
565 copy_chars_to_utf8_str(pstr, vetname);
566 pstr->fgcol = *get_theme_color(COLOR_THEME_MAPVIEW_UNITINFO_VETERAN_TEXT);
567 vet_name = create_text_surf_from_utf8(pstr);
568 pstr->fgcol = *get_theme_color(COLOR_THEME_MAPVIEW_UNITINFO_TEXT);
569 }
570
571 /* Get and draw other info (MP, terrain, city, etc.) */
572 pstr->style |= SF_CENTER;
573
574 copy_chars_to_utf8_str(pstr,
575 get_unit_info_label_text2(punitlist,
576 TILE_LB_RESOURCE_POLL));
577 info = create_text_surf_from_utf8(pstr);
578
579 if (info_window->size.h >
580 (DEFAULT_UNITS_H + (info_window->size.h - info_window->area.h)) || right) {
581 int h = TTF_FontHeight(info_window->string_utf8->font);
582
583 fc_snprintf(buffer, sizeof(buffer), "%s",
584 sdl_get_tile_defense_info_text(ptile));
585
586 if (info_window->size.h >
587 2 * h + (DEFAULT_UNITS_H + (info_window->size.h - info_window->area.h)) || right) {
588 struct city *pcity = tile_city(ptile);
589
590 if (BORDERS_DISABLED != game.info.borders && !pcity) {
591 const char *diplo_nation_plural_adjectives[DS_LAST] =
592 {"" /* unused, DS_ARMISTICE */, Q_("?nation:Hostile"),
593 "" /* unused, DS_CEASEFIRE */,
594 Q_("?nation:Peaceful"), Q_("?nation:Friendly"),
595 Q_("?nation:Mysterious")};
596
597 if (tile_owner(ptile) == client.conn.playing) {
598 cat_snprintf(buffer, sizeof(buffer), _("\nOur Territory"));
599 } else {
600 if (tile_owner(ptile)) {
601 struct player_diplstate *ds
602 = player_diplstate_get(client.conn.playing,
603 tile_owner(ptile));
604
605 if (DS_CEASEFIRE == ds->type) {
606 int turns = ds->turns_left;
607
608 cat_snprintf(buffer, sizeof(buffer),
609 PL_("\n%s territory (%d turn ceasefire)",
610 "\n%s territory (%d turn ceasefire)", turns),
611 nation_adjective_for_player(tile_owner(ptile)),
612 turns);
613 } else if (DS_ARMISTICE == ds->type) {
614 int turns = ds->turns_left;
615
616 cat_snprintf(buffer, sizeof(buffer),
617 PL_("\n%s territory (%d turn armistice)",
618 "\n%s territory (%d turn armistice)", turns),
619 nation_adjective_for_player(tile_owner(ptile)),
620 turns);
621 } else {
622 cat_snprintf(buffer, sizeof(buffer), _("\nTerritory of the %s %s"),
623 diplo_nation_plural_adjectives[ds->type],
624 nation_plural_for_player(tile_owner(ptile)));
625 }
626 } else { /* !tile_owner(ptile) */
627 cat_snprintf(buffer, sizeof(buffer), _("\nUnclaimed territory"));
628 }
629 }
630 } /* BORDERS_DISABLED != game.info.borders && !pcity */
631
632 if (pcity) {
633 /* Look at city owner, not tile owner (the two should be the same, if
634 * borders are in use). */
635 struct player *owner = city_owner(pcity);
636 const char *diplo_city_adjectives[DS_LAST] =
637 {Q_("?city:Neutral"), Q_("?city:Hostile"),
638 Q_("?city:Neutral"), Q_("?city:Peaceful"),
639 Q_("?city:Friendly"), Q_("?city:Mysterious")};
640
641 cat_snprintf(buffer, sizeof(buffer),
642 _("\nCity of %s"),
643 city_name_get(pcity));
644
645#if 0
646 /* This has hardcoded assumption that EFT_LAND_REGEN is always
647 * provided by *building* named *Barracks*. Similar assumptions for
648 * other effects. */
649 if (pplayers_allied(client.conn.playing, owner)) {
650 barrack = (get_city_bonus(pcity, EFT_LAND_REGEN) > 0);
651 airport = (get_city_bonus(pcity, EFT_AIR_VETERAN) > 0);
652 port = (get_city_bonus(pcity, EFT_SEA_VETERAN) > 0);
653 }
654
655 if (citywall || barrack || airport || port) {
656 cat_snprintf(buffer, sizeof(buffer), Q_("?blistbegin: with "));
657 if (barrack) {
658 cat_snprintf(buffer, sizeof(buffer), _("Barracks"));
659 if (port || airport || citywall) {
660 cat_snprintf(buffer, sizeof(buffer), Q_("?blistmore:, "));
661 }
662 }
663 if (port) {
664 cat_snprintf(buffer, sizeof(buffer), _("Port"));
665 if (airport || citywall) {
666 cat_snprintf(buffer, sizeof(buffer), Q_("?blistmore:, "));
667 }
668 }
669 if (airport) {
670 cat_snprintf(buffer, sizeof(buffer), _("Airport"));
671 if (citywall) {
672 cat_snprintf(buffer, sizeof(buffer), Q_("?blistmore:, "));
673 }
674 }
675 if (citywall) {
676 cat_snprintf(buffer, sizeof(buffer), _("City Walls"));
677 }
678
679 cat_snprintf(buffer, sizeof(buffer), Q_("?blistend:"));
680 }
681#endif /* 0 */
682
683 if (owner && owner != client.conn.playing) {
684 struct player_diplstate *ds
685 = player_diplstate_get(client.conn.playing, owner);
686
687 /* TRANS: (<nation>,<diplomatic_state>)" */
688 cat_snprintf(buffer, sizeof(buffer), _("\n(%s,%s)"),
689 nation_adjective_for_player(owner),
690 diplo_city_adjectives[ds->type]);
691 }
692 }
693 }
694
695 if (info_window->size.h >
696 4 * h + (DEFAULT_UNITS_H + (info_window->size.h - info_window->area.h)) || right) {
697 cat_snprintf(buffer, sizeof(buffer), _("\nFood/Prod/Trade: %s"),
698 get_tile_output_text(unit_tile(punit)));
699 }
700
701 copy_chars_to_utf8_str(pstr, buffer);
702
703 info2 = create_text_surf_smaller_than_w(pstr, width - BLOCKU_W - adj_size(4));
704 }
705
706 FREEUTF8STR(pstr);
707
708 /* ------------------------------------------- */
709
710 n = unit_list_size(ptile->units);
711 y = 0;
712
713 if (n > 1 && ((!right && info2
714 && (info_window->size.h - (DEFAULT_UNITS_H + (info_window->size.h - info_window->area.h)) -
715 info2->h > 52))
716 || (right && info_window->size.h - (DEFAULT_UNITS_H + (info_window->size.h -
717 info_window->area.h)) > 52))) {
718 height = (info_window->size.h - info_window->area.h) + DEFAULT_UNITS_H;
719 } else {
720 height = info_window->size.h;
721 if (info_window->size.h > (DEFAULT_UNITS_H + (info_window->size.h - info_window->area.h))) {
722 y = (info_window->size.h - (DEFAULT_UNITS_H + (info_window->size.h - info_window->area.h)) -
723 (!right && info2 ? info2->h : 0)) / 2;
724 }
725 }
726
727 sy = y + adj_size(3);
728 area.y = info_window->area.y + sy;
729 area.x = info_window->area.x + BLOCKU_W + (width - name->w - BLOCKU_W) / 2;
730 dest = area;
731 alphablit(name, NULL, info_window->dst->surface, &dest, 255);
732 sy += name->h;
733 if (vet_name) {
734 area.y += name->h - adj_size(3);
735 area.x = info_window->area.x + BLOCKU_W + (width - vet_name->w - BLOCKU_W) / 2;
736 alphablit(vet_name, NULL, info_window->dst->surface, &area, 255);
737 sy += vet_name->h - adj_size(3);
738 FREESURFACE(vet_name);
739 }
740 FREESURFACE(name);
741
742 /* draw unit sprite */
743 buf_surf = resize_surface_box(get_unittype_surface(unit_type_get(punit),
744 punit->facing),
745 adj_size(80), adj_size(80), 1, TRUE, TRUE);
746
747 src = (SDL_Rect){0, 0, buf_surf->w, buf_surf->h};
748
749 area.x = info_window->area.x + BLOCKU_W - adj_size(4) +
750 ((width - BLOCKU_W + adj_size(3) - src.w) / 2);
751 area.y = info_window->size.y + sy + (DEFAULT_UNITS_H - sy - src.h) / 2;
752 alphablit(buf_surf, &src, info_window->dst->surface, &area, 32);
753 FREESURFACE(buf_surf);
754
755 /* blit unit info text */
756 area.x = info_window->area.x + BLOCKU_W - adj_size(4) +
757 ((width - BLOCKU_W + adj_size(4) - info->w) / 2);
758 area.y = info_window->size.y + sy + (DEFAULT_UNITS_H - sy - info->h) / 2;
759
760 alphablit(info, NULL, info_window->dst->surface, &area, 255);
761 FREESURFACE(info);
762
763 if (info2) {
764 if (right) {
765 area.x = info_window->area.x + width + (width - info2->w) / 2;
766 area.y = info_window->area.y + (height - info2->h) / 2;
767 } else {
768 area.y = info_window->area.y + DEFAULT_UNITS_H + y;
769 area.x = info_window->area.x + BLOCKU_W +
770 (width - BLOCKU_W - info2->w) / 2;
771 }
772
773 /* blit unit info text */
774 alphablit(info2, NULL, info_window->dst->surface, &area, 255);
775
776 if (right) {
777 sy = (DEFAULT_UNITS_H + (info_window->size.h - info_window->area.h));
778 } else {
779 sy = area.y - info_window->size.y + info2->h;
780 }
781 FREESURFACE(info2);
782 } else {
783 sy = (DEFAULT_UNITS_H + (info_window->size.h - info_window->area.h));
784 }
785
786 if (n > 1 && (info_window->size.h - sy > 52)) {
787 struct advanced_dialog *dlg = info_window->private_data.adv_dlg;
788 struct widget *buf = NULL, *end = NULL, *dock;
789 struct city *home_city;
790 const struct unit_type *putype;
791 int num_w, num_h;
792
793 if (dlg->end_active_widget_list && dlg->begin_active_widget_list) {
794 del_group(dlg->begin_active_widget_list, dlg->end_active_widget_list);
795 }
796 num_w = (info_window->area.w - BLOCKU_W) / 68;
797 num_h = (info_window->area.h - sy) / 52;
798 dock = info_window;
799 n = 0;
800
801 unit_list_iterate(ptile->units, aunit) {
802 SDL_Surface *tmp_surf;
803 struct astring addition = ASTRING_INIT;
804
805 if (aunit == punit) {
806 continue;
807 }
808
809 putype = unit_type_get(aunit);
810 vetname = utype_veteran_name_translation(putype, aunit->veteran);
811 home_city = game_city_by_number(aunit->homecity);
812 unit_activity_astr(aunit, &addition);
813 fc_snprintf(buffer, sizeof(buffer),
814 "%s (%d,%d,%s)%s%s\n%s\n(%d/%d)\n%s",
815 utype_name_translation(putype),
816 putype->attack_strength,
817 putype->defense_strength,
818 move_points_text(putype->move_rate, FALSE),
819 (vetname != NULL ? "\n" : ""),
820 (vetname != NULL ? vetname : ""),
821 astr_str(&addition),
822 aunit->hp, putype->hp,
823 home_city ? city_name_get(home_city) : Q_("?homecity:None"));
824 astr_free(&addition);
825
826 buf_surf = create_surf(tileset_full_tile_width(tileset),
827 tileset_full_tile_height(tileset),
828 SDL_SWSURFACE);
829
830 destcanvas = canvas_create(tileset_full_tile_width(tileset),
831 tileset_full_tile_height(tileset));
832
833 put_unit(aunit, destcanvas, 1.0, 0, 0);
834
835 tmp_surf = adj_surf(destcanvas->surf);
836
837 alphablit(tmp_surf, NULL, buf_surf, NULL, 255);
838
839 FREESURFACE(tmp_surf);
840 canvas_free(destcanvas);
841
842 if (buf_surf->w > 64) {
843 float zoom = 64.0 / buf_surf->w;
844 SDL_Surface *zoomed = zoomSurface(buf_surf, zoom, zoom, 1);
845
846 FREESURFACE(buf_surf);
847 buf_surf = zoomed;
848 }
849
850 pstr = create_utf8_from_char(buffer, 10);
851 pstr->style |= SF_CENTER;
852
853 buf = create_icon2(buf_surf, info_window->dst,
854 WF_FREE_THEME | WF_RESTORE_BACKGROUND
855 | WF_WIDGET_HAS_INFO_LABEL);
856 buf->info_label = pstr;
857 buf->data.unit = aunit;
858 buf->id = ID_ICON;
859 widget_add_as_prev(buf, dock);
860 dock = buf;
861
862 if (!end) {
863 end = buf;
864 }
865
866 if (++n > num_w * num_h) {
867 set_wflag(buf, WF_HIDDEN);
868 }
869
870 if (unit_owner(aunit) == client.conn.playing) {
871 set_wstate(buf, FC_WS_NORMAL);
872 }
873
874 buf->action = focus_units_info_callback;
875
876 } unit_list_iterate_end;
877
878 dlg->begin_active_widget_list = buf;
879 dlg->end_active_widget_list = end;
880 dlg->active_widget_list = dlg->end_active_widget_list;
881
882 if (n > num_w * num_h) {
883 if (!dlg->scroll) {
884 create_vertical_scrollbar(dlg, num_w, num_h, FALSE, TRUE);
885 } else {
886 dlg->scroll->active = num_h;
887 dlg->scroll->step = num_w;
888 dlg->scroll->count = n;
889 show_scrollbar(dlg->scroll);
890 }
891
892 /* create up button */
893 buf = dlg->scroll->up_left_button;
894 buf->size.x = info_window->area.x + info_window->area.w - buf->size.w;
895 buf->size.y = info_window->area.y + sy +
896 (info_window->size.h - sy - num_h * 52) / 2;
897 buf->size.h = (num_h * 52) / 2;
898
899 /* create down button */
900 buf = dlg->scroll->down_right_button;
901 buf->size.x = dlg->scroll->up_left_button->size.x;
902 buf->size.y = dlg->scroll->up_left_button->size.y +
903 dlg->scroll->up_left_button->size.h;
904 buf->size.h = dlg->scroll->up_left_button->size.h;
905 } else {
906 if (dlg->scroll) {
907 hide_scrollbar(dlg->scroll);
908 }
909 num_h = (n + num_w - 1) / num_w;
910 }
911
912 setup_vertical_widgets_position(num_w,
913 info_window->area.x + BLOCKU_W + adj_size(2),
914 info_window->size.y + sy +
915 (info_window->size.h - sy - num_h * 52) / 2,
916 0, 0, dlg->begin_active_widget_list,
917 dlg->end_active_widget_list);
918 } else {
919 if (info_window->private_data.adv_dlg->end_active_widget_list) {
920 del_group(info_window->private_data.adv_dlg->begin_active_widget_list,
921 info_window->private_data.adv_dlg->end_active_widget_list);
922 }
923 if (info_window->private_data.adv_dlg->scroll) {
924 hide_scrollbar(info_window->private_data.adv_dlg->scroll);
925 }
926 }
927 } else { /* punit */
928
929 if (info_window->private_data.adv_dlg->end_active_widget_list) {
930 del_group(info_window->private_data.adv_dlg->begin_active_widget_list,
931 info_window->private_data.adv_dlg->end_active_widget_list);
932 }
933 if (info_window->private_data.adv_dlg->scroll) {
934 hide_scrollbar(info_window->private_data.adv_dlg->scroll);
935 }
936
937 if (!client_is_observer() && !client.conn.playing->phase_done
938 && (is_human(client.conn.playing)
939 || gui_options.ai_manual_turn_done)) {
940 char buf[256];
941
942 fc_snprintf(buf, sizeof(buf), "%s\n%s\n%s",
943 _("End of Turn"), _("Press"), _("Shift+Return"));
944 pstr = create_utf8_from_char_fonto(buf, FONTO_HEADING);
945 pstr->style = SF_CENTER;
946 pstr->bgcol = (SDL_Color) {0, 0, 0, 0};
947 buf_surf = create_text_surf_from_utf8(pstr);
948 area.x = info_window->size.x + BLOCKU_W +
949 (info_window->size.w - BLOCKU_W - buf_surf->w) / 2;
950 area.y = info_window->size.y + (info_window->size.h - buf_surf->h) / 2;
951 alphablit(buf_surf, NULL, info_window->dst->surface, &area, 255);
952 FREESURFACE(buf_surf);
953 FREEUTF8STR(pstr);
954 /* Fix the bug of child dialogs not showing up when player's turn ends */
955 flush_all();
956 }
957 }
958
959 /* Draw buttons */
960 redraw_group(info_window->private_data.adv_dlg->begin_widget_list,
961 info_window->private_data.adv_dlg->end_widget_list->prev, 0);
962
963 widget_mark_dirty(info_window);
964 }
965}
966
967/**********************************************************************/
970 static bool is_focus_anim_enabled(void)
971{
972 return (sdl3_client_flags & CF_FOCUS_ANIMATION) == CF_FOCUS_ANIMATION;
973}
974
975/**********************************************************************/
981 void set_unit_icon(int idx, struct unit *punit)
982{
983 /* FIXME */
984 /* update_unit_info_label(punit);*/
985}
986
987/**********************************************************************/
992 void set_unit_icons_more_arrow(bool onoff)
993{
994/* Balast */
995}
996
997/**********************************************************************/
1002 void real_focus_units_changed(void)
1003{
1004 /* Nothing to do */
1005}
1006
1007/**********************************************************************/
1019 void update_unit_info_label(struct unit_list *punitlist)
1020{
1021 if (C_S_RUNNING != client_state()) {
1022 return;
1023 }
1024
1025 /* draw unit info window */
1026 redraw_unit_info_label(punitlist);
1027
1028 if (punitlist) {
1029 if (!is_focus_anim_enabled()) {
1030 enable_focus_animation();
1031 }
1032 } else {
1033 disable_focus_animation();
1034 }
1035}
1036
1037/**********************************************************************/
1040 void update_timeout_label(void)
1041{
1042 log_debug("MAPVIEW: update_timeout_label : PORT ME");
1043}
1044
1045/**********************************************************************/
1048 void update_turn_done_button(bool do_restore)
1049{
1050 log_debug("MAPVIEW: update_turn_done_button : PORT ME");
1051}
1052
1053/* ===================================================================== */
1054/* ========================== City Descriptions ======================== */
1055/* ===================================================================== */
1056
1057/**********************************************************************/
1060 void update_city_descriptions(void)
1061{
1062 /* redraw buffer */
1063 show_city_descriptions(0, 0, mapview.store_width, mapview.store_height);
1064 dirty_all();
1065}
1066
1067/* ===================================================================== */
1068/* =============================== Mini Map ============================ */
1069/* ===================================================================== */
1070
1071/**********************************************************************/
1074 struct canvas *get_overview_window(void)
1075{
1076 return overview_canvas;
1077}
1078
1079/**********************************************************************/
1083 void get_overview_area_dimensions(int *width, int *height)
1084{
1085 /* Calculate the dimensions in a way to always get a resulting
1086 overview with a height bigger than or equal to DEFAULT_OVERVIEW_H.
1087 First, the default dimensions are fed to the same formula that
1088 is used in overview_common.c. If the resulting height is
1089 smaller than DEFAULT_OVERVIEW_H, increase OVERVIEW_TILE_SIZE
1090 by 1 until the height condition is met.
1091 */
1092 int overview_tile_size_bak = OVERVIEW_TILE_SIZE;
1093 int xfact = MAP_IS_ISOMETRIC ? 2 : 1;
1094 int shift = (MAP_IS_ISOMETRIC && !current_wrap_has_flag(WRAP_X)) ? -1 : 0;
1095
1096 OVERVIEW_TILE_SIZE = MIN((DEFAULT_OVERVIEW_W - 1) / (MAP_NATIVE_WIDTH * xfact),
1097 (DEFAULT_OVERVIEW_H - 1) / MAP_NATIVE_HEIGHT) + 1;
1098
1099 do {
1100 *height = OVERVIEW_TILE_HEIGHT * MAP_NATIVE_HEIGHT;
1101 if (*height < DEFAULT_OVERVIEW_H) {
1102 OVERVIEW_TILE_SIZE++;
1103 }
1104 } while (*height < DEFAULT_OVERVIEW_H);
1105
1106 *width = OVERVIEW_TILE_WIDTH * MAP_NATIVE_WIDTH + shift * OVERVIEW_TILE_SIZE;
1107
1108 OVERVIEW_TILE_SIZE = overview_tile_size_bak;
1109}
1110
1111/**********************************************************************/
1115 void refresh_overview(void)
1116{
1117 struct widget *minimap;
1118 SDL_Rect overview_area;
1119
1120 if (sdl3_client_flags & CF_OVERVIEW_SHOWN) {
1121 minimap = get_minimap_window_widget();
1122
1123 overview_area = (SDL_Rect) {
1124 minimap->area.x + overview_start_x, minimap->area.x + overview_start_y,
1125 overview_canvas->surf->w, overview_canvas->surf->h
1126 };
1127
1128 alphablit(overview_canvas->surf, NULL, minimap->dst->surface,
1129 &overview_area, 255);
1130
1131 widget_mark_dirty(minimap);
1132 }
1133}
1134
1135/**********************************************************************/
1139 void update_map_canvas_scrollbars(void)
1140{
1141 /* No scrollbars. */
1142}
1143
1144/**********************************************************************/
1147 void put_cross_overlay_tile(struct tile *ptile)
1148{
1149 log_debug("MAPVIEW: put_cross_overlay_tile : PORT ME");
1150}
1151
1152/**********************************************************************/
1155 void draw_selection_rectangle(int canvas_x, int canvas_y, int w, int h)
1156{
1157 /* PORTME */
1158 create_frame(main_data.map,
1159 canvas_x, canvas_y, w, h,
1160 get_theme_color(COLOR_THEME_SELECTIONRECTANGLE));
1161}
1162
1163/**********************************************************************/
1166 void tileset_changed(void)
1167{
1168 /* PORTME */
1169 /* Here you should do any necessary redraws (for instance, the city
1170 * dialogs usually need to be resized). */
1171 popdown_all_game_dialogs();
1172}
1173
1174/* =====================================================================
1175 City MAP
1176 ===================================================================== */
1177
1178/**********************************************************************/
1181 void city_map_canvas_free(void)
1182{
1183 if (city_map_canvas != NULL) {
1184 canvas_free(city_map_canvas);
1185 city_map_canvas = NULL;
1186 }
1187}
1188
1189/**********************************************************************/
1192 SDL_Surface *create_city_map(struct city *pcity)
1193{
1194 /* City map dimensions might have changed, so create a new canvas each time */
1195 city_map_canvas_free();
1196
1197 city_map_canvas = canvas_create(get_citydlg_canvas_width(),
1198 get_citydlg_canvas_height());
1199
1200 city_dialog_redraw_map(pcity, city_map_canvas);
1201
1202 return city_map_canvas->surf;
1203}
1204
1205/**********************************************************************/
1208 SDL_Surface *get_terrain_surface(struct tile *ptile)
1209{
1210 /* Tileset dimensions might have changed, so create a new canvas each time */
1211
1212 if (terrain_canvas) {
1213 canvas_free(terrain_canvas);
1214 }
1215
1216 terrain_canvas = canvas_create(tileset_full_tile_width(tileset),
1217 tileset_full_tile_height(tileset));
1218
1219 put_terrain(ptile, terrain_canvas, 1.0, 0, 0);
1220
1221 return terrain_canvas->surf;
1222}
1223
1224/**********************************************************************/
1227 void update_overview_scroll_window_pos(int x, int y)
1228{
1229 /* TODO: PORTME. */
1230}
1231
1232/**********************************************************************/
1235 void start_turn(void)
1236{}
1237
1238/**********************************************************************/
1241 void map_canvas_size_refresh(void)
1242{
1243 /* Needed only with full screen zoom mode.
1244 * Not needed, nor implemented, in this client. */
1245 fc_assert(FALSE);
1246}
astr_free
void astr_free(struct astring *astr)
Definition astring.c:148
n
#define n
Definition astring.c:77
astring.h
astr_str
static const char * astr_str(const struct astring *astr) fc__attribute((nonnull(1)))
Definition astring.h:93
ASTRING_INIT
#define ASTRING_INIT
Definition astring.h:44
bugreport_request
void bugreport_request(const char *reason_format,...)
Definition bugs.c:31
bugs.h
calendar_text
const char * calendar_text(void)
Definition calendar.c:141
calendar.h
height
struct canvas int int struct sprite int int int int height
Definition canvas_g.h:44
canvas_y
struct canvas int int canvas_y
Definition canvas_g.h:43
canvas_x
struct canvas int canvas_x
Definition canvas_g.h:43
width
struct canvas int int struct sprite int int int width
Definition canvas_g.h:44
city_name_get
const char * city_name_get(const struct city *pcity)
Definition city.c:1133
city_owner
#define city_owner(_pcity_)
Definition city.h:563
get_citydlg_canvas_width
int get_citydlg_canvas_width(void)
Definition citydlg_common.c:51
city_dialog_redraw_map
void city_dialog_redraw_map(struct city *pcity, struct canvas *pcanvas)
Definition citydlg_common.c:187
get_citydlg_canvas_height
int get_citydlg_canvas_height(void)
Definition citydlg_common.c:59
citydlg_common.h
client_is_observer
bool client_is_observer(void)
Definition client_main.c:1091
client
struct civclient client
Definition client_main.c:153
client_state
enum client_states client_state(void)
Definition client_main.c:1034
client_main.h
client_player
#define client_player()
Definition client_main.h:106
C_S_RUNNING
@ C_S_RUNNING
Definition client_main.h:47
client_warming_sprite
struct sprite * client_warming_sprite(void)
Definition climisc.c:377
client_cooling_sprite
struct sprite * client_cooling_sprite(void)
Definition climisc.c:394
client_research_sprite
struct sprite * client_research_sprite(void)
Definition climisc.c:354
client_government_sprite
struct sprite * client_government_sprite(void)
Definition climisc.c:412
climisc.h
incite_cost
char * incite_cost
Definition comments.c:74
unit_focus_set
void unit_focus_set(struct unit *punit)
Definition control.c:501
request_new_unit_activity
void request_new_unit_activity(struct unit *punit, enum unit_activity act)
Definition control.c:1903
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
get_city_bonus
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
Definition effects.c:842
O_GOLD
@ O_GOLD
Definition fc_types.h:101
BORDERS_DISABLED
@ BORDERS_DISABLED
Definition fc_types.h:1017
fcintl.h
Q_
#define Q_(String)
Definition fcintl.h:70
PL_
#define PL_(String1, String2, n)
Definition fcintl.h:71
_
#define _(String)
Definition fcintl.h:67
population_to_text
const char * population_to_text(int thousand_citizen)
Definition game.c:737
game
struct civ_game game
Definition game.c:61
civ_population
int civ_population(const struct player *pplayer)
Definition game.c:73
game_city_by_number
struct city * game_city_by_number(int id)
Definition game.c:106
game.h
goto.h
government_name_for_player
const char * government_name_for_player(const struct player *pplayer)
Definition government.c:154
government.h
canvas_free
void canvas_free(struct canvas *store)
Definition canvas.c:44
canvas_create
struct canvas * canvas_create(int width, int height)
Definition canvas.c:28
owner
struct city * owner
Definition citydlg.c:226
popdown_all_game_dialogs
void popdown_all_game_dialogs(void)
Definition dialogs.c:1514
overview_canvas
GtkWidget * overview_canvas
Definition gui_main.c:111
update_timeout_label
void update_timeout_label(void)
Definition mapview.c:118
flush_dirty
void flush_dirty(void)
Definition mapview.c:468
update_info_label
void update_info_label(void)
Definition mapview.c:138
update_turn_done_button
void update_turn_done_button(bool do_restore)
Definition mapview.c:76
dirty_all
void dirty_all(void)
Definition mapview.c:456
tileset_changed
void tileset_changed(void)
Definition mapview.c:782
put_cross_overlay_tile
void put_cross_overlay_tile(struct tile *ptile)
Definition mapview.c:643
draw_selection_rectangle
void draw_selection_rectangle(int canvas_x, int canvas_y, int w, int h)
Definition mapview.c:749
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
start_turn
void start_turn(void)
Definition mapview.c:805
update_unit_info_label
void update_unit_info_label(struct unit_list *punits)
Definition mapview.c:275
update_overview_scroll_window_pos
void update_overview_scroll_window_pos(int x, int y)
Definition mapview.c:657
update_city_descriptions
void update_city_descriptions(void)
Definition mapview.c:488
gui_flush
void gui_flush(void)
Definition mapview.c:480
update_map_canvas_scrollbars
void update_map_canvas_scrollbars(void)
Definition mapview.c:681
overview_size_changed
void overview_size_changed(void)
Definition mapview.c:326
map_canvas_size_refresh
void map_canvas_size_refresh(void)
Definition mapview.c:414
get_overview_window
struct canvas * get_overview_window(void)
Definition mapview.c:337
set_indicator_icons
void set_indicator_icons(struct sprite *bulb, struct sprite *sol, struct sprite *flake, struct sprite *gov)
Definition mapview.c:302
get_current_client_page
enum client_pages get_current_client_page(void)
Definition pages.c:3343
get_theme_color
SDL_Color * get_theme_color(enum theme_color themecolor)
Definition colors.c:47
sdl_get_tile_defense_info_text
const char * sdl_get_tile_defense_info_text(struct tile *ptile)
Definition dialogs.c:1306
main_window_width
int main_window_width(void)
Definition graphics.c:685
update_main_screen
void update_main_screen(void)
Definition graphics.c:669
create_line
void create_line(SDL_Surface *dest, Sint16 x0, Sint16 y0, Sint16 x1, Sint16 y1, SDL_Color *pcolor)
Definition graphics.c:1381
alphablit
int alphablit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect, unsigned char alpha_mod)
Definition graphics.c:199
screen_blit
int screen_blit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Rect *dstrect, unsigned char alpha_mod)
Definition graphics.c:223
main_data
struct sdl2_data main_data
Definition graphics.c:57
blit_entire_src
int blit_entire_src(SDL_Surface *psrc, SDL_Surface *pdest, Sint16 dest_x, Sint16 dest_y)
Definition graphics.c:417
create_surf
SDL_Surface * create_surf(int width, int height, Uint32 flags)
Definition graphics.c:351
correct_rect_region
bool correct_rect_region(SDL_Rect *prect)
Definition graphics.c:888
screen_rect_to_layer_rect
void screen_rect_to_layer_rect(struct gui_layer *gui_layer, SDL_Rect *dest_rect)
Definition graphics.c:173
create_frame
void create_frame(SDL_Surface *dest, Sint16 left, Sint16 top, Sint16 width, Sint16 height, SDL_Color *pcolor)
Definition graphics.c:1350
main_window_height
int main_window_height(void)
Definition graphics.c:693
resize_surface_box
SDL_Surface * resize_surface_box(const SDL_Surface *psrc, Uint16 new_width, Uint16 new_height, int smooth, bool scale_up, bool absolute_dimensions)
Definition graphics.c:1257
FREESURFACE
#define FREESURFACE(ptr)
Definition graphics.h:322
RECT_LIMIT
#define RECT_LIMIT
Definition graphics.h:45
adj_surf
#define adj_surf(surf)
Definition graphics.h:200
map_rgba
#define map_rgba(format, color)
Definition graphics.h:315
ID_COOLING_ICON
@ ID_COOLING_ICON
Definition gui_id.h:138
ID_WARMING_ICON
@ ID_WARMING_ICON
Definition gui_id.h:139
ID_ICON
@ ID_ICON
Definition gui_id.h:33
enable_focus_animation
void enable_focus_animation(void)
Definition gui_main.c:1200
flush_event
bool flush_event(void)
Definition gui_main.c:1345
disable_focus_animation
void disable_focus_animation(void)
Definition gui_main.c:1209
CF_FOCUS_ANIMATION
#define CF_FOCUS_ANIMATION
Definition gui_main.h:51
CF_OVERVIEW_SHOWN
#define CF_OVERVIEW_SHOWN
Definition gui_main.h:48
adj_size
#define adj_size(size)
Definition gui_main.h:141
PRESSED_EVENT
#define PRESSED_EVENT(event)
Definition gui_main.h:71
CF_UNITINFO_SHOWN
#define CF_UNITINFO_SHOWN
Definition gui_main.h:47
draw_mouse_cursor
void draw_mouse_cursor(void)
Definition gui_mouse.c:100
copy_chars_to_utf8_str
utf8_str * copy_chars_to_utf8_str(utf8_str *pstr, const char *pchars)
Definition gui_string.c:251
create_text_surf_from_utf8
SDL_Surface * create_text_surf_from_utf8(utf8_str *pstr)
Definition gui_string.c:425
change_fonto_utf8
void change_fonto_utf8(utf8_str *pstr, enum font_origin origin)
Definition gui_string.c:584
create_utf8_str_fonto
utf8_str * create_utf8_str_fonto(char *in_text, size_t n_alloc, enum font_origin origin)
Definition gui_string.c:241
create_text_surf_smaller_than_w
SDL_Surface * create_text_surf_smaller_than_w(utf8_str *pstr, int w)
Definition gui_string.c:539
create_utf8_from_char
#define create_utf8_from_char(string_in, ptsize)
Definition gui_string.h:103
FREEUTF8STR
#define FREEUTF8STR(pstr)
Definition gui_string.h:93
SF_CENTER
#define SF_CENTER
Definition gui_string.h:40
FONTO_HEADING
@ FONTO_HEADING
Definition gui_string.h:69
FONTO_DEFAULT
@ FONTO_DEFAULT
Definition gui_string.h:65
FONTO_ATTENTION
@ FONTO_ATTENTION
Definition gui_string.h:67
create_utf8_from_char_fonto
#define create_utf8_from_char_fonto(string_in, fonto)
Definition gui_string.h:108
get_tax_surface
static SDL_Surface * get_tax_surface(Output_type_id otype)
Definition gui_tilespec.h:269
get_unittype_surface
static SDL_Surface * get_unittype_surface(const struct unit_type *punittype, enum direction8 facing)
Definition gui_tilespec.h:259
get_minimap_window_widget
struct widget * get_minimap_window_widget(void)
Definition mapctrl.c:2203
get_research_widget
struct widget * get_research_widget(void)
Definition mapctrl.c:2219
resize_minimap
int resize_minimap(void)
Definition mapctrl.c:554
get_unit_info_window_widget
struct widget * get_unit_info_window_widget(void)
Definition mapctrl.c:2195
get_revolution_widget
struct widget * get_revolution_widget(void)
Definition mapctrl.c:2227
get_tax_rates_widget
struct widget * get_tax_rates_widget(void)
Definition mapctrl.c:2211
DEFAULT_UNITS_W
#define DEFAULT_UNITS_W
Definition mapctrl.h:55
DEFAULT_UNITS_H
#define DEFAULT_UNITS_H
Definition mapctrl.h:56
BLOCKU_W
#define BLOCKU_W
Definition mapctrl.h:52
DEFAULT_OVERVIEW_W
#define DEFAULT_OVERVIEW_W
Definition mapctrl.h:53
DEFAULT_OVERVIEW_H
#define DEFAULT_OVERVIEW_H
Definition mapctrl.h:54
real_focus_units_changed
void real_focus_units_changed(void)
Definition mapview.c:1006
set_unit_icons_more_arrow
void set_unit_icons_more_arrow(bool onoff)
Definition mapview.c:996
set_unit_icon
void set_unit_icon(int idx, struct unit *punit)
Definition mapview.c:985
is_focus_anim_enabled
static bool is_focus_anim_enabled(void)
Definition mapview.c:974
create_city_map
SDL_Surface * create_city_map(struct city *pcity)
Definition mapview.c:1196
flush_mapcanvas
static void flush_mapcanvas(int canvas_x, int canvas_y, int pixel_width, int pixel_height)
Definition mapview.c:92
refresh_overview
void refresh_overview(void)
Definition mapview.c:1119
is_flush_queued
static bool is_flush_queued
Definition mapview.c:87
flush_rect
void flush_rect(SDL_Rect *rect, bool force_flush)
Definition mapview.c:103
get_terrain_surface
SDL_Surface * get_terrain_surface(struct tile *ptile)
Definition mapview.c:1212
dirty_sdl_rect
void dirty_sdl_rect(SDL_Rect *Rect)
Definition mapview.c:181
queue_flush
void queue_flush(void)
Definition mapview.c:152
focus_units_info_callback
static int focus_units_info_callback(struct widget *pwidget)
Definition mapview.c:499
info_area
SDL_Rect * info_area
Definition widget.c:49
redraw_unit_info_label
void redraw_unit_info_label(struct unit_list *punitlist)
Definition mapview.c:517
overview_start_x
int overview_start_x
Definition mapview.c:73
unqueue_flush
void unqueue_flush(void)
Definition mapview.c:140
terrain_canvas
static struct canvas * terrain_canvas
Definition mapview.c:78
city_map_canvas_free
void city_map_canvas_free(void)
Definition mapview.c:1185
overview_start_y
int overview_start_y
Definition mapview.c:74
flush_all
void flush_all(void)
Definition mapview.c:201
GET_SURF
#define GET_SURF(m_sprite)
Definition sprite.h:29
COLOR_THEME_MAPVIEW_UNITINFO_VETERAN_TEXT
@ COLOR_THEME_MAPVIEW_UNITINFO_VETERAN_TEXT
Definition themecolors.h:97
COLOR_THEME_MAPVIEW_INFO_TEXT
@ COLOR_THEME_MAPVIEW_INFO_TEXT
Definition themecolors.h:95
COLOR_THEME_MAPVIEW_INFO_FRAME
@ COLOR_THEME_MAPVIEW_INFO_FRAME
Definition themecolors.h:94
COLOR_THEME_SELECTIONRECTANGLE
@ COLOR_THEME_SELECTIONRECTANGLE
Definition themecolors.h:37
COLOR_THEME_MAPVIEW_UNITINFO_TEXT
@ COLOR_THEME_MAPVIEW_UNITINFO_TEXT
Definition themecolors.h:96
redraw_widget_info_label
void redraw_widget_info_label(SDL_Rect *rect)
Definition widget.c:467
get_widget_pointer_from_main_list
struct widget * get_widget_pointer_from_main_list(Uint16 id)
Definition widget.c:578
widget_add_as_prev
void widget_add_as_prev(struct widget *new_widget, struct widget *add_dock)
Definition widget.c:602
setup_vertical_widgets_position
int setup_vertical_widgets_position(int step, Sint16 start_x, Sint16 start_y, Uint16 w, Uint16 h, struct widget *begin, struct widget *end)
Definition widget.c:1051
redraw_group
Uint16 redraw_group(const struct widget *begin_group_widget_list, const struct widget *end_group_widget_list, int add_to_update)
Definition widget.c:720
FC_WS_NORMAL
@ FC_WS_NORMAL
Definition widget.h:96
widget_mark_dirty
static void widget_mark_dirty(struct widget *pwidget)
Definition widget.h:286
set_wstate
void set_wstate(struct widget *pwidget, enum widget_state state)
Definition widget_core.c:36
WF_WIDGET_HAS_INFO_LABEL
@ WF_WIDGET_HAS_INFO_LABEL
Definition widget.h:88
WF_RESTORE_BACKGROUND
@ WF_RESTORE_BACKGROUND
Definition widget.h:85
WF_HIDDEN
@ WF_HIDDEN
Definition widget.h:68
WF_FREE_THEME
@ WF_FREE_THEME
Definition widget.h:72
widget_redraw
static int widget_redraw(struct widget *pwidget)
Definition widget.h:276
set_wflag
void set_wflag(struct widget *pwidget, enum widget_flag flag)
Definition widget_core.c:54
del_group
#define del_group(begin_group_widget_list, end_group_widget_list)
Definition widget.h:389
create_icon2
struct widget * create_icon2(SDL_Surface *icon, struct gui_layer *pdest, Uint32 flags)
Definition widget_icon.c:337
set_new_icon2_theme
void set_new_icon2_theme(struct widget *icon_widget, SDL_Surface *new_theme, bool free_old_theme)
Definition widget_icon.c:321
create_vertical_scrollbar
Uint32 create_vertical_scrollbar(struct advanced_dialog *dlg, Uint8 step, Uint8 active, bool create_scrollbar, bool create_buttons)
Definition widget_scrollbar.c:486
hide_scrollbar
#define hide_scrollbar(scrollbar)
Definition widget_scrollbar.h:36
show_scrollbar
#define show_scrollbar(scrollbar)
Definition widget_scrollbar.h:59
gui_id.h
sdl3_client_flags
Uint32 sdl3_client_flags
Definition gui_main.c:97
gui_mouse.h
gui_tilespec.h
themespec.h
widget.h
colors.h
dialogs.h
graphics.h
gui_main.h
mapctrl.h
mapview.h
sprite.h
name
const char * name
Definition inputfile.c:127
log.h
fc_assert
#define fc_assert(condition)
Definition log.h:176
log_debug
#define log_debug(message,...)
Definition log.h:115
current_wrap_has_flag
#define current_wrap_has_flag(flag)
Definition map.h:46
redraw_selection_rectangle
void redraw_selection_rectangle(void)
Definition mapctrl_common.c:277
put_terrain
void put_terrain(struct tile *ptile, struct canvas *pcanvas, float zoom, int canvas_x, int canvas_y)
Definition mapview_common.c:1435
mapview
struct view mapview
Definition mapview_common.c:75
put_unit
void put_unit(const struct unit *punit, struct canvas *pcanvas, float zoom, int canvas_x, int canvas_y)
Definition mapview_common.c:1389
show_city_descriptions
void show_city_descriptions(int canvas_base_x, int canvas_base_y, int width_base, int height_base)
Definition mapview_common.c:2363
map_canvas_resized
bool map_canvas_resized(int width, int height)
Definition mapview_common.c:3564
dirty_rect
dirty_rect
Definition mapview_g.h:47
pixel_width
int int int pixel_width
Definition mapview_g.h:48
move_points_text
const char * move_points_text(int mp, bool reduce)
Definition movement.c:1016
movement.h
nation_adjective_for_player
const char * nation_adjective_for_player(const struct player *pplayer)
Definition nation.c:169
nation_plural_for_player
const char * nation_plural_for_player(const struct player *pplayer)
Definition nation.c:178
gui_options
struct client_options gui_options
Definition options.c:71
OVERVIEW_TILE_SIZE
int OVERVIEW_TILE_SIZE
Definition overview_common.c:33
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
pages_g.h
player_diplstate_get
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Definition player.c:324
pplayers_allied
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1409
is_human
#define is_human(plr)
Definition player.h:231
research_advance_name_translation
const char * research_advance_name_translation(const struct research *presearch, Tech_type_id tech)
Definition research.c:273
research_get
struct research * research_get(const struct player *pplayer)
Definition research.c:128
research.h
MIN
#define MIN(x, y)
Definition shared.h:55
y
struct sprite int int y
Definition sprite_g.h:31
x
struct sprite int x
Definition sprite_g.h:31
advanced_dialog
Definition widget.h:180
advanced_dialog::begin_active_widget_list
struct widget * begin_active_widget_list
Definition widget.h:184
advanced_dialog::end_active_widget_list
struct widget * end_active_widget_list
Definition widget.h:185
advanced_dialog::active_widget_list
struct widget * active_widget_list
Definition widget.h:186
advanced_dialog::scroll
struct scroll_bar * scroll
Definition widget.h:187
astring
Definition astring.h:36
canvas
Definition canvas.h:22
canvas::surf
SDL_Surface * surf
Definition canvas.h:27
city_map_canvas
Definition citydlg.c:131
city
Definition city.h:320
civ_game::info
struct packet_game_info info
Definition game.h:89
civclient::conn
struct connection conn
Definition client_main.h:96
client_options::overview
struct overview overview
Definition options.h:463
client_options::ai_manual_turn_done
bool ai_manual_turn_done
Definition options.h:155
connection::playing
struct player * playing
Definition connection.h:151
gui_layer::surface
SDL_Surface * surface
Definition graphics.h:229
gui_layer::dest_rect
SDL_Rect dest_rect
Definition graphics.h:228
overview::width
int width
Definition options.h:94
overview::height
int height
Definition options.h:94
packet_game_info::borders
enum borders_mode borders
Definition packets_gen.h:133
player_diplstate
Definition player.h:198
player_economic::luxury
int luxury
Definition player.h:66
player_economic::science
int science
Definition player.h:65
player_economic::tax
int tax
Definition player.h:64
player_economic::gold
int gold
Definition player.h:63
player
Definition player.h:249
player::economic
struct player_economic economic
Definition player.h:284
player::phase_done
bool phase_done
Definition player.h:263
research
Definition research.h:39
scroll_bar::active
Uint8 active
Definition widget_scrollbar.h:24
scroll_bar::up_left_button
struct widget * up_left_button
Definition widget_scrollbar.h:21
scroll_bar::step
Uint8 step
Definition widget_scrollbar.h:25
scroll_bar::down_right_button
struct widget * down_right_button
Definition widget_scrollbar.h:23
scroll_bar::count
Uint16 count
Definition widget_scrollbar.h:27
sdl2_data::guis_count
int guis_count
Definition graphics.h:207
sdl2_data::gui
struct gui_layer * gui
Definition graphics.h:215
sdl2_data::rects_count
int rects_count
Definition graphics.h:206
sdl2_data::event
SDL_Event event
Definition graphics.h:217
sdl2_data::rects
SDL_Rect rects[RECT_LIMIT]
Definition graphics.h:208
sdl2_data::guis
struct gui_layer ** guis
Definition graphics.h:216
sdl2_data::screen
SDL_Window * screen
Definition graphics.h:209
sdl2_data::map
SDL_Surface * map
Definition graphics.h:210
sprite
Definition sprite.h:22
tile
Definition tile.h:50
tile::units
struct unit_list * units
Definition tile.h:58
tileset
Definition tilespec.c:482
unit_type
Definition unittype.h:507
unit
Definition unit.h:140
unit::facing
enum direction8 facing
Definition unit.h:144
unit::veteran
int veteran
Definition unit.h:154
utf8_str
Definition gui_string.h:52
view::store_width
int store_width
Definition mapview_common.h:40
view::store_height
int store_height
Definition mapview_common.h:40
view::store
struct canvas * store
Definition mapview_common.h:42
widget
Definition widget.h:112
widget::unit
struct unit * unit
Definition widget.h:129
widget::area
SDL_Rect area
Definition widget.h:149
widget::size
SDL_Rect size
Definition widget.h:145
widget::data
union widget::@217 data
fc_snprintf
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:960
cat_snprintf
int cat_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:986
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
A_UNSET
#define A_UNSET
Definition tech.h:48
get_tile_output_text
const char * get_tile_output_text(const struct tile *ptile)
Definition text.c:63
get_unit_info_label_text2
const char * get_unit_info_label_text2(struct unit_list *punits, int linebreaks)
Definition text.c:1092
text.h
tile_city
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
TILE_LB_RESOURCE_POLL
#define TILE_LB_RESOURCE_POLL
Definition tile.h:178
tile_owner
#define tile_owner(_tile)
Definition tile.h:97
tileset_full_tile_height
int tileset_full_tile_height(const struct tileset *t)
Definition tilespec.c:790
tileset_full_tile_width
int tileset_full_tile_width(const struct tileset *t)
Definition tilespec.c:777
unit_activity_astr
void unit_activity_astr(const struct unit *punit, struct astring *astr)
Definition unit.c:1185
unit_tile
#define unit_tile(_pu)
Definition unit.h:397
unit_owner
#define unit_owner(_pu)
Definition unit.h:396
unitlist.h
unit_list_iterate
#define unit_list_iterate(unitlist, punit)
Definition unitlist.h:31
unit_list_iterate_end
#define unit_list_iterate_end
Definition unitlist.h:33
utype_veteran_name_translation
const char * utype_veteran_name_translation(const struct unit_type *punittype, int level)
Definition unittype.c:2598
unit_type_get
const struct unit_type * unit_type_get(const struct unit *punit)
Definition unittype.c:123
unit_name_translation
const char * unit_name_translation(const struct unit *punit)
Definition unittype.c:1569
utype_name_translation
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1560
get_client_page
enum client_pages get_client_page(void)
Definition update_queue.c:520
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_NATIVE_HEIGHT
#define MAP_NATIVE_HEIGHT
Definition world_object.h:56