Freeciv-3.1
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/* SDL2 */
19#ifdef SDL2_PLAIN_INCLUDE
20#include <SDL.h>
21#else /* SDL2_PLAIN_INCLUDE */
22#include <SDL2/SDL.h>
23#endif /* SDL2_PLAIN_INCLUDE */
24
25/* utility */
26#include "astring.h"
27#include "fcintl.h"
28
29/* client */
30#include "client_main.h"
31#include "climisc.h"
32
33/* gui-sdl2 */
34#include "chatline.h"
35#include "colors.h"
36#include "diplodlg.h"
37#include "graphics.h"
38#include "gui_id.h"
39#include "gui_main.h"
40#include "gui_tilespec.h"
41#include "inteldlg.h"
42#include "mapview.h"
43#include "sprite.h"
44#include "themespec.h"
45#include "widget.h"
46
47#include "plrdlg.h"
48
49#ifndef M_PI
50#define M_PI 3.14159265358979323846 /* pi */
51#endif
52#ifndef M_PI_2
53#define M_PI_2 1.57079632679489661923 /* pi/2 */
54#endif
55
56static struct small_dialog *pplayers_dlg = NULL;
57
58static int player_nation_callback(struct widget *pwidget);
59
60/**********************************************************************/
63static int exit_players_dlg_callback(struct widget *pwidget)
64{
68 }
69
70 return -1;
71}
72
73/**********************************************************************/
76static int player_callback(struct widget *pwidget)
77{
78 /* We want exactly same functionality that the small dialog has. */
79 return player_nation_callback(pwidget);
80}
81
82/**********************************************************************/
85static int players_window_dlg_callback(struct widget *pwindow)
86{
91 } else {
93 widget_flush(pwindow);
94 }
95 }
96 }
97
98 return -1;
99}
100
101/**********************************************************************/
104static int toggle_draw_war_status_callback(struct widget *pwidget)
105{
107 /* exit button -> neutral -> war -> casefire -> peace -> alliance */
108 struct widget *pplayer = pplayers_dlg->end_widget_list->prev->prev->prev->prev->prev->prev;
109
111 do {
112 pplayer = pplayer->prev;
113 FREESURFACE(pplayer->gfx);
114 } while (pplayer != pplayers_dlg->begin_widget_list);
115
117 }
118
119 return -1;
120}
121
122/**********************************************************************/
126{
128 /* exit button -> neutral -> war -> casefire -> peace -> alliance */
129 struct widget *pplayer = pplayers_dlg->end_widget_list->prev->prev->prev->prev->prev->prev;
130
132 do {
133 pplayer = pplayer->prev;
134 FREESURFACE(pplayer->gfx);
135 } while (pplayer != pplayers_dlg->begin_widget_list);
136
138 }
139
140 return -1;
141}
142
143/**********************************************************************/
146static int toggle_draw_peace_status_callback(struct widget *pwidget)
147{
149 /* exit button -> neutral -> war -> casefire -> peace -> alliance */
150 struct widget *pplayer = pplayers_dlg->end_widget_list->prev->prev->prev->prev->prev->prev;
151
153 do {
154 pplayer = pplayer->prev;
155 FREESURFACE(pplayer->gfx);
156 } while (pplayer != pplayers_dlg->begin_widget_list);
157
159 }
160
161 return -1;
162}
163
164/**********************************************************************/
168{
170 /* exit button -> neutral -> war -> casefire -> peace -> alliance */
171 struct widget *pplayer = pplayers_dlg->end_widget_list->prev->prev->prev->prev->prev->prev;
172
174 do {
175 pplayer = pplayer->prev;
176 FREESURFACE(pplayer->gfx);
177 } while (pplayer != pplayers_dlg->begin_widget_list);
178
180 }
181
182 return -1;
183}
184
185/**********************************************************************/
189{
191 /* exit button -> neutral -> war -> casefire -> peace -> alliance */
192 struct widget *pplayer = pplayers_dlg->end_widget_list->prev->prev->prev->prev->prev->prev;
193
195 do {
196 pplayer = pplayer->prev;
197 FREESURFACE(pplayer->gfx);
198 } while (pplayer != pplayers_dlg->begin_widget_list);
199
201 }
202
203 return -1;
204}
205
206/**********************************************************************/
209static bool have_diplomat_info_about(struct player *pplayer)
210{
211 return (pplayer == client.conn.playing
212 || (pplayer != client.conn.playing
213 && team_has_embassy(client.conn.playing->team, pplayer)));
214}
215
216/**********************************************************************/
220{
221 if (pplayers_dlg) {
222 struct widget *pplayer0, *pplayer1;
223 struct player *pplayer;
224 int i;
225 struct astring astr = ASTRING_INIT;
226
227 /* redraw window */
229
230 /* exit button -> neutral -> war -> casefire -> peace -> alliance */
232 do {
233 pplayer0 = pplayer0->prev;
234 pplayer1 = pplayer0;
235 pplayer = pplayer0->data.player;
236
237 for (i = 0; i < num_player_dlg_columns; i++) {
238 if (player_dlg_columns[i].show) {
239 switch (player_dlg_columns[i].type) {
240 case COL_TEXT:
241 case COL_RIGHT_TEXT:
242 astr_add_line(&astr, "%s: %s", player_dlg_columns[i].title,
243 player_dlg_columns[i].func(pplayer));
244 break;
245 case COL_BOOLEAN:
246 astr_add_line(&astr, "%s: %s", player_dlg_columns[i].title,
247 player_dlg_columns[i].bool_func(pplayer) ?
248 _("Yes") : _("No"));
249 break;
250 default:
251 break;
252 }
253 }
254 }
255
256 copy_chars_to_utf8_str(pplayer0->info_label, astr_str(&astr));
257
258 astr_free(&astr);
259
260 /* now add some eye candy ... */
261 if (pplayer1 != pplayers_dlg->begin_widget_list) {
262 SDL_Rect dst0, dst1;
263
264 dst0.x = pplayer0->size.x + pplayer0->size.w / 2;
265 dst0.y = pplayer0->size.y + pplayer0->size.h / 2;
266
267 do {
268 pplayer1 = pplayer1->prev;
269 if (have_diplomat_info_about(pplayer)
270 || have_diplomat_info_about(pplayer1->data.player)) {
271
272 dst1.x = pplayer1->size.x + pplayer1->size.w / 2;
273 dst1.y = pplayer1->size.y + pplayer1->size.h / 2;
274
275 switch (player_diplstate_get(pplayer,
276 pplayer1->data.player)->type) {
277 case DS_ARMISTICE:
279 create_line(pplayer1->dst->surface,
280 dst0.x, dst0.y, dst1.x, dst1.y,
282 }
283 break;
284 case DS_WAR:
286 create_line(pplayer1->dst->surface,
287 dst0.x, dst0.y, dst1.x, dst1.y,
289 }
290 break;
291 case DS_CEASEFIRE:
293 create_line(pplayer1->dst->surface,
294 dst0.x, dst0.y, dst1.x, dst1.y,
296 }
297 break;
298 case DS_PEACE:
300 create_line(pplayer1->dst->surface,
301 dst0.x, dst0.y, dst1.x, dst1.y,
303 }
304 break;
305 case DS_ALLIANCE:
307 create_line(pplayer1->dst->surface,
308 dst0.x, dst0.y, dst1.x, dst1.y,
310 }
311 break;
312 default:
313 /* no contact */
314 break;
315 }
316 }
317 } while (pplayer1 != pplayers_dlg->begin_widget_list);
318 }
319 } while (pplayer0 != pplayers_dlg->begin_widget_list);
320
321 /* -------------------- */
322 /* redraw */
326
327 flush_dirty();
328 }
329}
330
331/**********************************************************************/
334void popup_players_dialog(bool raise)
335{
336 struct widget *pwindow = NULL, *buf = NULL;
338 utf8_str *pstr;
340 int i, n, h;
341 double a, b, r;
343
344 if (pplayers_dlg) {
345 return;
346 }
347
348 n = 0;
349 players_iterate(pplayer) {
350 if (is_barbarian(pplayer)) {
351 continue;
352 }
353 n++;
355
356 if (n < 2) {
357 return;
358 }
359
360 pplayers_dlg = fc_calloc(1, sizeof(struct small_dialog));
361
362 pstr = create_utf8_from_char_fonto(Q_("?header:Players"),
364 pstr->style |= TTF_STYLE_BOLD;
365
366 pwindow = create_window_skeleton(NULL, pstr, 0);
367
369 set_wstate(pwindow, FC_WS_NORMAL);
370
371 add_to_gui_list(ID_WINDOW, pwindow);
372 pplayers_dlg->end_widget_list = pwindow;
373 /* ---------- */
374 /* Exit button */
375 buf = create_themeicon(current_theme->small_cancel_icon, pwindow->dst,
377 buf->info_label = create_utf8_from_char_fonto(_("Close Dialog (Esc)"),
381 buf->key = SDLK_ESCAPE;
382
384 /* ---------- */
385
386 for (i = 0; i < DS_LAST; i++) {
387 switch (i) {
388 case DS_ARMISTICE:
389 buf = create_checkbox(pwindow->dst,
393 buf->key = SDLK_n;
394 break;
395 case DS_WAR:
396 buf = create_checkbox(pwindow->dst,
400 buf->key = SDLK_w;
401 break;
402 case DS_CEASEFIRE:
403 buf = create_checkbox(pwindow->dst,
407 buf->key = SDLK_c;
408 break;
409 case DS_PEACE:
410 buf = create_checkbox(pwindow->dst,
414 buf->key = SDLK_p;
415 break;
416 case DS_ALLIANCE:
417 buf = create_checkbox(pwindow->dst,
421 buf->key = SDLK_a;
422 break;
423 default:
424 /* no contact */
425 continue;
426 break;
427 }
430 }
431 /* ---------- */
432
433 players_iterate(pplayer) {
434 if (is_barbarian(pplayer)) {
435 continue;
436 }
437
439 pstr->style |= (TTF_STYLE_BOLD|SF_CENTER);
440
442 {
443 /* Aim for a flag height of 60 pixels, but draw smaller flags if there
444 * are more players */
445 double zoom = DEFAULT_ZOOM * (60.0 - n) / logo->h;
446
447 zoomed = zoomSurface(logo, zoom, zoom, 1);
448 }
449
450 buf = create_icon2(zoomed, pwindow->dst,
452 | WF_FREE_THEME);
453 buf->info_label = pstr;
454
455 if (!pplayer->is_alive) {
457 pstr->style |= TTF_STYLE_BOLD;
461
462 dst.x = (zoomed->w - logo->w) / 2;
463 dst.y = (zoomed->h - logo->h) / 2;
464 alphablit(logo, NULL, zoomed, &dst, 255);
466 }
467
468 if (pplayer->is_alive) {
470 }
471
472 buf->data.player = pplayer;
473
474 buf->action = player_callback;
475
477
479
481
482 resize_window(pwindow, NULL, NULL, adj_size(500), adj_size(400));
483
484 area = pwindow->area;
485
486 r = MIN(area.w, area.h);
487 r -= ((MAX(buf->size.w, buf->size.h) * 2));
488 r /= 2;
489 a = (2.0 * M_PI) / n;
490
491 widget_set_position(pwindow,
492 (main_window_width() - pwindow->size.w) / 2,
493 (main_window_height() - pwindow->size.h) / 2);
494
495 /* exit button */
496 buf = pwindow->prev;
497
498 buf->size.x = area.x + area.w - buf->size.w - 1;
499 buf->size.y = pwindow->size.y + adj_size(2);
500
501 n = area.y;
503 pstr->style |= TTF_STYLE_BOLD;
504 pstr->bgcol = (SDL_Color) {0, 0, 0, 0};
505
506 for (i = 0; i < DS_LAST; i++) {
507 switch (i) {
508 case DS_ARMISTICE:
510 break;
511 case DS_WAR:
513 break;
514 case DS_CEASEFIRE:
516 break;
517 case DS_PEACE:
519 break;
520 case DS_ALLIANCE:
522 break;
523 default:
524 /* no contact */
525 continue;
526 break;
527 }
528
531
532 buf = buf->prev;
533 h = MAX(buf->size.h, logo->h);
534 buf->size.x = area.x + adj_size(5);
535 buf->size.y = n + (h - buf->size.h) / 2;
536
537 dst.x = adj_size(5) + buf->size.w + adj_size(6);
538 dst.y = n + (h - logo->h) / 2;
539 alphablit(logo, NULL, pwindow->theme, &dst, 255);
540 n += h;
542 }
544
545 /* first player shield */
546 buf = buf->prev;
547 buf->size.x = area.x + area.w / 2 - buf->size.w / 2;
548 buf->size.y = area.y + area.h / 2 - r - buf->size.h / 2;
549
550 n = 1;
552 do {
553 buf = buf->prev;
554 b = M_PI_2 + n * a;
555 buf->size.x = area.x + area.w / 2 - r * cos(b) - buf->size.w / 2;
556 buf->size.y = area.y + area.h / 2 - r * sin(b) - buf->size.h / 2;
557 n++;
558 } while (buf != pplayers_dlg->begin_widget_list);
559 }
560
562}
563
564/**********************************************************************/
575
576
577/* ============================== SHORT =============================== */
578static struct advanced_dialog *short_players_dlg = NULL;
579
580/**********************************************************************/
584{
585 return -1;
586}
587
588/**********************************************************************/
591static int exit_players_nations_dlg_callback(struct widget *pwidget)
592{
595 flush_dirty();
596 }
597
598 return -1;
599}
600
601/**********************************************************************/
604static int player_nation_callback(struct widget *pwidget)
605{
606 struct player *pplayer = pwidget->data.player;
607 bool try_dlg = FALSE;
608 bool popdown = FALSE;
609
610 if (main_data.event.type == SDL_MOUSEBUTTONDOWN) {
611 switch (main_data.event.button.button) {
612#if 0
613 case SDL_BUTTON_LEFT:
614
615 break;
616 case SDL_BUTTON_MIDDLE:
617
618 break;
619#endif /* 0 */
620 case SDL_BUTTON_RIGHT:
621 popup_intel_dialog(pplayer);
622
623 popdown = TRUE;
624 break;
625 default:
626 try_dlg = TRUE;
627 break;
628 }
629 } else if (PRESSED_EVENT(main_data.event)) {
630 try_dlg = TRUE;
631 }
632
633 if (try_dlg && pplayer != client_player()) {
634 const struct player_diplstate *ds;
635
636 ds = player_diplstate_get(client_player(), pplayer);
637
638 if (ds->type != DS_NO_CONTACT
639 && (ds->type != DS_WAR
640 || can_meet_with_player(pplayer)
641 || can_intel_with_player(pplayer))) {
642 popup_diplomacy_dialog(pplayer);
643
644 popdown = TRUE;
645 } else {
646 set_output_window_text(_("You cannot interact with that player "
647 "with your current contact state - "
648 "Try right mouse button for intelligence."));
649 }
650 }
651
652 if (popdown) {
653 /* We came from one of these dialogs. Just try to pop down both -
654 * the one open will react. */
657 }
658
659 return -1;
660}
661
662/**********************************************************************/
666{
667 struct widget *pwindow = NULL, *buf = NULL;
669 utf8_str *pstr;
670 char cbuf[128], *state;
671 int n = 0, w = 0, units_h = 0;
673
674 if (short_players_dlg) {
675 return;
676 }
677
678 short_players_dlg = fc_calloc(1, sizeof(struct advanced_dialog));
679
680 /* TRANS: Nations report title */
682 pstr->style |= TTF_STYLE_BOLD;
683
684 pwindow = create_window_skeleton(NULL, pstr, 0);
685
687 set_wstate(pwindow, FC_WS_NORMAL);
688
689 add_to_gui_list(ID_WINDOW, pwindow);
691
692 area = pwindow->area;
693
694 /* ---------- */
695 /* Exit button */
696 buf = create_themeicon(current_theme->small_cancel_icon, pwindow->dst,
698 buf->info_label = create_utf8_from_char_fonto(_("Close Dialog (Esc)"),
700 area.w = MAX(area.w, buf->size.w + adj_size(10));
703 buf->key = SDLK_ESCAPE;
704
706 /* ---------- */
707
708 players_iterate(pplayer) {
709 if (pplayer != client.conn.playing) {
710 const struct player_diplstate *ds;
711
712 if (!pplayer->is_alive || is_barbarian(pplayer)) {
713 continue;
714 }
715
717
718 if (is_ai(pplayer)) {
719 state = _("AI");
720 } else {
721 if (pplayer->is_connected) {
722 if (pplayer->phase_done) {
723 state = _("done");
724 } else {
725 state = _("moving");
726 }
727 } else {
728 state = _("disconnected");
729 }
730 }
731
732 if (ds->type == DS_CEASEFIRE) {
733 fc_snprintf(cbuf, sizeof(cbuf), "%s(%s) - %d %s",
735 state,
736 ds->turns_left, PL_("turn", "turns", ds->turns_left));
737 } else {
738 fc_snprintf(cbuf, sizeof(cbuf), "%s(%s)",
740 state);
741 }
742
744 pstr->style |= TTF_STYLE_BOLD;
745
747
748 buf = create_iconlabel(logo, pwindow->dst, pstr,
750
751 /* At least RMB works always */
753
754 /* Now add some eye candy ... */
755 switch (ds->type) {
756 case DS_ARMISTICE:
757 buf->string_utf8->fgcol = *get_theme_color(COLOR_THEME_PLRDLG_ARMISTICE);
758 break;
759 case DS_WAR:
760 if (can_meet_with_player(pplayer) || can_intel_with_player(pplayer)) {
761 buf->string_utf8->fgcol = *get_theme_color(COLOR_THEME_PLRDLG_WAR);
762 } else {
763 buf->string_utf8->fgcol = *(get_theme_color(COLOR_THEME_PLRDLG_WAR_RESTRICTED));
764 }
765 break;
766 case DS_CEASEFIRE:
767 buf->string_utf8->fgcol = *get_theme_color(COLOR_THEME_PLRDLG_CEASEFIRE);
768 break;
769 case DS_PEACE:
770 buf->string_utf8->fgcol = *get_theme_color(COLOR_THEME_PLRDLG_PEACE);
771 break;
772 case DS_ALLIANCE:
773 buf->string_utf8->fgcol = *get_theme_color(COLOR_THEME_PLRDLG_ALLIANCE);
774 break;
775 case DS_NO_CONTACT:
776 /* TODO: Add a color for this. Widget is not disabled! */
777 buf->string_utf8->fgcol = *(get_theme_color(COLOR_THEME_WIDGET_DISABLED_TEXT));
778 break;
779 case DS_TEAM:
780 case DS_LAST:
781 break;
782 }
783
784 buf->string_utf8->bgcol = (SDL_Color) {0, 0, 0, 0};
785
786 buf->data.player = pplayer;
787
788 buf->action = player_nation_callback;
789
791
792 area.w = MAX(w, buf->size.w);
793 area.h += buf->size.h;
794
795 if (n > 19) {
796 set_wflag(buf, WF_HIDDEN);
797 }
798
799 n++;
800 }
802
807
808
809 /* ---------- */
810 if (n > 20) {
813
814 n = units_h;
815 area.w += n;
816
817 units_h = 20 * buf->size.h;
818
819 } else {
820 units_h = area.h;
821 }
822
823 /* ---------- */
824
825 area.h = units_h;
826
827 resize_window(pwindow, NULL, NULL,
828 (pwindow->size.w - pwindow->area.w) + area.w,
829 (pwindow->size.h + pwindow->area.h) + area.h);
830
831 area = pwindow->area;
832
833 widget_set_position(pwindow,
834 ((main_data.event.motion.x + pwindow->size.w + adj_size(10) < main_window_width()) ?
835 (main_data.event.motion.x + adj_size(10)) :
836 (main_window_width() - pwindow->size.w - adj_size(10))),
837 ((main_data.event.motion.y - adj_size(2) + pwindow->size.h < main_window_height()) ?
838 (main_data.event.motion.y - adj_size(2)) :
839 (main_window_height() - pwindow->size.h - adj_size(10))));
840
841 w = area.w;
842
844 w -= n;
845 }
846
847 /* exit button */
848 buf = pwindow->prev;
849 buf->size.x = area.x + area.w - buf->size.w - 1;
850 buf->size.y = pwindow->size.y + adj_size(2);
851
852 /* cities */
853 buf = buf->prev;
854 setup_vertical_widgets_position(1, area.x, area.y, w, 0,
856 buf);
857
860 area.x + area.w, area.y,
861 area.h, TRUE);
862 }
863
864 /* -------------------- */
865 /* redraw */
867 widget_mark_dirty(pwindow);
868
869 flush_dirty();
870}
871
872/**********************************************************************/
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()
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(int other_player_id, int initiated_from)
Definition diplodlg.c:192
void popup_intel_dialog(struct player *p)
Definition inteldlg.c:166
void flush_dirty(void)
Definition mapview.c:450
void popdown_players_dialog(void)
Definition plrdlg.c:105
void real_players_dialog_update(void *unused)
Definition plrdlg.c:732
void popup_players_dialog(bool raise)
Definition plrdlg.c:91
const char * title
Definition repodlgs.c:1313
GType type
Definition repodlgs.c:1312
@ 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:44
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:1378
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
Uint32 sdl2_client_flags
Definition gui_main.c:97
#define CF_DRAW_PLAYERS_ALLIANCE_STATUS
Definition gui_main.h:59
#define CF_DRAW_PLAYERS_CEASEFIRE_STATUS
Definition gui_main.h:57
#define CF_DRAW_PLAYERS_PEACE_STATUS
Definition gui_main.h:58
#define CF_DRAW_PLAYERS_NEUTRAL_STATUS
Definition gui_main.h:60
#define adj_size(size)
Definition gui_main.h:138
#define CF_DRAW_PLAYERS_WAR_STATUS
Definition gui_main.h:56
#define PRESSED_EVENT(event)
Definition gui_main.h:68
static struct advanced_dialog * short_players_dlg
Definition plrdlg.c:578
void popdown_players_nations_dialog(void)
Definition plrdlg.c:875
static int toggle_draw_alliance_status_callback(struct widget *pwidget)
Definition plrdlg.c:167
void popup_players_nations_dialog(void)
Definition plrdlg.c:665
static int exit_players_nations_dlg_callback(struct widget *pwidget)
Definition plrdlg.c:591
static int player_callback(struct widget *pwidget)
Definition plrdlg.c:76
static int toggle_draw_neutral_status_callback(struct widget *pwidget)
Definition plrdlg.c:188
static int players_window_dlg_callback(struct widget *pwindow)
Definition plrdlg.c:85
static int toggle_draw_war_status_callback(struct widget *pwidget)
Definition plrdlg.c:104
static int toggle_draw_peace_status_callback(struct widget *pwidget)
Definition plrdlg.c:146
static int exit_players_dlg_callback(struct widget *pwidget)
Definition plrdlg.c:63
#define M_PI_2
Definition plrdlg.c:53
static int player_nation_callback(struct widget *pwidget)
Definition plrdlg.c:604
#define M_PI
Definition plrdlg.c:50
static int players_nations_window_dlg_callback(struct widget *pwindow)
Definition plrdlg.c:583
static int toggle_draw_ceasefire_status_callback(struct widget *pwidget)
Definition plrdlg.c:125
static bool have_diplomat_info_about(struct player *pplayer)
Definition plrdlg.c:209
static struct small_dialog * pplayers_dlg
Definition plrdlg.c:56
@ 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
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:92
#define SF_CENTER
Definition gui_string.h:40
@ FONTO_DEFAULT
Definition gui_string.h:64
@ FONTO_ATTENTION
Definition gui_string.h:66
#define create_utf8_from_char_fonto(string_in, fonto)
Definition gui_string.h:107
static SDL_Surface * get_nation_flag_surface(const struct nation_type *pnation)
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:168
struct nation_type * nation_of_player(const struct player *pplayer)
Definition nation.c:443
bool team_has_embassy(const struct team *pteam, const struct player *tgt_player)
Definition player.c:214
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Definition player.c:317
#define players_iterate_end
Definition player.h:535
#define players_iterate(_pplayer)
Definition player.h:530
static bool is_barbarian(const struct player *pplayer)
Definition player.h:488
#define is_ai(plr)
Definition player.h:234
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 * active_widget_list
Definition widget.h:186
struct widget * end_widget_list
Definition widget.h:182
struct widget * begin_widget_list
Definition widget.h:181
struct widget * begin_active_widget_list
Definition widget.h:184
struct widget * end_active_widget_list
Definition widget.h:185
struct scroll_bar * scroll
Definition widget.h:187
struct connection conn
Definition client_main.h:96
struct player * playing
Definition connection.h:156
SDL_Surface * surface
Definition graphics.h:229
enum diplstate_type type
Definition player.h:201
struct team * team
Definition player.h:261
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
Uint8 style
Definition gui_string.h:53
utf8_str * info_label
Definition widget.h:122
union widget::@214 data
struct player * player
Definition widget.h:130
struct gui_layer * dst
Definition widget.h:116
SDL_Surface * gfx
Definition widget.h:120
struct widget * prev
Definition widget.h:114
int(* action)(struct widget *)
Definition widget.h:157
struct container * cont
Definition widget.h:127
SDL_Surface * theme
Definition widget.h:118
SDL_Rect area
Definition widget.h:149
SDL_Rect size
Definition widget.h:145
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:969
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
@ COLOR_THEME_PLRDLG_CEASEFIRE
@ COLOR_THEME_PLRDLG_ALLIANCE
@ COLOR_THEME_WIDGET_DISABLED_TEXT
Definition themecolors.h:42
@ COLOR_THEME_PLRDLG_PEACE
@ COLOR_THEME_PLRDLG_TEXT
@ 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:585
bool move_window_group_dialog(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:1015
bool select_window_group_dialog(struct widget *begin_widget_list, struct widget *pwindow)
Definition widget.c:997
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:1050
Uint16 redraw_group(const struct widget *begin_group_widget_list, const struct widget *end_group_widget_list, int add_to_update)
Definition widget.c:719
void popdown_window_group_dialog(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:982
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)
int 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)