Freeciv-3.2
Loading...
Searching...
No Matches
diplodlg.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#include <stdio.h>
19#include <stdlib.h>
20
21#include <gtk/gtk.h>
22
23/* utility */
24#include "log.h"
25#include "mem.h"
26#include "shared.h"
27#include "support.h"
28
29/* common */
30#include "diptreaty.h"
31#include "fcintl.h"
32#include "game.h"
33#include "government.h"
34#include "map.h"
35#include "nation.h"
36#include "packets.h"
37#include "player.h"
38#include "research.h"
39
40/* client */
41#include "chatline.h"
42#include "client_main.h"
43#include "climisc.h"
44#include "options.h"
45
46/* client/gui-gtk-3.22 */
47#include "diplodlg.h"
48#include "gui_main.h"
49#include "gui_stuff.h"
50#include "mapview.h"
51#include "plrdlg.h"
52
65
70
71struct city_deal {
72 int giver;
74 int id;
75};
76
77#define SPECLIST_TAG dialog
78#define SPECLIST_TYPE struct Diplomacy_dialog
79#include "speclist.h"
80
81#define dialog_list_iterate(dialoglist, pdialog) \
82 TYPED_LIST_ITERATE(struct Diplomacy_dialog, dialoglist, pdialog)
83#define dialog_list_iterate_end LIST_ITERATE_END
84
85static struct dialog_list *dialog_list;
87
89 struct player *plr0,
90 struct player *plr1);
91
93static void popup_diplomacy_dialog(struct Treaty *ptreaty, struct player *they,
94 struct player *initiator);
105static void close_diplomacy_dialog(struct Diplomacy_dialog *pdialog);
106static void update_diplomacy_dialog(struct Diplomacy_dialog *pdialog);
107static void diplo_dialog_returnkey(GtkWidget *w, gpointer data);
108
109static struct Diplomacy_notebook *diplomacy_main_create(void);
110static void diplomacy_main_destroy(void);
111static void diplomacy_main_response(struct gui_dialog *dlg, int response,
112 gpointer data);
113
114#define RESPONSE_CANCEL_MEETING 100
115#define RESPONSE_CANCEL_MEETING_ALL 101
116
117/************************************************************************/
121{
123
124 if (!pdialog) {
125 return;
126 }
127
128 fc_assert(pdialog->treaty == ptreaty);
129
131 gui_dialog_alert(pdialog->dialog);
132}
133
134/************************************************************************/
142
143/************************************************************************/
147 struct player *initiator)
148{
150
151 if (!pdialog) {
152 return;
153 }
154
155 fc_assert(pdialog->treaty == ptreaty);
156
157 close_diplomacy_dialog(pdialog);
158}
159
160/**********************************************************************/
164{
165 /* Not needed */
166}
167
168/************************************************************************/
172{
174
175 if (!pdialog) {
176 return;
177 }
178
179 fc_assert(pdialog->treaty == ptreaty);
180
182 gui_dialog_alert(pdialog->dialog);
183}
184
185/************************************************************************/
189{
191
192 if (!pdialog) {
193 return;
194 }
195
196 fc_assert(pdialog->treaty == ptreaty);
197
199 gui_dialog_alert(pdialog->dialog);
200}
201
202/************************************************************************/
205static void popup_diplomacy_dialog(struct Treaty *ptreaty, struct player *they,
206 struct player *initiator)
207{
209
210 if (!is_human(client_player())) {
211 return; /* Don't show if we are not human controlled. */
212 }
213
214 if (!pdialog) {
216 }
217
218 gui_dialog_present(pdialog->dialog);
219 /* We initated the meeting - Make the tab active */
220 if (initiator == client_player()) {
221 /* we have to raise the diplomacy meeting tab as well as the selected
222 * meeting. */
225 gui_dialog_raise(pdialog->dialog);
226
227 if (players_dialog_shell != NULL) {
229 }
230 }
231}
232
233/************************************************************************/
237{
238 const struct advance *padvance1 = (const struct advance *) a;
239 const struct advance *padvance2 = (const struct advance *) b;
240
243}
244
245/************************************************************************/
249{
250 struct Diplomacy_dialog *pdialog;
251 struct player *pgiver, *pother;
252 GtkWidget *item, *menu;
253 bool any_map = FALSE;
254
255 /* Init. */
258
259 pdialog = (struct Diplomacy_dialog *) data;
260 pgiver = (struct player *) g_object_get_data(G_OBJECT(parent), "plr");
261 pother = (pgiver == pdialog->treaty->plr0
262 ? pdialog->treaty->plr1 : pdialog->treaty->plr0);
263
264
265 /* Maps. */
267 menu = gtk_menu_new();
268
269 item = gtk_menu_item_new_with_mnemonic(_("World-map"));
272 g_signal_connect(item, "activate",
274 any_map = TRUE;
275 }
276
278 if (!any_map) {
279 menu = gtk_menu_new();
280 }
281
285 g_signal_connect(item, "activate",
287 any_map = TRUE;
288 }
289
290 if (any_map) {
295 }
296
297 /* Trading: advances */
299 const struct research *gresearch = research_get(pgiver);
300 const struct research *oresearch = research_get(pother);
304
307
310
312 && (!team_embassy /* We don't know what the other could actually receive */
317 == TECH_PREREQS_KNOWN)) {
319 }
321
322 if (NULL == sorting_list) {
323 /* No advance. */
325 } else {
327 const struct advance *padvance;
328
330 menu = gtk_menu_new();
331
332 /* TRANS: All technologies menu item in the diplomatic dialog. */
333 item = gtk_menu_item_new_with_label(_("All advances"));
335 g_object_set_data(G_OBJECT(item), "player_from",
337 g_object_set_data(G_OBJECT(item), "player_to",
339 g_signal_connect(item, "activate",
344
347 padvance = (const struct advance *) list_item->data;
350 g_object_set_data(G_OBJECT(item), "player_from",
352 g_object_set_data(G_OBJECT(item), "player_to",
354 g_signal_connect(item, "activate",
357 }
358
361 }
362
364 }
365
366 /* Trading: cities. */
367
368 /****************************************************************
369 Creates a sorted list of plr0's cities, excluding the capital and
370 any cities not visible to plr1. This means that you can only trade
371 cities visible to requesting player.
372
373 - Kris Bubendorfer
374 *****************************************************************/
376 int i = 0;
377 int n = city_list_size(pgiver->cities);
378
379 menu = gtk_menu_new();
380
381 if (n > 0) {
382 struct city **city_list_ptrs;
383
384 city_list_ptrs = fc_malloc(sizeof(struct city *) * n);
385
386 city_list_iterate(pgiver->cities, pcity) {
387 if (!is_capital(pcity)) {
388 city_list_ptrs[i] = pcity;
389 i++;
390 }
392
393 if (i > 0) { /* Cities other than capitals */
394 int j;
395
396 qsort(city_list_ptrs, i, sizeof(struct city *), city_name_compare);
397
398 for (j = 0; j < i; j++) {
399 struct city_deal *deal = fc_malloc(sizeof(struct city_deal));
400
402
403 deal->giver = player_number(pgiver);
404 deal->receiver = player_number(pother);
405 deal->id = city_list_ptrs[j]->id;
406
408 g_signal_connect(item, "activate",
410 (gpointer)deal);
411 }
412 }
413
415 }
416
422 }
423
424 /* Give shared vision. */
425
427 item = gtk_menu_item_new_with_mnemonic(_("_Give shared vision"));
429 g_signal_connect(item, "activate",
431
434 }
437 }
438
439 /* Give embassy. */
441 item = gtk_menu_item_new_with_mnemonic(_("Give _embassy"));
443 g_signal_connect(item, "activate",
445
446 /* Don't take in account the embassy effects. */
449 }
452 }
453
454 /* Shared tiles */
456 item = gtk_menu_item_new_with_mnemonic(_("_Share tiles"));
458 g_signal_connect(item, "activate",
463 }
464
465 /* Pacts. */
466 if (pgiver == pdialog->treaty->plr0) {
467 enum diplstate_type ds;
468 int pact_clauses = 0;
469
471
472 menu = gtk_menu_new();
473
475 item = gtk_menu_item_new_with_mnemonic(Q_("?diplomatic_state:Cease-fire"));
477 g_signal_connect(item, "activate",
480 pact_clauses++;
481 }
482
484 item = gtk_menu_item_new_with_mnemonic(Q_("?diplomatic_state:Peace"));
486 g_signal_connect(item, "activate",
489 pact_clauses++;
490 }
491
493 item = gtk_menu_item_new_with_mnemonic(Q_("?diplomatic_state:Alliance"));
495 g_signal_connect(item, "activate",
498 pact_clauses++;
499 }
500
501 if (pact_clauses > 0) {
506 } else {
507 g_object_unref(menu);
508 }
509 }
510}
511
512/************************************************************************/
517{
518 struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *)data;
519 gint i;
520 gint *index;
521
522 index = gtk_tree_path_get_indices(path);
523
524 i = 0;
526 if (i == index[0]) {
528 player_number(pdialog->treaty->plr1),
529 player_number(pclause->from),
530 pclause->type,
531 pclause->value);
532 return;
533 }
534 i++;
536}
537
538/************************************************************************/
582
583/************************************************************************/
586static void diplomacy_main_destroy(void)
587{
588 if (dipl_main->dialog) {
590 }
592 dipl_main = NULL;
593}
594
595/************************************************************************/
598static void diplomacy_main_response(struct gui_dialog *dlg, int response,
599 gpointer data)
600{
601 if (!dipl_main) {
602 return;
603 }
604
605 switch (response) {
606 default:
607 log_error("unhandled response in %s: %d", __FUNCTION__, response);
608 fc__fallthrough; /* No break. */
609 case GTK_RESPONSE_DELETE_EVENT: /* GTK: delete the widget. */
610 case RESPONSE_CANCEL_MEETING_ALL: /* Cancel all meetings. */
612 /* This will do a round trip to the server ans close the dialog in the
613 * client. Closing the last dialog will also close the main tab.*/
616 adialog->treaty->plr1));
618 break;
619 }
620}
621
622/************************************************************************/
625static void diplomacy_destroy(struct Diplomacy_dialog* pdialog)
626{
627 if (NULL != pdialog->dialog) {
628 /* pdialog->dialog may be NULL if the tab has been destroyed
629 * by an other way. */
630 gui_dialog_destroy(pdialog->dialog);
631 pdialog->dialog = NULL;
632 }
634
635 if (dialog_list) {
636 /* Diplomatic meetings in one main tab. */
637 if (dialog_list_size(dialog_list) > 0) {
638 if (dipl_main && dipl_main->dialog) {
639 gchar *buf;
640
641 buf = g_strdup_printf(_("Diplomacy [%d]"), dialog_list_size(dialog_list));
643 g_free(buf);
644 }
645 } else if (dipl_main) {
646 /* No meeting left - destroy main tab. */
648 }
649 }
650
651 /* Last sub-tab must not be freed before diplomacy_main_destroy() call. */
652 free(pdialog);
653}
654
655/************************************************************************/
658static void diplomacy_response(struct gui_dialog *dlg, int response,
659 gpointer data)
660{
661 struct Diplomacy_dialog *pdialog = NULL;
662
663 fc_assert_ret(data);
664 pdialog = (struct Diplomacy_dialog *)data;
665
666 switch (response) {
667 case GTK_RESPONSE_ACCEPT: /* Accept treaty. */
670 pdialog->treaty->plr1));
671 break;
672
673 default:
674 log_error("unhandled response in %s: %d", __FUNCTION__, response);
675 fc__fallthrough; /* No break. */
676 case GTK_RESPONSE_DELETE_EVENT: /* GTK: delete the widget. */
677 case GTK_RESPONSE_CANCEL: /* GTK: cancel button. */
678 case RESPONSE_CANCEL_MEETING: /* Cancel meetings. */
681 pdialog->treaty->plr1));
682 break;
683 }
684}
685
686/************************************************************************/
690 struct player *plr0,
691 struct player *plr1)
692{
694 GtkWidget *vbox, *hbox, *table, *mainbox;
695 GtkWidget *label, *sw, *view, *image, *spin;
697 struct sprite *flag_spr;
698 GtkListStore *store;
700 int i;
701
702 struct Diplomacy_dialog *pdialog;
703 char plr_buf[4 * MAX_LEN_NAME];
704 gchar *buf;
705
706 pdialog = fc_malloc(sizeof(*pdialog));
707
709 pdialog->treaty = ptreaty;
710
711 /* Get main diplomacy tab. */
713
714 buf = g_strdup_printf(_("Diplomacy [%d]"), dialog_list_size(dialog_list));
716 g_free(buf);
717
718 notebook = dipl_dialog->notebook;
719
720 gui_dialog_new(&(pdialog->dialog), GTK_NOTEBOOK(notebook), pdialog, FALSE);
721
722 /* Buttons */
724 _("Accept treaty"), GTK_RESPONSE_ACCEPT);
726 _("Cancel meeting"), RESPONSE_CANCEL_MEETING);
727
728 /* Responses for one meeting. */
731
732 /* Label for the new meeting. */
735
736 /* Sort meeting tabs alphabetically by the tab label. */
737 for (i = 0; i < gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)); i++) {
740 struct gui_dialog *prev_dialog
741 = g_object_get_data(G_OBJECT(prev_page), "gui-dialog-data");
742 const char *prev_label
744
745 if (fc_strcasecmp(buf, prev_label) < 0) {
747 pdialog->dialog->vbox, i);
748 break;
749 }
750 }
751 g_free(buf);
752
753 /* Content. */
754 mainbox = pdialog->dialog->vbox;
755
756 /* us. */
757 vbox = gtk_grid_new();
763
764 /* Our nation. */
768 buf = g_strdup_printf("<span size=\"large\"><u>%s</u></span>",
771 g_free(buf);
773
774 hbox = gtk_grid_new();
777
778 /* Our flag */
780
783
784 /* Our name. */
789 buf = g_strdup_printf("<span size=\"large\" weight=\"bold\">%s</span>",
790 ruler_title_for_player(plr0, plr_buf, sizeof(plr_buf)));
792 g_free(buf);
794
796 pdialog->image0 = image;
798
799 /* Menu for clauses: we. */
801
802 menu = gtk_menu_new();
803 pdialog->menu0 = menu;
804
805 menuitem = gtk_menu_item_new_with_label(_("Add Clause..."));
808 g_object_set_data(G_OBJECT(menu), "plr", plr0);
809 g_signal_connect(menu, "show", G_CALLBACK(popup_add_menu), pdialog);
810
811 /* Main table for clauses and (if activated) gold trading: we. */
817
820 1.0);
823 gtk_grid_attach(GTK_GRID(table), spin, 1, 0, 1, 1);
824 g_object_set_data(G_OBJECT(spin), "plr", plr0);
825 g_signal_connect_after(spin, "value-changed",
827
828 label = g_object_new(GTK_TYPE_LABEL, "use-underline", TRUE,
829 "mnemonic-widget", spin, "label", _("Gold:"),
830 "xalign", 0.0, "yalign", 0.5, NULL);
831 gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1);
832
833 gtk_grid_attach(GTK_GRID(table), menubar, 2, 0, 1, 1);
834 } else {
835 gtk_grid_attach(GTK_GRID(table), menubar, 0, 0, 1, 1);
836 }
837
838 /* them. */
839 vbox = gtk_grid_new();
845
846 /* Their nation. */
850 buf = g_strdup_printf("<span size=\"large\"><u>%s</u></span>",
853 g_free(buf);
855
856 hbox = gtk_grid_new();
859
860 /* Their flag */
862
865
866 /* Their name. */
871 buf = g_strdup_printf("<span size=\"large\" weight=\"bold\">%s</span>",
872 title_for_player(plr1, plr_buf, sizeof(plr_buf)));
874 g_free(buf);
876
878 pdialog->image1 = image;
880
881 /* Menu for clauses: they. */
883
884 menu = gtk_menu_new();
885 pdialog->menu1 = menu;
886
887 menuitem = gtk_menu_item_new_with_label(_("Add Clause..."));
890 g_object_set_data(G_OBJECT(menu), "plr", plr1);
891 g_signal_connect(menu, "show", G_CALLBACK(popup_add_menu), pdialog);
892
893 /* Main table for clauses and (if activated) gold trading: they. */
899
902 1.0);
905 gtk_grid_attach(GTK_GRID(table), spin, 1, 0, 1, 1);
906 g_object_set_data(G_OBJECT(spin), "plr", plr1);
907 g_signal_connect_after(spin, "value-changed",
909
910 label = g_object_new(GTK_TYPE_LABEL, "use-underline", TRUE,
911 "mnemonic-widget", spin, "label", _("Gold:"),
912 "xalign", 0.0, "yalign", 0.5, NULL);
913 gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1);
914
915 gtk_grid_attach(GTK_GRID(table), menubar, 2, 0, 1, 1);
916 } else {
917 gtk_grid_attach(GTK_GRID(table), menubar, 0, 0, 1, 1);
918 }
919
920 /* Clauses. */
925
927 pdialog->store = store;
928
933 g_object_unref(store);
935
938 rend, "text", 0, NULL);
939
941 g_object_set(sw, "margin", 2, NULL);
947
949 "use-underline", TRUE,
950 "mnemonic-widget", view,
951 "label", _("C_lauses:"),
952 "xalign", 0.0,
953 "yalign", 0.5,
954 NULL);
955
956 vbox = gtk_grid_new();
962
964
965 g_signal_connect(view, "row_activated", G_CALLBACK(row_callback), pdialog);
966
968 gui_dialog_show_all(pdialog->dialog);
969
970 return pdialog;
971}
972
973/************************************************************************/
976static void update_diplomacy_dialog(struct Diplomacy_dialog *pdialog)
977{
978 GtkListStore *store;
979 GtkTreeIter it;
980 bool blank = TRUE;
982
983 store = pdialog->store;
984
987 char buf[128];
988
990
991 gtk_list_store_append(store, &it);
992 gtk_list_store_set(store, &it, 0, buf, -1);
993 blank = FALSE;
995
996 if (blank) {
997 gtk_list_store_append(store, &it);
998 gtk_list_store_set(store, &it, 0,
999 _("--- This treaty is blank. "
1000 "Please add some clauses. ---"), -1);
1001 }
1002
1009}
1010
1011/************************************************************************/
1015{
1016 int giver, dest, other, tech;
1017
1018 giver = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w), "player_from"));
1019 dest = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w), "player_to"));
1020 tech = GPOINTER_TO_INT(data);
1021 if (player_by_number(giver) == client_player()) {
1022 other = dest;
1023 } else {
1024 other = giver;
1025 }
1026
1027 if (A_LAST == tech) {
1028 /* All techs. */
1029 struct player *pgiver = player_by_number(giver);
1030 struct player *pdest = player_by_number(dest);
1031 const struct research *dresearch, *gresearch;
1032
1035
1040
1046 == TECH_PREREQS_KNOWN)) {
1048 CLAUSE_ADVANCE, i);
1049 }
1051 } else {
1052 /* Only one tech. */
1054 CLAUSE_ADVANCE, tech);
1055 }
1056}
1057
1058/************************************************************************/
1063{
1064 struct city_deal *deal_data = (struct city_deal *)data;
1065 int other;
1066
1067 if (player_by_number(deal_data->giver) == client_player()) {
1069 } else {
1070 other = deal_data->giver;
1071 }
1072
1075
1076 free(deal_data);
1077}
1078
1079/************************************************************************/
1083{
1084 struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *)data;
1085 struct player *pgiver;
1086
1087 pgiver = (struct player *)g_object_get_data(G_OBJECT(w), "plr");
1088
1090 player_number(pdialog->treaty->plr1),
1092}
1093
1094/************************************************************************/
1098{
1099 struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *)data;
1100 struct player *pgiver;
1101
1102 pgiver = (struct player *)g_object_get_data(G_OBJECT(w), "plr");
1103
1105 player_number(pdialog->treaty->plr1),
1107 0);
1108}
1109
1110/************************************************************************/
1114 int type)
1115{
1116 struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *)data;
1117
1119 player_number(pdialog->treaty->plr1),
1120 player_number(pdialog->treaty->plr0),
1121 type, 0);
1122}
1123
1124/************************************************************************/
1131
1132/************************************************************************/
1139
1140/************************************************************************/
1147
1148/************************************************************************/
1152{
1153 struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *) data;
1154 struct player *pgiver =
1155 (struct player *) g_object_get_data(G_OBJECT(w), "plr");
1156
1158 player_number(pdialog->treaty->plr1),
1160 0);
1161}
1162
1163/************************************************************************/
1167{
1168 struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *) data;
1169 struct player *pgiver =
1170 (struct player *) g_object_get_data(G_OBJECT(w), "plr");
1171
1173 player_number(pdialog->treaty->plr1),
1175 0);
1176}
1177
1178/************************************************************************/
1182 gpointer data)
1183{
1184 struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *) data;
1185 struct player *pgiver =
1186 (struct player *) g_object_get_data(G_OBJECT(w), "plr");
1187
1189 player_number(pdialog->treaty->plr1),
1192 0);
1193}
1194
1195/************************************************************************/
1199{
1200 diplomacy_destroy(pdialog);
1201}
1202
1203/************************************************************************/
1207{
1209 dipl_main = NULL;
1210}
1211
1212/************************************************************************/
1219
1220/************************************************************************/
1224{
1225 struct player *plr0 = client.conn.playing;
1226
1228 if ((pdialog->treaty->plr0 == plr0 && pdialog->treaty->plr1 == they)
1229 || (pdialog->treaty->plr0 == they && pdialog->treaty->plr1 == plr0)) {
1230 return pdialog;
1231 }
1233
1234 return NULL;
1235}
1236
1237/************************************************************************/
1241{
1242 struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *) data;
1243 struct player *pgiver =
1244 (struct player *) g_object_get_data(G_OBJECT(w), "plr");
1246
1249 player_number(pdialog->treaty->plr1),
1252 } else {
1253 output_window_append(ftc_client, _("Invalid amount of gold specified."));
1254 }
1255}
1256
1257/************************************************************************/
#define n
Definition astring.c:77
void output_window_append(const struct ft_color color, const char *featured_text)
bool is_capital(const struct city *pcity)
Definition city.c:1579
const char * city_name_get(const struct city *pcity)
Definition city.c:1137
int city_name_compare(const void *p1, const void *p2)
Definition city.c:1711
#define city_list_iterate(citylist, pcity)
Definition city.h:508
#define city_list_iterate_end
Definition city.h:510
struct civclient client
const char * title_for_player(const struct player *pplayer, char *buf, size_t buf_len)
#define client_player()
void client_diplomacy_clause_string(char *buf, int bufsiz, struct Clause *pclause)
Definition climisc.c:241
char * incite_cost
Definition comments.c:75
struct Treaty struct player struct player *initiator gui_recv_create_clause
Definition diplodlg_g.h:32
struct Treaty * ptreaty
Definition diplodlg_g.h:28
struct Treaty struct player struct player *initiator struct Treaty struct player *they gui_recv_accept_treaty
Definition diplodlg_g.h:36
struct Treaty struct player * they
Definition diplodlg_g.h:28
gui_recv_cancel_meeting
Definition diplodlg_g.h:27
bool clause_enabled(enum clause_type type)
Definition diptreaty.c:289
#define clause_list_iterate_end
Definition diptreaty.h:70
#define clause_list_iterate(clauselist, pclause)
Definition diptreaty.h:68
int Tech_type_id
Definition fc_types.h:377
#define MAX_LEN_NAME
Definition fc_types.h:66
#define Q_(String)
Definition fcintl.h:70
#define _(String)
Definition fcintl.h:67
const struct ft_color ftc_client
struct civ_game game
Definition game.c:62
const char * ruler_title_for_player(const struct player *pplayer, char *buf, size_t buf_len)
Definition government.c:391
static void diplomacy_dialog_add_pact_clause(GtkWidget *w, gpointer data, int type)
Definition diplodlg.c:1113
#define RESPONSE_CANCEL_MEETING
Definition diplodlg.c:114
static gint sort_advance_names(gconstpointer a, gconstpointer b)
Definition diplodlg.c:236
static void close_diplomacy_dialog(struct Diplomacy_dialog *pdialog)
Definition diplodlg.c:1198
static void diplomacy_dialog_tech_callback(GtkWidget *w, gpointer data)
Definition diplodlg.c:1014
static void row_callback(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data)
Definition diplodlg.c:515
static void diplomacy_dialog_ceasefire_callback(GtkWidget *w, gpointer data)
Definition diplodlg.c:1127
static void popup_add_menu(GtkMenuShell *parent, gpointer data)
Definition diplodlg.c:248
static void update_diplomacy_dialog(struct Diplomacy_dialog *pdialog)
Definition diplodlg.c:976
static struct Diplomacy_dialog * create_diplomacy_dialog(struct Treaty *ptreaty, struct player *plr0, struct player *plr1)
Definition diplodlg.c:689
void gui_init_meeting(struct Treaty *ptreaty, struct player *they, struct player *initiator)
Definition diplodlg.c:137
static void diplomacy_dialog_seamap_callback(GtkWidget *w, gpointer data)
Definition diplodlg.c:1097
static void diplomacy_dialog_city_callback(GtkWidget *w, gpointer data)
Definition diplodlg.c:1062
static void diplomacy_dialog_map_callback(GtkWidget *w, gpointer data)
Definition diplodlg.c:1082
void diplomacy_dialog_init(void)
Definition diplodlg.c:1206
static void diplomacy_destroy(struct Diplomacy_dialog *pdialog)
Definition diplodlg.c:625
#define dialog_list_iterate_end
Definition diplodlg.c:83
static struct Diplomacy_notebook * diplomacy_main_create(void)
Definition diplodlg.c:541
static struct Diplomacy_dialog * find_diplomacy_dialog(struct player *they)
Definition diplodlg.c:1223
static void diplomacy_dialog_vision_callback(GtkWidget *w, gpointer data)
Definition diplodlg.c:1151
void close_all_diplomacy_dialogs(void)
Definition diplodlg.c:1260
#define RESPONSE_CANCEL_MEETING_ALL
Definition diplodlg.c:115
static void diplomacy_dialog_embassy_callback(GtkWidget *w, gpointer data)
Definition diplodlg.c:1166
static void diplomacy_dialog_shared_tiles_callback(GtkWidget *w, gpointer data)
Definition diplodlg.c:1181
static void diplomacy_response(struct gui_dialog *dlg, int response, gpointer data)
Definition diplodlg.c:658
void gui_recv_remove_clause(struct Treaty *ptreaty, struct player *they)
Definition diplodlg.c:188
#define dialog_list_iterate(dialoglist, pdialog)
Definition diplodlg.c:81
static struct dialog_list * dialog_list
Definition diplodlg.c:85
static void diplomacy_main_response(struct gui_dialog *dlg, int response, gpointer data)
Definition diplodlg.c:598
static void diplomacy_dialog_peace_callback(GtkWidget *w, gpointer data)
Definition diplodlg.c:1135
void diplomacy_dialog_done(void)
Definition diplodlg.c:1215
static void diplo_dialog_returnkey(GtkWidget *w, gpointer data)
Definition diplodlg.c:1240
static void popup_diplomacy_dialog(struct Treaty *ptreaty, struct player *they, struct player *initiator)
Definition diplodlg.c:205
static void diplomacy_main_destroy(void)
Definition diplodlg.c:586
void gui_prepare_clause_updt(struct Treaty *ptreaty, struct player *they)
Definition diplodlg.c:163
static void diplomacy_dialog_alliance_callback(GtkWidget *w, gpointer data)
Definition diplodlg.c:1143
static struct Diplomacy_notebook * dipl_main
Definition diplodlg.c:86
GtkWidget * top_notebook
Definition gui_main.c:129
void gui_dialog_destroy(struct gui_dialog *dlg)
Definition gui_stuff.c:954
void gui_dialog_present(struct gui_dialog *dlg)
Definition gui_stuff.c:835
void gui_dialog_set_default_response(struct gui_dialog *dlg, int response)
Definition gui_stuff.c:734
void gui_dialog_raise(struct gui_dialog *dlg)
Definition gui_stuff.c:865
void gui_dialog_new(struct gui_dialog **pdlg, GtkNotebook *notebook, gpointer user_data, bool check_top)
Definition gui_stuff.c:517
void gui_dialog_set_return_dialog(struct gui_dialog *dlg, struct gui_dialog *return_dialog)
Definition gui_stuff.c:997
void gui_dialog_response_set_callback(struct gui_dialog *dlg, GUI_DIALOG_RESPONSE_FUN fun)
Definition gui_stuff.c:988
void gui_dialog_show_all(struct gui_dialog *dlg)
Definition gui_stuff.c:795
void gui_dialog_set_title(struct gui_dialog *dlg, const char *title)
Definition gui_stuff.c:935
void gui_dialog_alert(struct gui_dialog *dlg)
Definition gui_stuff.c:888
GtkWidget * gtk_aux_menu_bar_new(void)
Definition gui_stuff.c:255
GtkWidget * gui_dialog_add_button(struct gui_dialog *dlg, const char *icon_name, const char *text, int response)
Definition gui_stuff.c:706
GdkPixbuf * get_thumb_pixbuf(int onoff)
Definition mapview.c:292
struct gui_dialog * players_dialog_shell
Definition plrdlg.c:58
GType type
Definition repodlgs.c:1313
#define fc_assert_ret(condition)
Definition log.h:191
#define fc_assert(condition)
Definition log.h:176
#define log_error(message,...)
Definition log.h:103
#define fc_malloc(sz)
Definition mem.h:34
struct nation_type * nation_of_player(const struct player *pplayer)
Definition nation.c:444
const char * nation_plural_for_player(const struct player *pplayer)
Definition nation.c:178
int dsend_packet_diplomacy_create_clause_req(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
int dsend_packet_diplomacy_cancel_meeting_req(struct connection *pc, int counterpart)
int dsend_packet_diplomacy_remove_clause_req(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
int dsend_packet_diplomacy_accept_treaty_req(struct connection *pc, int counterpart)
struct player * player_by_number(const int player_id)
Definition player.c:849
int player_number(const struct player *pplayer)
Definition player.c:837
bool player_has_real_embassy(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:240
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
bool gives_shared_vision(const struct player *me, const struct player *them)
Definition player.c:1485
#define is_human(plr)
Definition player.h:229
struct research * research_get(const struct player *pplayer)
Definition research.c:128
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
Definition research.c:619
bool research_invention_gettable(const struct research *presearch, const Tech_type_id tech, bool allow_holes)
Definition research.c:693
GtkWidget * image1
Definition diplodlg.c:61
GtkWidget * image0
Definition diplodlg.c:60
GtkWidget * menu1
Definition diplodlg.c:58
struct Treaty * treaty
Definition diplodlg.c:54
struct gui_dialog * dialog
Definition diplodlg.c:55
GtkWidget * menu0
Definition diplodlg.c:57
GtkListStore * store
Definition diplodlg.c:63
struct gui_dialog * dialog
Definition diplodlg.c:67
GtkWidget * notebook
Definition diplodlg.c:68
struct player * plr0
Definition diptreaty.h:79
bool accept0
Definition diptreaty.h:80
bool accept1
Definition diptreaty.h:80
struct clause_list * clauses
Definition diptreaty.h:81
struct player * plr1
Definition diptreaty.h:79
int giver
Definition diplodlg.c:72
int receiver
Definition diplodlg.c:73
Definition city.h:320
struct packet_game_info info
Definition game.h:89
struct connection conn
Definition client_main.h:96
struct player * playing
Definition connection.h:151
GtkWidget * vbox
Definition gui_stuff.h:72
GtkWidget * label
Definition gui_stuff.h:87
GtkWidget * notebook
Definition gui_stuff.h:88
Definition climisc.h:82
bool tech_trade_allow_holes
enum diplstate_type type
Definition player.h:197
struct player_economic economic
Definition player.h:282
int fc_strcasecmp(const char *str0, const char *str1)
Definition support.c:189
int fc_strcoll(const char *str0, const char *str1)
Definition support.c:473
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
#define fc__fallthrough
Definition support.h:119
const char * advance_name_translation(const struct advance *padvance)
Definition tech.c:290
Tech_type_id advance_number(const struct advance *padvance)
Definition tech.c:98
#define advance_iterate(_p)
Definition tech.h:275
#define advance_iterate_end
Definition tech.h:276
#define A_LAST
Definition tech.h:45
struct sprite * get_nation_flag_sprite(const struct tileset *t, const struct nation_type *pnation)
Definition tilespec.c:6756