Freeciv-3.2
Loading...
Searching...
No Matches
plrdlg.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#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* SDL3 */
19#include <SDL3/SDL.h>
20
21/* utility */
22#include "astring.h"
23#include "fcintl.h"
24
25/* common */
26#include "nation.h"
27
28/* client */
29#include "client_main.h"
30#include "climisc.h"
31
32/* gui-sdl3 */
33#include "chatline.h"
34#include "colors.h"
35#include "diplodlg.h"
36#include "graphics.h"
37#include "gui_id.h"
38#include "gui_main.h"
39#include "gui_tilespec.h"
40#include "inteldlg.h"
41#include "mapview.h"
42#include "sprite.h"
43#include "themespec.h"
44#include "widget.h"
45
46#include "plrdlg.h"
47
48#ifndef M_PI
49#define M_PI 3.14159265358979323846 /* pi */
50#endif
51#ifndef M_PI_2
52#define M_PI_2 1.57079632679489661923 /* pi/2 */
53#endif
54
56
57static int player_nation_callback(struct widget *pwidget);
58
59/**********************************************************************/
62static int exit_players_dlg_callback(struct widget *pwidget)
63{
67 }
68
69 return -1;
70}
71
72/**********************************************************************/
75static int player_callback(struct widget *pwidget)
76{
77 /* We want exactly same functionality that the small dialog has. */
78 return player_nation_callback(pwidget);
79}
80
81/**********************************************************************/
84static int players_window_dlg_callback(struct widget *pwindow)
85{
90 } else {
92 widget_flush(pwindow);
93 }
94 }
95 }
96
97 return -1;
98}
99
100/**********************************************************************/
103static int toggle_draw_war_status_callback(struct widget *pwidget)
104{
106 /* exit button -> neutral -> war -> casefire -> peace -> alliance */
107 struct widget *pplayer = pplayers_dlg->end_widget_list->prev->prev->prev->prev->prev->prev;
108
110 do {
111 pplayer = pplayer->prev;
112 FREESURFACE(pplayer->gfx);
113 } while (pplayer != pplayers_dlg->begin_widget_list);
114
116 }
117
118 return -1;
119}
120
121/**********************************************************************/
125{
127 /* Exit button -> neutral -> war -> casefire -> peace -> alliance */
128 struct widget *pplayer = pplayers_dlg->end_widget_list->prev->prev->prev->prev->prev->prev;
129
131 do {
132 pplayer = pplayer->prev;
133 FREESURFACE(pplayer->gfx);
134 } while (pplayer != pplayers_dlg->begin_widget_list);
135
137 }
138
139 return -1;
140}
141
142/**********************************************************************/
145static int toggle_draw_peace_status_callback(struct widget *pwidget)
146{
148 /* Exit button -> neutral -> war -> casefire -> peace -> alliance */
149 struct widget *pplayer = pplayers_dlg->end_widget_list->prev->prev->prev->prev->prev->prev;
150
152 do {
153 pplayer = pplayer->prev;
154 FREESURFACE(pplayer->gfx);
155 } while (pplayer != pplayers_dlg->begin_widget_list);
156
158 }
159
160 return -1;
161}
162
163/**********************************************************************/
167{
169 /* Exit button -> neutral -> war -> casefire -> peace -> alliance */
170 struct widget *pplayer = pplayers_dlg->end_widget_list->prev->prev->prev->prev->prev->prev;
171
173 do {
174 pplayer = pplayer->prev;
175 FREESURFACE(pplayer->gfx);
176 } while (pplayer != pplayers_dlg->begin_widget_list);
177
179 }
180
181 return -1;
182}
183
184/**********************************************************************/
188{
190 /* Exit button -> neutral -> war -> casefire -> peace -> alliance */
191 struct widget *pplayer = pplayers_dlg->end_widget_list->prev->prev->prev->prev->prev->prev;
192
194 do {
195 pplayer = pplayer->prev;
196 FREESURFACE(pplayer->gfx);
197 } while (pplayer != pplayers_dlg->begin_widget_list);
198
200 }
201
202 return -1;
203}
204
205/**********************************************************************/
208static bool have_diplomat_info_about(struct player *pplayer)
209{
210 return (pplayer == client.conn.playing
211 || (pplayer != client.conn.playing
212 && team_has_embassy(client.conn.playing->team, pplayer)));
213}
214
215/**********************************************************************/
219{
220 if (pplayers_dlg) {
221 struct widget *pplayer0, *pplayer1;
222 struct player *pplayer;
223 int i;
224 struct astring astr = ASTRING_INIT;
225
226 /* redraw window */
228
229 /* exit button -> neutral -> war -> casefire -> peace -> alliance */
231 do {
234 pplayer = pplayer0->data.player;
235
236 for (i = 0; i < num_player_dlg_columns; i++) {
238 switch (player_dlg_columns[i].type) {
239 case COL_TEXT:
240 case COL_RIGHT_TEXT:
242 player_dlg_columns[i].func(pplayer));
243 break;
244 case COL_BOOLEAN:
246 player_dlg_columns[i].bool_func(pplayer) ?
247 _("Yes") : _("No"));
248 break;
249 default:
250 break;
251 }
252 }
253 }
254
256
257 astr_free(&astr);
258
259 /* now add some eye candy ... */
262
263 dst0.x = pplayer0->size.x + pplayer0->size.w / 2;
264 dst0.y = pplayer0->size.y + pplayer0->size.h / 2;
265
266 do {
267 pplayer1 = pplayer1->prev;
268 if (have_diplomat_info_about(pplayer)
269 || have_diplomat_info_about(pplayer1->data.player)) {
270
271 dst1.x = pplayer1->size.x + pplayer1->size.w / 2;
272 dst1.y = pplayer1->size.y + pplayer1->size.h / 2;
273
274 switch (player_diplstate_get(pplayer,
275 pplayer1->data.player)->type) {
276 case DS_ARMISTICE:
278 create_line(pplayer1->dst->surface,
279 dst0.x, dst0.y, dst1.x, dst1.y,
281 }
282 break;
283 case DS_WAR:
285 create_line(pplayer1->dst->surface,
286 dst0.x, dst0.y, dst1.x, dst1.y,
288 }
289 break;
290 case DS_CEASEFIRE:
292 create_line(pplayer1->dst->surface,
293 dst0.x, dst0.y, dst1.x, dst1.y,
295 }
296 break;
297 case DS_PEACE:
299 create_line(pplayer1->dst->surface,
300 dst0.x, dst0.y, dst1.x, dst1.y,
302 }
303 break;
304 case DS_ALLIANCE:
306 create_line(pplayer1->dst->surface,
307 dst0.x, dst0.y, dst1.x, dst1.y,
309 }
310 break;
311 default:
312 /* no contact */
313 break;
314 }
315 }
317 }
319
320 /* -------------------- */
321 /* redraw */
325
326 flush_dirty();
327 }
328}
329
330/**********************************************************************/
334{
335 struct widget *pwindow = NULL, *buf = NULL;
337 utf8_str *pstr;
339 int i, n, h;
340 double a, b, r;
342
343 if (pplayers_dlg) {
344 return;
345 }
346
347 n = 0;
348 players_iterate(pplayer) {
349 if (is_barbarian(pplayer)) {
350 continue;
351 }
352 n++;
354
355 if (n < 2) {
356 return;
357 }
358
359 pplayers_dlg = fc_calloc(1, sizeof(struct small_dialog));
360
361 pstr = create_utf8_from_char_fonto(Q_("?header:Players"),
363 pstr->style |= TTF_STYLE_BOLD;
364
365 pwindow = create_window_skeleton(NULL, pstr, 0);
366
368 set_wstate(pwindow, FC_WS_NORMAL);
369
370 add_to_gui_list(ID_WINDOW, pwindow);
371 pplayers_dlg->end_widget_list = pwindow;
372 /* ---------- */
373 /* Exit button */
374 buf = create_themeicon(current_theme->small_cancel_icon, pwindow->dst,
376 buf->info_label = create_utf8_from_char_fonto(_("Close Dialog (Esc)"),
380 buf->key = SDLK_ESCAPE;
381
383 /* ---------- */
384
385 for (i = 0; i < DS_LAST; i++) {
386 switch (i) {
387 case DS_ARMISTICE:
388 buf = create_checkbox(pwindow->dst,
392 buf->key = SDLK_N;
393 break;
394 case DS_WAR:
395 buf = create_checkbox(pwindow->dst,
399 buf->key = SDLK_W;
400 break;
401 case DS_CEASEFIRE:
402 buf = create_checkbox(pwindow->dst,
406 buf->key = SDLK_C;
407 break;
408 case DS_PEACE:
409 buf = create_checkbox(pwindow->dst,
413 buf->key = SDLK_P;
414 break;
415 case DS_ALLIANCE:
416 buf = create_checkbox(pwindow->dst,
420 buf->key = SDLK_A;
421 break;
422 default:
423 /* no contact */
424 continue;
425 break;
426 }
429 }
430 /* ---------- */
431
432 players_iterate(pplayer) {
433 if (is_barbarian(pplayer)) {
434 continue;
435 }
436
438 pstr->style |= (TTF_STYLE_BOLD|SF_CENTER);
439
441 {
442 /* Aim for a flag height of 60 pixels, but draw smaller flags if there
443 * are more players */
444 double zoom = DEFAULT_ZOOM * (60.0 - n) / logo->h;
445
446 zoomed = zoomSurface(logo, zoom, zoom, 1);
447 }
448
449 buf = create_icon2(zoomed, pwindow->dst,
451 | WF_FREE_THEME);
452 buf->info_label = pstr;
453
454 if (!pplayer->is_alive) {
456 pstr->style |= TTF_STYLE_BOLD;
460
461 dst.x = (zoomed->w - logo->w) / 2;
462 dst.y = (zoomed->h - logo->h) / 2;
463 alphablit(logo, NULL, zoomed, &dst, 255);
465 }
466
467 if (pplayer->is_alive) {
469 }
470
471 buf->data.player = pplayer;
472
473 buf->action = player_callback;
474
476
478
480
481 resize_window(pwindow, NULL, NULL, adj_size(500), adj_size(400));
482
483 area = pwindow->area;
484
485 r = MIN(area.w, area.h);
486 r -= ((MAX(buf->size.w, buf->size.h) * 2));
487 r /= 2;
488 a = (2.0 * M_PI) / n;
489
490 widget_set_position(pwindow,
491 (main_window_width() - pwindow->size.w) / 2,
492 (main_window_height() - pwindow->size.h) / 2);
493
494 /* exit button */
495 buf = pwindow->prev;
496
497 buf->size.x = area.x + area.w - buf->size.w - 1;
498 buf->size.y = pwindow->size.y + adj_size(2);
499
500 n = area.y;
502 pstr->style |= TTF_STYLE_BOLD;
503 pstr->bgcol = (SDL_Color) {0, 0, 0, 0};
504
505 for (i = 0; i < DS_LAST; i++) {
506 switch (i) {
507 case DS_ARMISTICE:
509 break;
510 case DS_WAR:
512 break;
513 case DS_CEASEFIRE:
515 break;
516 case DS_PEACE:
518 break;
519 case DS_ALLIANCE:
521 break;
522 default:
523 /* no contact */
524 continue;
525 break;
526 }
527
530
531 buf = buf->prev;
532 h = MAX(buf->size.h, logo->h);
533 buf->size.x = area.x + adj_size(5);
534 buf->size.y = n + (h - buf->size.h) / 2;
535
536 dst.x = adj_size(5) + buf->size.w + adj_size(6);
537 dst.y = n + (h - logo->h) / 2;
538 alphablit(logo, NULL, pwindow->theme, &dst, 255);
539 n += h;
541 }
543
544 /* first player shield */
545 buf = buf->prev;
546 buf->size.x = area.x + area.w / 2 - buf->size.w / 2;
547 buf->size.y = area.y + area.h / 2 - r - buf->size.h / 2;
548
549 n = 1;
551 do {
552 buf = buf->prev;
553 b = M_PI_2 + n * a;
554 buf->size.x = area.x + area.w / 2 - r * cos(b) - buf->size.w / 2;
555 buf->size.y = area.y + area.h / 2 - r * sin(b) - buf->size.h / 2;
556 n++;
557 } while (buf != pplayers_dlg->begin_widget_list);
558 }
559
561}
562
563/**********************************************************************/
574
575
576/* ============================== SHORT =============================== */
578
579/**********************************************************************/
583{
584 return -1;
585}
586
587/**********************************************************************/
590static int exit_players_nations_dlg_callback(struct widget *pwidget)
591{
594 flush_dirty();
595 }
596
597 return -1;
598}
599
600/**********************************************************************/
603static int player_nation_callback(struct widget *pwidget)
604{
605 struct player *pplayer = pwidget->data.player;
606 bool try_dlg = FALSE;
607 bool popdown = FALSE;
608
610 switch (main_data.event.button.button) {
611#if 0
612 case SDL_BUTTON_LEFT:
613
614 break;
616
617 break;
618#endif /* 0 */
619 case SDL_BUTTON_RIGHT:
620 popup_intel_dialog(pplayer);
621
622 popdown = TRUE;
623 break;
624 default:
625 try_dlg = TRUE;
626 break;
627 }
628 } else if (PRESSED_EVENT(main_data.event)) {
629 try_dlg = TRUE;
630 }
631
632 if (try_dlg && pplayer != client_player()) {
633 const struct player_diplstate *ds;
634
636
637 if (ds->type != DS_NO_CONTACT
638 && (ds->type != DS_WAR
639 || can_meet_with_player(pplayer)
640 || can_intel_with_player(pplayer))) {
641 popup_diplomacy_dialog(pplayer);
642
643 popdown = TRUE;
644 } else {
645 set_output_window_text(_("You cannot interact with that player "
646 "with your current contact state - "
647 "Try right mouse button for intelligence."));
648 }
649 }
650
651 if (popdown) {
652 /* We came from one of these dialogs. Just try to pop down both -
653 * the one open will react. */
656 }
657
658 return -1;
659}
660
661/**********************************************************************/
665{
666 struct widget *pwindow = NULL, *buf = NULL;
668 utf8_str *pstr;
669 char cbuf[128], *state;
670 int n = 0, w = 0, units_h = 0;
672
673 if (short_players_dlg) {
674 return;
675 }
676
677 short_players_dlg = fc_calloc(1, sizeof(struct advanced_dialog));
678
679 /* TRANS: Nations report title */
681 pstr->style |= TTF_STYLE_BOLD;
682
683 pwindow = create_window_skeleton(NULL, pstr, 0);
684
686 set_wstate(pwindow, FC_WS_NORMAL);
687
688 add_to_gui_list(ID_WINDOW, pwindow);
690
691 area = pwindow->area;
692
693 /* ---------- */
694 /* Exit button */
695 buf = create_themeicon(current_theme->small_cancel_icon, pwindow->dst,
697 buf->info_label = create_utf8_from_char_fonto(_("Close Dialog (Esc)"),
699 area.w = MAX(area.w, buf->size.w + adj_size(10));
702 buf->key = SDLK_ESCAPE;
703
705 /* ---------- */
706
707 players_iterate(pplayer) {
708 if (pplayer != client.conn.playing) {
709 const struct player_diplstate *ds;
710
711 if (!pplayer->is_alive || is_barbarian(pplayer)) {
712 continue;
713 }
714
716
717 if (is_ai(pplayer)) {
718 state = _("AI");
719 } else {
720 if (pplayer->is_connected) {
721 if (pplayer->phase_done) {
722 state = _("done");
723 } else {
724 state = _("moving");
725 }
726 } else {
727 state = _("disconnected");
728 }
729 }
730
731 if (ds->type == DS_CEASEFIRE) {
732 fc_snprintf(cbuf, sizeof(cbuf), "%s(%s) - %d %s",
734 state,
735 ds->turns_left, PL_("turn", "turns", ds->turns_left));
736 } else {
737 fc_snprintf(cbuf, sizeof(cbuf), "%s(%s)",
739 state);
740 }
741
743 pstr->style |= TTF_STYLE_BOLD;
744
746
747 buf = create_iconlabel(logo, pwindow->dst, pstr,
749
750 /* At least RMB works always */
752
753 /* Now add some eye candy ... */
754 switch (ds->type) {
755 case DS_ARMISTICE:
756 buf->string_utf8->fgcol = *get_theme_color(COLOR_THEME_PLRDLG_ARMISTICE);
757 break;
758 case DS_WAR:
759 if (can_meet_with_player(pplayer) || can_intel_with_player(pplayer)) {
760 buf->string_utf8->fgcol = *get_theme_color(COLOR_THEME_PLRDLG_WAR);
761 } else {
762 buf->string_utf8->fgcol = *(get_theme_color(COLOR_THEME_PLRDLG_WAR_RESTRICTED));
763 }
764 break;
765 case DS_CEASEFIRE:
766 buf->string_utf8->fgcol = *get_theme_color(COLOR_THEME_PLRDLG_CEASEFIRE);
767 break;
768 case DS_PEACE:
769 buf->string_utf8->fgcol = *get_theme_color(COLOR_THEME_PLRDLG_PEACE);
770 break;
771 case DS_ALLIANCE:
772 buf->string_utf8->fgcol = *get_theme_color(COLOR_THEME_PLRDLG_ALLIANCE);
773 break;
774 case DS_NO_CONTACT:
775 buf->string_utf8->fgcol = *(get_theme_color(COLOR_THEME_PLRDLG_NO_CONTACT));
776 break;
777 case DS_TEAM:
778 case DS_LAST:
779 break;
780 }
781
782 buf->string_utf8->bgcol = (SDL_Color) {0, 0, 0, 0};
783
784 buf->data.player = pplayer;
785
786 buf->action = player_nation_callback;
787
789
790 area.w = MAX(w, buf->size.w);
791 area.h += buf->size.h;
792
793 if (n > 19) {
795 }
796
797 n++;
798 }
800
805
806
807 /* ---------- */
808 if (n > 20) {
811
812 n = units_h;
813 area.w += n;
814
815 units_h = 20 * buf->size.h;
816
817 } else {
818 units_h = area.h;
819 }
820
821 /* ---------- */
822
823 area.h = units_h;
824
825 resize_window(pwindow, NULL, NULL,
826 (pwindow->size.w - pwindow->area.w) + area.w,
827 (pwindow->size.h + pwindow->area.h) + area.h);
828
829 area = pwindow->area;
830
831 widget_set_position(pwindow,
832 ((main_data.event.motion.x + pwindow->size.w + adj_size(10) < main_window_width()) ?
833 (main_data.event.motion.x + adj_size(10)) :
834 (main_window_width() - pwindow->size.w - adj_size(10))),
835 ((main_data.event.motion.y - adj_size(2) + pwindow->size.h < main_window_height()) ?
836 (main_data.event.motion.y - adj_size(2)) :
837 (main_window_height() - pwindow->size.h - adj_size(10))));
838
839 w = area.w;
840
842 w -= n;
843 }
844
845 /* exit button */
846 buf = pwindow->prev;
847 buf->size.x = area.x + area.w - buf->size.w - 1;
848 buf->size.y = pwindow->size.y + adj_size(2);
849
850 /* cities */
851 buf = buf->prev;
852 setup_vertical_widgets_position(1, area.x, area.y, w, 0,
854 buf);
855
858 area.x + area.w, area.y,
859 area.h, TRUE);
860 }
861
862 /* -------------------- */
863 /* redraw */
865 widget_mark_dirty(pwindow);
866
867 flush_dirty();
868}
869
870/**********************************************************************/
SDL_Surface * zoomSurface(SDL_Surface *src, double zoomx, double zoomy, int smooth)
Zoom a surface by independent horizontal and vertical factors with optional smoothing.
void astr_free(struct astring *astr)
Definition astring.c:153
void astr_add_line(struct astring *astr, const char *format,...)
Definition astring.c:299
#define n
Definition astring.c:77
static const char * astr_str(const struct astring *astr) fc__attribute((nonnull(1)))
Definition astring.h:93
#define ASTRING_INIT
Definition astring.h:44
bool can_meet_with_player(const struct player *pplayer)
bool can_intel_with_player(const struct player *pplayer)
struct civclient client
#define client_player()
char * incite_cost
Definition comments.c:75
QString current_theme
Definition fc_client.cpp:65
#define Q_(String)
Definition fcintl.h:70
#define PL_(String1, String2, n)
Definition fcintl.h:71
#define _(String)
Definition fcintl.h:67
static void popup_diplomacy_dialog(struct Treaty *ptreaty, struct player *they, struct player *initiator)
Definition diplodlg.c:205
void popup_intel_dialog(struct player *p)
Definition inteldlg.c:167
void flush_dirty(void)
Definition mapview.c:468
void popdown_players_dialog(void)
Definition plrdlg.c:105
void real_players_dialog_update(void *unused)
Definition plrdlg.c:730
void popup_players_dialog(bool raise)
Definition plrdlg.c:91
const char * title
Definition repodlgs.c:1314
GType type
Definition repodlgs.c:1313
@ COL_TEXT
Definition unitselect.c:50
#define set_output_window_text(_pstr_)
Definition chatline.h:31
SDL_Color * get_theme_color(enum theme_color themecolor)
Definition colors.c:47
int main_window_width(void)
Definition graphics.c:685
void create_line(SDL_Surface *dest, Sint16 x0, Sint16 y0, Sint16 x1, Sint16 y1, SDL_Color *pcolor)
Definition graphics.c:1379
int alphablit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect, unsigned char alpha_mod)
Definition graphics.c:199
struct sdl2_data main_data
Definition graphics.c:57
int main_window_height(void)
Definition graphics.c:693
#define DEFAULT_ZOOM
Definition graphics.h:198
#define FREESURFACE(ptr)
Definition graphics.h:322
@ ID_BUTTON
Definition gui_id.h:29
@ ID_LABEL
Definition gui_id.h:27
@ ID_CHECKBOX
Definition gui_id.h:35
@ ID_WINDOW
Definition gui_id.h:30
#define CF_DRAW_PLAYERS_ALLIANCE_STATUS
Definition gui_main.h:62
#define CF_DRAW_PLAYERS_CEASEFIRE_STATUS
Definition gui_main.h:60
#define CF_DRAW_PLAYERS_PEACE_STATUS
Definition gui_main.h:61
#define CF_DRAW_PLAYERS_NEUTRAL_STATUS
Definition gui_main.h:63
#define adj_size(size)
Definition gui_main.h:141
#define CF_DRAW_PLAYERS_WAR_STATUS
Definition gui_main.h:59
#define PRESSED_EVENT(event)
Definition gui_main.h:71
utf8_str * copy_chars_to_utf8_str(utf8_str *pstr, const char *pchars)
Definition gui_string.c:251
SDL_Surface * create_text_surf_from_utf8(utf8_str *pstr)
Definition gui_string.c:425
utf8_str * create_utf8_str_fonto(char *in_text, size_t n_alloc, enum font_origin origin)
Definition gui_string.c:241
#define FREEUTF8STR(pstr)
Definition gui_string.h:93
#define SF_CENTER
Definition gui_string.h:40
@ FONTO_DEFAULT
Definition gui_string.h:65
@ FONTO_ATTENTION
Definition gui_string.h:67
#define create_utf8_from_char_fonto(string_in, fonto)
Definition gui_string.h:108
static SDL_Surface * get_nation_flag_surface(const struct nation_type *pnation)
static struct advanced_dialog * short_players_dlg
Definition plrdlg.c:581
void popdown_players_nations_dialog(void)
Definition plrdlg.c:877
static int toggle_draw_alliance_status_callback(struct widget *pwidget)
Definition plrdlg.c:170
void popup_players_nations_dialog(void)
Definition plrdlg.c:668
static int exit_players_nations_dlg_callback(struct widget *pwidget)
Definition plrdlg.c:594
static int player_callback(struct widget *pwidget)
Definition plrdlg.c:79
static int toggle_draw_neutral_status_callback(struct widget *pwidget)
Definition plrdlg.c:191
static int players_window_dlg_callback(struct widget *pwindow)
Definition plrdlg.c:88
static int toggle_draw_war_status_callback(struct widget *pwidget)
Definition plrdlg.c:107
static int toggle_draw_peace_status_callback(struct widget *pwidget)
Definition plrdlg.c:149
static int exit_players_dlg_callback(struct widget *pwidget)
Definition plrdlg.c:66
#define M_PI_2
Definition plrdlg.c:56
static int player_nation_callback(struct widget *pwidget)
Definition plrdlg.c:607
#define M_PI
Definition plrdlg.c:53
static int players_nations_window_dlg_callback(struct widget *pwindow)
Definition plrdlg.c:586
static int toggle_draw_ceasefire_status_callback(struct widget *pwidget)
Definition plrdlg.c:128
static bool have_diplomat_info_about(struct player *pplayer)
Definition plrdlg.c:212
static struct small_dialog * pplayers_dlg
Definition plrdlg.c:59
@ COLOR_THEME_PLRDLG_CEASEFIRE
@ COLOR_THEME_PLRDLG_ALLIANCE
@ COLOR_THEME_PLRDLG_PEACE
@ COLOR_THEME_PLRDLG_TEXT
@ COLOR_THEME_PLRDLG_NO_CONTACT
@ COLOR_THEME_PLRDLG_WAR_RESTRICTED
@ COLOR_THEME_PLRDLG_WAR
@ COLOR_THEME_PLRDLG_ARMISTICE
void add_to_gui_list(Uint16 id, struct widget *gui)
Definition widget.c:586
bool move_window_group_dialog(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:1016
bool select_window_group_dialog(struct widget *begin_widget_list, struct widget *pwindow)
Definition widget.c:998
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
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
void popdown_window_group_dialog(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:983
static void widget_set_position(struct widget *pwidget, int x, int y)
Definition widget.h:266
@ FC_WS_NORMAL
Definition widget.h:96
static void widget_mark_dirty(struct widget *pwidget)
Definition widget.h:286
static void widget_flush(struct widget *pwidget)
Definition widget.h:291
void set_wstate(struct widget *pwidget, enum widget_state state)
Definition widget_core.c:36
@ WF_WIDGET_HAS_INFO_LABEL
Definition widget.h:88
@ WF_RESTORE_BACKGROUND
Definition widget.h:85
@ WF_HIDDEN
Definition widget.h:68
@ WF_FREE_THEME
Definition widget.h:72
@ WF_DRAW_TEXT_LABEL_WITH_SPACE
Definition widget.h:87
#define show(id)
Definition widget.h:235
static int widget_redraw(struct widget *pwidget)
Definition widget.h:276
void set_wflag(struct widget *pwidget, enum widget_flag flag)
Definition widget_core.c:54
struct widget * create_checkbox(struct gui_layer *pdest, bool state, Uint32 flags)
struct widget * create_themeicon(SDL_Surface *icon_theme, struct gui_layer *pdest, Uint32 flags)
struct widget * create_icon2(SDL_Surface *icon, struct gui_layer *pdest, Uint32 flags)
struct widget * create_iconlabel(SDL_Surface *icon, struct gui_layer *pdest, utf8_str *pstr, Uint32 flags)
void setup_vertical_scrollbar_area(struct scroll_bar *scroll, Sint16 start_x, Sint16 start_y, Uint16 height, bool swap_start_x)
Uint32 create_vertical_scrollbar(struct advanced_dialog *dlg, Uint8 step, Uint8 active, bool create_scrollbar, bool create_buttons)
bool resize_window(struct widget *pwindow, SDL_Surface *bcgd, SDL_Color *pcolor, Uint16 new_w, Uint16 new_h)
struct widget * create_window_skeleton(struct gui_layer *pdest, utf8_str *title, Uint32 flags)
Uint32 sdl3_client_flags
Definition gui_main.c:97
get_token_fn_t func
Definition inputfile.c:128
#define fc_calloc(n, esz)
Definition mem.h:38
#define FC_FREE(ptr)
Definition mem.h:41
const char * nation_adjective_for_player(const struct player *pplayer)
Definition nation.c:169
struct nation_type * nation_of_player(const struct player *pplayer)
Definition nation.c:444
bool team_has_embassy(const struct team *pteam, const struct player *tgt_player)
Definition player.c:220
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Definition player.c:324
#define players_iterate_end
Definition player.h:537
#define players_iterate(_pplayer)
Definition player.h:532
static bool is_barbarian(const struct player *pplayer)
Definition player.h:489
#define is_ai(plr)
Definition player.h:230
struct player_dlg_column player_dlg_columns[]
const int num_player_dlg_columns
@ COL_BOOLEAN
@ COL_RIGHT_TEXT
void players_dialog_update(void)
#define MIN(x, y)
Definition shared.h:55
#define MAX(x, y)
Definition shared.h:54
struct widget * begin_active_widget_list
Definition widget.h:184
struct widget * end_widget_list
Definition widget.h:182
struct widget * end_active_widget_list
Definition widget.h:185
struct widget * active_widget_list
Definition widget.h:186
struct scroll_bar * scroll
Definition widget.h:187
struct widget * begin_widget_list
Definition widget.h:181
struct connection conn
Definition client_main.h:96
struct player * playing
Definition connection.h:151
enum diplstate_type type
Definition player.h:197
struct team * team
Definition player.h:259
SDL_Event event
Definition graphics.h:217
struct widget * begin_widget_list
Definition widget.h:175
struct widget * end_widget_list
Definition widget.h:176
union widget::@194 data
SDL_Surface * theme
Definition widget.h:118
struct player * player
Definition widget.h:130
struct widget * prev
Definition widget.h:114
struct gui_layer * dst
Definition widget.h:116
int(* action)(struct widget *)
Definition widget.h:157
SDL_Rect area
Definition widget.h:149
SDL_Surface * gfx
Definition widget.h:120
SDL_Rect size
Definition widget.h:145
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:974
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47