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 diolag 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 free(pdialog);
635
636 if (dialog_list) {
637 /* Diplomatic meetings in one main tab. */
638 if (dialog_list_size(dialog_list) > 0) {
639 if (dipl_main && dipl_main->dialog) {
640 gchar *buf;
641
642 buf = g_strdup_printf(_("Diplomacy [%d]"), dialog_list_size(dialog_list));
644 g_free(buf);
645 }
646 } else if (dipl_main) {
647 /* No meeting left - destroy main tab. */
649 }
650 }
651}
652
653/************************************************************************/
656static void diplomacy_response(struct gui_dialog *dlg, int response,
657 gpointer data)
658{
659 struct Diplomacy_dialog *pdialog = NULL;
660
661 fc_assert_ret(data);
662 pdialog = (struct Diplomacy_dialog *)data;
663
664 switch (response) {
665 case GTK_RESPONSE_ACCEPT: /* Accept treaty. */
668 pdialog->treaty->plr1));
669 break;
670
671 default:
672 log_error("unhandled response in %s: %d", __FUNCTION__, response);
673 fc__fallthrough; /* No break. */
674 case GTK_RESPONSE_DELETE_EVENT: /* GTK: delete the widget. */
675 case GTK_RESPONSE_CANCEL: /* GTK: cancel button. */
676 case RESPONSE_CANCEL_MEETING: /* Cancel meetings. */
679 pdialog->treaty->plr1));
680 break;
681 }
682}
683
684/************************************************************************/
688 struct player *plr0,
689 struct player *plr1)
690{
692 GtkWidget *vbox, *hbox, *table, *mainbox;
693 GtkWidget *label, *sw, *view, *image, *spin;
695 struct sprite *flag_spr;
696 GtkListStore *store;
698 int i;
699
700 struct Diplomacy_dialog *pdialog;
701 char plr_buf[4 * MAX_LEN_NAME];
702 gchar *buf;
703
704 pdialog = fc_malloc(sizeof(*pdialog));
705
707 pdialog->treaty = ptreaty;
708
709 /* Get main diplomacy tab. */
711
712 buf = g_strdup_printf(_("Diplomacy [%d]"), dialog_list_size(dialog_list));
714 g_free(buf);
715
716 notebook = dipl_dialog->notebook;
717
718 gui_dialog_new(&(pdialog->dialog), GTK_NOTEBOOK(notebook), pdialog, FALSE);
719
720 /* Buttons */
722 _("Accept treaty"), GTK_RESPONSE_ACCEPT);
724 _("Cancel meeting"), RESPONSE_CANCEL_MEETING);
725
726 /* Responses for one meeting. */
729
730 /* Label for the new meeting. */
733
734 /* Sort meeting tabs alphabetically by the tab label. */
735 for (i = 0; i < gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)); i++) {
738 struct gui_dialog *prev_dialog
739 = g_object_get_data(G_OBJECT(prev_page), "gui-dialog-data");
740 const char *prev_label
742
743 if (fc_strcasecmp(buf, prev_label) < 0) {
745 pdialog->dialog->vbox, i);
746 break;
747 }
748 }
749 g_free(buf);
750
751 /* Content. */
752 mainbox = pdialog->dialog->vbox;
753
754 /* us. */
755 vbox = gtk_grid_new();
761
762 /* Our nation. */
766 buf = g_strdup_printf("<span size=\"large\"><u>%s</u></span>",
769 g_free(buf);
771
772 hbox = gtk_grid_new();
775
776 /* Our flag */
778
781
782 /* Our name. */
787 buf = g_strdup_printf("<span size=\"large\" weight=\"bold\">%s</span>",
788 ruler_title_for_player(plr0, plr_buf, sizeof(plr_buf)));
790 g_free(buf);
792
794 pdialog->image0 = image;
796
797 /* Menu for clauses: we. */
799
800 menu = gtk_menu_new();
801 pdialog->menu0 = menu;
802
803 menuitem = gtk_menu_item_new_with_label(_("Add Clause..."));
806 g_object_set_data(G_OBJECT(menu), "plr", plr0);
807 g_signal_connect(menu, "show", G_CALLBACK(popup_add_menu), pdialog);
808
809 /* Main table for clauses and (if activated) gold trading: we. */
815
818 1.0);
821 gtk_grid_attach(GTK_GRID(table), spin, 1, 0, 1, 1);
822 g_object_set_data(G_OBJECT(spin), "plr", plr0);
823 g_signal_connect_after(spin, "value-changed",
825
826 label = g_object_new(GTK_TYPE_LABEL, "use-underline", TRUE,
827 "mnemonic-widget", spin, "label", _("Gold:"),
828 "xalign", 0.0, "yalign", 0.5, NULL);
829 gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1);
830
831 gtk_grid_attach(GTK_GRID(table), menubar, 2, 0, 1, 1);
832 } else {
833 gtk_grid_attach(GTK_GRID(table), menubar, 0, 0, 1, 1);
834 }
835
836 /* them. */
837 vbox = gtk_grid_new();
843
844 /* Their nation. */
848 buf = g_strdup_printf("<span size=\"large\"><u>%s</u></span>",
851 g_free(buf);
853
854 hbox = gtk_grid_new();
857
858 /* Their flag */
860
863
864 /* Their name. */
869 buf = g_strdup_printf("<span size=\"large\" weight=\"bold\">%s</span>",
870 ruler_title_for_player(plr1, plr_buf, sizeof(plr_buf)));
872 g_free(buf);
874
876 pdialog->image1 = image;
878
879 /* Menu for clauses: they. */
881
882 menu = gtk_menu_new();
883 pdialog->menu1 = menu;
884
885 menuitem = gtk_menu_item_new_with_label(_("Add Clause..."));
888 g_object_set_data(G_OBJECT(menu), "plr", plr1);
889 g_signal_connect(menu, "show", G_CALLBACK(popup_add_menu), pdialog);
890
891 /* Main table for clauses and (if activated) gold trading: they. */
897
900 1.0);
903 gtk_grid_attach(GTK_GRID(table), spin, 1, 0, 1, 1);
904 g_object_set_data(G_OBJECT(spin), "plr", plr1);
905 g_signal_connect_after(spin, "value-changed",
907
908 label = g_object_new(GTK_TYPE_LABEL, "use-underline", TRUE,
909 "mnemonic-widget", spin, "label", _("Gold:"),
910 "xalign", 0.0, "yalign", 0.5, NULL);
911 gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1);
912
913 gtk_grid_attach(GTK_GRID(table), menubar, 2, 0, 1, 1);
914 } else {
915 gtk_grid_attach(GTK_GRID(table), menubar, 0, 0, 1, 1);
916 }
917
918 /* Clauses. */
923
925 pdialog->store = store;
926
931 g_object_unref(store);
933
936 rend, "text", 0, NULL);
937
939 g_object_set(sw, "margin", 2, NULL);
945
947 "use-underline", TRUE,
948 "mnemonic-widget", view,
949 "label", _("C_lauses:"),
950 "xalign", 0.0,
951 "yalign", 0.5,
952 NULL);
953
954 vbox = gtk_grid_new();
960
962
963 g_signal_connect(view, "row_activated", G_CALLBACK(row_callback), pdialog);
964
966 gui_dialog_show_all(pdialog->dialog);
967
968 return pdialog;
969}
970
971/************************************************************************/
974static void update_diplomacy_dialog(struct Diplomacy_dialog *pdialog)
975{
976 GtkListStore *store;
977 GtkTreeIter it;
978 bool blank = TRUE;
980
981 store = pdialog->store;
982
985 char buf[128];
986
988
989 gtk_list_store_append(store, &it);
990 gtk_list_store_set(store, &it, 0, buf, -1);
991 blank = FALSE;
993
994 if (blank) {
995 gtk_list_store_append(store, &it);
996 gtk_list_store_set(store, &it, 0,
997 _("--- This treaty is blank. "
998 "Please add some clauses. ---"), -1);
999 }
1000
1007}
1008
1009/************************************************************************/
1013{
1014 int giver, dest, other, tech;
1015
1016 giver = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w), "player_from"));
1017 dest = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w), "player_to"));
1018 tech = GPOINTER_TO_INT(data);
1019 if (player_by_number(giver) == client_player()) {
1020 other = dest;
1021 } else {
1022 other = giver;
1023 }
1024
1025 if (A_LAST == tech) {
1026 /* All techs. */
1027 struct player *pgiver = player_by_number(giver);
1028 struct player *pdest = player_by_number(dest);
1029 const struct research *dresearch, *gresearch;
1030
1033
1038
1044 == TECH_PREREQS_KNOWN)) {
1046 CLAUSE_ADVANCE, i);
1047 }
1049 } else {
1050 /* Only one tech. */
1052 CLAUSE_ADVANCE, tech);
1053 }
1054}
1055
1056/************************************************************************/
1061{
1062 struct city_deal *deal_data = (struct city_deal *)data;
1063 int other;
1064
1065 if (player_by_number(deal_data->giver) == client_player()) {
1067 } else {
1068 other = deal_data->giver;
1069 }
1070
1073
1074 free(deal_data);
1075}
1076
1077/************************************************************************/
1081{
1082 struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *)data;
1083 struct player *pgiver;
1084
1085 pgiver = (struct player *)g_object_get_data(G_OBJECT(w), "plr");
1086
1088 player_number(pdialog->treaty->plr1),
1090}
1091
1092/************************************************************************/
1096{
1097 struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *)data;
1098 struct player *pgiver;
1099
1100 pgiver = (struct player *)g_object_get_data(G_OBJECT(w), "plr");
1101
1103 player_number(pdialog->treaty->plr1),
1105 0);
1106}
1107
1108/************************************************************************/
1112 int type)
1113{
1114 struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *)data;
1115
1117 player_number(pdialog->treaty->plr1),
1118 player_number(pdialog->treaty->plr0),
1119 type, 0);
1120}
1121
1122/************************************************************************/
1129
1130/************************************************************************/
1137
1138/************************************************************************/
1145
1146/************************************************************************/
1150{
1151 struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *) data;
1152 struct player *pgiver =
1153 (struct player *) g_object_get_data(G_OBJECT(w), "plr");
1154
1156 player_number(pdialog->treaty->plr1),
1158 0);
1159}
1160
1161/************************************************************************/
1165{
1166 struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *) data;
1167 struct player *pgiver =
1168 (struct player *) g_object_get_data(G_OBJECT(w), "plr");
1169
1171 player_number(pdialog->treaty->plr1),
1173 0);
1174}
1175
1176/************************************************************************/
1180 gpointer data)
1181{
1182 struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *) data;
1183 struct player *pgiver =
1184 (struct player *) g_object_get_data(G_OBJECT(w), "plr");
1185
1187 player_number(pdialog->treaty->plr1),
1190 0);
1191}
1192
1193/************************************************************************/
1197{
1198 diplomacy_destroy(pdialog);
1199}
1200
1201/************************************************************************/
1205{
1207 dipl_main = NULL;
1208}
1209
1210/************************************************************************/
1217
1218/************************************************************************/
1222{
1223 struct player *plr0 = client.conn.playing;
1224
1226 if ((pdialog->treaty->plr0 == plr0 && pdialog->treaty->plr1 == they)
1227 || (pdialog->treaty->plr0 == they && pdialog->treaty->plr1 == plr0)) {
1228 return pdialog;
1229 }
1231
1232 return NULL;
1233}
1234
1235/************************************************************************/
1239{
1240 struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *) data;
1241 struct player *pgiver =
1242 (struct player *) g_object_get_data(G_OBJECT(w), "plr");
1244
1247 player_number(pdialog->treaty->plr1),
1250 } else {
1251 output_window_append(ftc_client, _("Invalid amount of gold specified."));
1252 }
1253}
1254
1255/************************************************************************/
#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:1571
const char * city_name_get(const struct city *pcity)
Definition city.c:1128
int city_name_compare(const void *p1, const void *p2)
Definition city.c:1703
#define city_list_iterate(citylist, pcity)
Definition city.h:508
#define city_list_iterate_end
Definition city.h:510
struct civclient client
#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:74
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:380
#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:1111
#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:1196
static void diplomacy_dialog_tech_callback(GtkWidget *w, gpointer data)
Definition diplodlg.c:1012
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:1125
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:974
static struct Diplomacy_dialog * create_diplomacy_dialog(struct Treaty *ptreaty, struct player *plr0, struct player *plr1)
Definition diplodlg.c:687
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:1095
static void diplomacy_dialog_city_callback(GtkWidget *w, gpointer data)
Definition diplodlg.c:1060
static void diplomacy_dialog_map_callback(GtkWidget *w, gpointer data)
Definition diplodlg.c:1080
void diplomacy_dialog_init(void)
Definition diplodlg.c:1204
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:1221
static void diplomacy_dialog_vision_callback(GtkWidget *w, gpointer data)
Definition diplodlg.c:1149
void close_all_diplomacy_dialogs(void)
Definition diplodlg.c:1258
#define RESPONSE_CANCEL_MEETING_ALL
Definition diplodlg.c:115
static void diplomacy_dialog_embassy_callback(GtkWidget *w, gpointer data)
Definition diplodlg.c:1164
static void diplomacy_dialog_shared_tiles_callback(GtkWidget *w, gpointer data)
Definition diplodlg.c:1179
static void diplomacy_response(struct gui_dialog *dlg, int response, gpointer data)
Definition diplodlg.c:656
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:1133
void diplomacy_dialog_done(void)
Definition diplodlg.c:1213
static void diplo_dialog_returnkey(GtkWidget *w, gpointer data)
Definition diplodlg.c:1238
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:1141
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:80
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:6760