Freeciv-3.3
Loading...
Searching...
No Matches
cityrep.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#include <string.h>
21
22#include <gtk/gtk.h>
23#include <gdk/gdkkeysyms.h>
24
25/* utility */
26#include "fcintl.h"
27#include "log.h"
28#include "shared.h"
29#include "support.h"
30
31/* common */
32#include "city.h"
33#include "game.h"
34#include "packets.h"
35#include "unit.h"
36
37/* client/agents */
38#include "cma_fec.h"
39
40/* client */
41#include "citydlg_common.h"
42#include "cityrepdata.h"
43#include "client_main.h"
44#include "climisc.h"
45#include "global_worklist.h"
46#include "mapctrl_common.h" /* is_city_hilited() */
47#include "mapview_common.h"
48#include "options.h"
49
50/* client/gui-gtk-4.0 */
51#include "chatline.h"
52#include "citydlg.h"
53#include "gui_main.h"
54#include "gui_stuff.h"
55#include "mapview.h"
56#include "optiondlg.h"
57#include "repodlgs.h"
58
59#include "cityrep.h"
60
61#define NEG_VAL(x) ((x)<0 ? (x) : (-x))
62
63/* Some versions of gcc have problems with negative values here (PR#39722). */
64#define CMA_NONE (10000)
65#define CMA_CUSTOM (10001)
66
67struct sell_data {
68 int count; /* Number of cities. */
69 int gold; /* Amount of gold. */
70 const struct impr_type *target; /* The target for selling. */
71};
72
76
77/******************************************************************/
79
82
83static void city_command_callback(struct gui_dialog *dlg, int response,
84 gpointer data);
85
88 gpointer data);
89static void update_total_buy_cost(void);
90
93
94static GMenu *create_change_menu(GActionGroup *group, const char *mname,
95 const char *human_mname,
97
99
100enum {
103
107#define CRD_COL_CITY_ID (0 + NUM_CREPORT_COLS)
108
109#ifdef MENUS_GTK3
110static void popup_select_menu(GtkMenuShell *menu, gpointer data);
111#endif /* MENUS_GTK3 */
112
113static void recreate_production_menu(GActionGroup *group);
114static void recreate_select_menu(GActionGroup *group);
115static void recreate_sell_menu(GActionGroup *group);
116
120#ifdef MENUS_GTK3
122#endif /* MENUS_GTK3 */
124
133
146
148
152
153/************************************************************************/
156static void get_city_table_header(char **text, int n)
157{
158 struct city_report_spec *spec;
159 int i;
160
161 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
162 fc_snprintf(text[i], n, "%*s\n%*s",
163 NEG_VAL(spec->width), spec->title1 ? spec->title1 : "",
164 NEG_VAL(spec->width), spec->title2 ? spec->title2 : "");
165 }
166}
167
168/****************************************************************************
169 CITY REPORT DIALOG
170****************************************************************************/
171
172/************************************************************************/
176{
178 gint i;
179
180 /* City report data. */
181 for (i = 0; i < NUM_CREPORT_COLS; i++) {
183 }
184
185 /* Specific gtk client data. */
186 model_types[i++] = G_TYPE_INT; /* CRD_COL_CITY_ID */
187
189}
190
191/************************************************************************/
195 struct city *pcity)
196{
197 struct city_report_spec *spec;
198 char buf[64];
199 gint i;
200
201 for (i = 0; i < NUM_CREPORT_COLS; i++) {
202 spec = city_report_specs + i;
203 fc_snprintf(buf, sizeof(buf), "%*s", NEG_VAL(spec->width),
204 spec->func(pcity, spec->data));
205 gtk_list_store_set(store, iter, i, buf, -1);
206 }
208}
209
210/************************************************************************/
214{
215 struct city *pcity;
216 int id;
217
218 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
220 return ((NULL != pcity
223 ? NULL : pcity);
224}
225
226/************************************************************************/
230 const struct city *pcity)
231{
232 const int searched = pcity->id;
233 int id;
234
236 do {
237 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
238 if (searched == id) {
239 return TRUE;
240 }
241 } while (gtk_tree_model_iter_next(model, iter));
242 }
243 return FALSE;
244}
245
246/************************************************************************/
249static void city_model_fill(GtkListStore *store,
250 GtkTreeSelection *selection, GHashTable *select)
251{
253
254 if (client_has_player()) {
257 city_model_set(store, &iter, pcity);
258 if (NULL != select
261 }
263 } else {
264 /* Global observer case. */
267 city_model_set(store, &iter, pcity);
268 if (NULL != select
271 }
273 }
274}
275
276/************************************************************************/
293
294/************************************************************************/
303
304/************************************************************************/
309 const char *act_pfx,
310 const char *act_pfx2,
311 bool append_units,
312 bool append_wonders,
317 int size)
318{
320 struct item items[MAX_NUM_PRODUCTION_TARGETS];
321 int i, item, targets_used;
322 char *row[4];
323 char buf[4][64];
324
325 GtkSizeGroup *size_group[3];
326
327#ifdef MENUS_GTK3
328 const char *markup[3] = {
329 "weight=\"bold\"",
330 "",
331 ""
332 };
333#endif
334
335 if (city_operation != CO_NONE) {
336 GPtrArray *selected;
337 ITree it;
338 int num_selected = 0;
340 struct city **data;
341
342 selected = g_ptr_array_sized_new(size);
343
344 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
345 struct city *pcity;
346
348 || !(pcity = city_model_get(model, TREE_ITER_PTR(it)))) {
349 continue;
350 }
351
352 g_ptr_array_add(selected, pcity);
353 num_selected++;
354 }
355
356 data = (struct city **)g_ptr_array_free(selected, FALSE);
360 g_free(data);
361 } else {
364 test_func);
365 }
366
367 name_and_sort_items(targets, targets_used, items,
369
370 for (i = 0; i < 4; i++) {
371 row[i] = buf[i];
372 }
373
374
375 for (i = 0; i < 3; i++) {
377 }
378
379 for (item = 0; item < targets_used; item++) {
380 struct universal target = items[item].item;
382 char actbuf[256];
383 GSimpleAction *act;
384#ifdef MENUS_GTK3
385 char txt[256];
386 GtkWidget *hgrid, *label;
387 int grid_col = 0;
388#endif /* MENUS_GTK3 */
389
390 get_city_dialog_production_row(row, sizeof(buf[0]), &target, NULL);
391
392 fc_snprintf(actbuf, sizeof(actbuf), "win.%s%s%d", act_pfx, act_pfx2, item);
393
395
396 fc_snprintf(actbuf, sizeof(actbuf), "%s%s%d", act_pfx, act_pfx2, item);
398 g_object_set_data(G_OBJECT(act), "freeciv_test_func", test_func);
399 g_object_set_data(G_OBJECT(act), "freeciv_city_operation",
402 g_signal_connect(act, "activate", callback,
403 GINT_TO_POINTER(cid_encode(target)));
405
406#ifdef MENUS_GTK3
410
411 for (i = 0; i < 3; i++) {
412 if (row[i][0] == '\0') {
413 continue;
414 }
415
416 if (city_operation == CO_SELL && i != 0) {
417 continue;
418 }
419
420 fc_snprintf(txt, ARRAY_SIZE(txt), "<span %s>%s</span>",
421 markup[i], row[i]);
422
423 label = gtk_label_new(NULL);
425
426 switch (i) {
427 case 0:
430 break;
431 case 2:
434 break;
435 default:
436 break;
437 }
438
439 gtk_grid_attach(GTK_GRID(hgrid), label, grid_col++, 0, 1, 1);
440 gtk_size_group_add_widget(size_group[i], label);
441 }
442
445 GINT_TO_POINTER(cid_encode(target)));
446#endif /* MENUS_GTK3 */
447 }
448
449 for (i = 0; i < 3; i++) {
450 g_object_unref(size_group[i]);
451 }
452
453#ifdef MENUS_GTK3
455#endif
456}
457
458/************************************************************************/
463{
464 struct universal target = cid_decode(GPOINTER_TO_INT(data));
465 struct city *pcity = city_model_get(model, iter);
466
467 if (NULL != pcity) {
469 }
470}
471
472/************************************************************************/
478 GtkTreePath *path,
480 gpointer data)
481{
482 struct universal target = cid_decode(GPOINTER_TO_INT(data));
483 struct city *pcity = city_model_get(model, iter);
484
485 if (NULL != pcity) {
486 (void) city_queue_insert(pcity, -1, &target);
487 }
488 /* Perhaps should warn the user if not successful? */
489}
490
491/************************************************************************/
499 GtkTreePath *path,
501 gpointer data)
502{
503 struct universal target = cid_decode(GPOINTER_TO_INT(data));
504 struct city *pcity = city_model_get(model, iter);
505
506 if (NULL != pcity) {
507 (void) city_queue_insert(pcity, 0, &target);
508 }
509 /* Perhaps should warn the user if not successful? */
510}
511
512/************************************************************************/
519 GtkTreePath *path,
521 gpointer data)
522{
523 struct universal target = cid_decode(GPOINTER_TO_INT(data));
524 struct city *pcity = city_model_get(model, iter);
525
526 if (NULL != pcity) {
527 (void) city_queue_insert(pcity, 1, &target);
528 }
529 /* Perhaps should warn the user if not successful? */
530}
531
532/************************************************************************/
538 GtkTreePath *path,
540 gpointer data)
541{
542 struct universal target = cid_decode(GPOINTER_TO_INT(data));
543 struct city *pcity = city_model_get(model, iter);
544
545 if (NULL != pcity) {
546 city_queue_insert(pcity, worklist_length(&pcity->worklist), &target);
547 }
548}
549
550/************************************************************************/
555{
556 struct sell_data *sd = (struct sell_data *) data;
557 struct city *pcity = city_model_get(model, iter);
558
559 if (NULL != pcity
560 && !pcity->did_sell
561 && city_has_building(pcity, sd->target)) {
562 sd->count++;
563 sd->gold += impr_sell_gold(sd->target);
565 }
566}
567
568/************************************************************************/
573 GVariant *parameter,
574 gpointer data)
575{
576 struct universal target = cid_decode(GPOINTER_TO_INT(data));
577 TestCityFunc test_func = g_object_get_data(G_OBJECT(action), "freeciv_test_func");
579 GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "freeciv_city_operation"));
580
581 /* If this is not a city operation: */
582 if (city_operation == CO_NONE) {
584 ITree it;
585
587 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
588 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
589
590 if (NULL != pcity && test_func(pcity, &target)) {
592 }
593 }
594 } else {
596
598 switch (city_operation) {
599 case CO_LAST:
602 GINT_TO_POINTER(cid_encode(target)));
603 break;
604 case CO_CHANGE:
607 GINT_TO_POINTER(cid_encode(target)));
608 break;
609 case CO_FIRST:
612 GINT_TO_POINTER(cid_encode(target)));
613 break;
614 case CO_NEXT:
617 GINT_TO_POINTER(cid_encode(target)));
618 break;
619 case CO_NEXT_TO_LAST:
622 GINT_TO_POINTER(cid_encode(target)));
623 break;
624 case CO_SELL:
625 fc_assert_action(target.kind == VUT_IMPROVEMENT, break);
626 {
627 const struct impr_type *building = target.value.building;
628 struct sell_data sd = { 0, 0, building };
629 GtkWidget *w;
630 gint res;
631 gchar *buf;
632 const char *imprname = improvement_name_translation(building);
633
634 /* Ask confirmation */
635 buf = g_strdup_printf(_("Are you sure you want to sell those %s?"), imprname);
638 GTK_BUTTONS_YES_NO, "%s", buf);
639 g_free(buf);
640 res = blocking_dialog(w); /* Synchron. */
642 if (res == GTK_RESPONSE_NO) {
643 break;
644 }
645
648 if (sd.count > 0) {
649 /* FIXME: plurality of sd.count is ignored! */
650 /* TRANS: "Sold 3 Harbor for 90 gold." (Pluralisation is in gold --
651 * second %d -- not in buildings.) */
654 PL_("Sold %d %s for %d gold.",
655 "Sold %d %s for %d gold.",
656 sd.gold),
657 sd.count, imprname, sd.gold);
658 } else {
661 _("No %s could be sold."),
662 imprname);
663 }
664
665 g_signal_connect(w, "response",
667 gtk_window_present(GTK_WINDOW(w)); /* Asynchron. */
668 }
669 break;
670 case CO_NONE:
671 break;
672 }
674 }
675}
676
677/************************************************************************/
682{
683 struct city *pcity = city_model_get(model, iter);
684 int idx = GPOINTER_TO_INT(data);
685
686 if (NULL != pcity) {
687 if (CMA_NONE == idx) {
689 } else {
691 }
693 }
694}
695
696/************************************************************************/
701 GVariant *parameter,
702 gpointer data)
703{
704 int idx = GPOINTER_TO_INT(data);
705 bool change_governor =
707 struct cm_parameter cm;
708
709 /* If this is not the change button but the select cities button. */
710 if (!change_governor) {
711 ITree it;
713
715 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
716 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
717 int controlled;
718 bool select;
719
720 if (NULL == pcity) {
721 continue;
722 }
724 select = FALSE;
725
726 if (idx == CMA_NONE) {
727 /* CMA_NONE selects not-controlled, all others require controlled */
728 if (!controlled) {
729 select = TRUE;
730 }
731 } else if (controlled) {
732 if (idx == CMA_CUSTOM) {
734 select = TRUE;
735 }
736 } else if (cm_are_parameter_equal(&cm,
738 select = TRUE;
739 }
740 }
741
742 if (select) {
744 }
745 }
746 } else {
749 GINT_TO_POINTER(idx));
750 }
751}
752
753/************************************************************************/
760 bool change_governor)
761{
762 GMenu *menu;
763 int i;
764 struct cm_parameter cm;
765
766 menu = g_menu_new();
767
769 return menu;
770 }
771
772 if (change_governor) {
773 GSimpleAction *act;
774
775 act = g_simple_action_new("chg_governor_none", NULL);
776 g_object_set_data(G_OBJECT(act), "governor",
782 g_menu_item_new(Q_("?cma:none"),
783 "win.chg_governor_none"));
784
785 for (i = 0; i < cmafec_preset_num(); i++) {
786 char buf[128];
787
788 fc_snprintf(buf, sizeof(buf), "chg_governor_%d", i);
790 g_object_set_data(G_OBJECT(act), "governor",
795 fc_snprintf(buf, sizeof(buf), "win.chg_governor_%d", i);
798 }
799 } else {
800 /* Search for a "none" */
801 bool found;
802
803 found = FALSE;
806 found = TRUE;
807 break;
808 }
810
811 if (found) {
812 GSimpleAction *act;
813
814 act = g_simple_action_new("sel_governor_none", NULL);
815 g_object_set_data(G_OBJECT(act), "governor",
821 g_menu_item_new(Q_("?cma:none"),
822 "win.sel_governor_none"));
823 }
824
825 /*
826 * Search for a city that's under custom (not preset) agent. Might
827 * take a lonnggg time.
828 */
829 found = FALSE;
833 found = TRUE;
834 break;
835 }
837
838 if (found) {
839 /* We found city that's under agent but not a preset */
840 GSimpleAction *act;
841
842 act = g_simple_action_new("sel_governor_custom", NULL);
843 g_object_set_data(G_OBJECT(act), "governor",
849 g_menu_item_new(Q_("?cma:custom"),
850 "win.sel_governor_custom"));
851 }
852
853 /* Only fill in presets that are being used. */
854 for (i = 0; i < cmafec_preset_num(); i++) {
855 found = FALSE;
860 found = TRUE;
861 break;
862 }
864
865 if (found) {
866 GSimpleAction *act;
867 char buf[128];
868
869 fc_snprintf(buf, sizeof(buf), "sel_governor_%d", i);
870
872 g_object_set_data(G_OBJECT(act), "governor",
877 fc_snprintf(buf, sizeof(buf), "win.sel_governor_%d", i);
880 buf));
881 }
882 }
883 }
884
885 return menu;
886}
887
888/************************************************************************/
897
898/************************************************************************/
905{
906 const struct worklist *pwl = data;
907 struct city *pcity = city_model_get(model, iter);
908
910
911 if (NULL != pcity) {
913 }
914}
915
916/************************************************************************/
922 GVariant *parameter,
923 gpointer data)
924{
925 struct global_worklist *pgwl =
927
929
930 if (!pgwl) {
931 /* Maybe removed by an other way, not an error. */
932 return;
933 }
934
938}
939
940/************************************************************************/
946{
947 const struct worklist *pwl = data;
948 struct city *pcity = city_model_get(model, iter);
949
951
952 if (NULL != pcity) {
954 }
955}
956
957/************************************************************************/
962 GVariant *parameter,
963 gpointer data)
964{
965 struct global_worklist *pgwl =
967
971
972 if (!pgwl) {
973 /* Maybe removed by an other way, not an error. */
974 return;
975 }
976
980}
981
982/************************************************************************/
985static GMenu *create_wl_menu(GActionGroup *group, const char *act_pfx,
986 GCallback cb)
987{
988 GMenu *menu;
989 GSimpleAction *act;
990 int count = 0;
991
992 menu = g_menu_new();
993
995 return NULL;
996 }
997
999 char buf[128];
1000
1001 fc_snprintf(buf, sizeof(buf), "wl%s%d", act_pfx, count);
1004 g_signal_connect(act, "activate", cb,
1006 fc_snprintf(buf, sizeof(buf), "win.wl%s%d", act_pfx, count);
1009 buf));
1010 count++;
1012
1013 if (count == 0) {
1014 char buf[64];
1015
1016 fc_snprintf(buf, sizeof(buf), "win.wl%s_dummy", act_pfx);
1018 g_menu_item_new(_("(no worklists defined)"), buf));
1019 }
1020
1021 return menu;
1022}
1023
1024/************************************************************************/
1028{
1029 struct city_report_spec *spec;
1032 GList *columns, *p;
1033
1036
1038
1039 for (p = columns; p != NULL; p = p->next) {
1040 col = p->data;
1041 spec = g_object_get_data(G_OBJECT(col), "city_report_spec");
1043 }
1044
1045 g_list_free(columns);
1046}
1047
1048/************************************************************************/
1053{
1054 GMenuItem *item;
1055 char act_name[50];
1056 struct city_report_spec *spec = city_report_specs + pos;
1057
1058 fc_snprintf(act_name, sizeof(act_name), "win.display%d(%s)",
1059 pos, spec->show ? "true" : "false");
1062
1063 return item;
1064}
1065
1066/************************************************************************/
1070{
1071 struct city_report_spec *spec = data;
1072 int idx = spec - city_report_specs;
1073
1074 spec->show ^= 1;
1076
1079}
1080
1081/************************************************************************/
1085{
1086 struct city_report_spec *spec;
1087 int i;
1089
1091 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
1092 GSimpleAction *act;
1093 char act_name[50];
1094 GVariant *var = g_variant_new("b", TRUE);
1095
1096 fc_snprintf(act_name, sizeof(act_name), "display%d", i);
1099 g_signal_connect(act, "change-state", G_CALLBACK(toggle_view), (gpointer)spec);
1100
1102 }
1103
1105
1106 return display_menu;
1107}
1108
1109/************************************************************************/
1147
1148/************************************************************************/
1153{
1155 gchar *str1, *str2;
1156 int i;
1157
1158 gtk_tree_model_get(model, a, col, &str1, -1);
1159 gtk_tree_model_get(model, b, col, &str2, -1);
1160
1162 g_free(str1);
1163 g_free(str2);
1164 return i;
1165}
1166
1167/************************************************************************/
1171{
1172 static char **titles;
1173 static char (*buf)[128];
1174 struct city_report_spec *spec;
1175
1176 GtkWidget *w, *sw, *aux_menu;
1177 int i;
1178
1181
1183
1186
1187 /* Menu */
1190
1191 /* Buttons */
1198
1200 _("_Buy"), CITY_BUY);
1201 city_buy_command = w;
1202
1204 _("_Inspect"), CITY_POPUP);
1206
1208 _("Cen_ter"), CITY_CENTER);
1210
1211 /* Tree view */
1212 buf = fc_realloc(buf, NUM_CREPORT_COLS * sizeof(buf[0]));
1214 for (i = 0; i < NUM_CREPORT_COLS; i++) {
1215 titles[i] = buf[i];
1216 }
1217 get_city_table_header(titles, sizeof(buf[0]));
1218
1220
1225 gtk_widget_set_name(city_view, "small_font");
1226 g_signal_connect(city_view, "row_activated",
1232
1233 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
1234 GtkWidget *header;
1235 GtkCellRenderer *renderer;
1237
1238 renderer = gtk_cell_renderer_text_new();
1240 "text", i, NULL);
1241 header = gtk_label_new(titles[i]);
1248 g_object_set_data(G_OBJECT(col), "city_report_spec", spec);
1252 NULL);
1253 }
1254
1260
1262
1265
1266 /* Real menus */
1270
1272}
1273
1274/************************************************************************/
1283
1284/************************************************************************/
1293
1294/************************************************************************/
1298 GVariant *parameter,
1299 gpointer data)
1300{
1301 ITree it;
1303
1304 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1307 } else {
1309 }
1310 }
1311}
1312
1313/************************************************************************/
1317 GVariant *parameter,
1318 gpointer data)
1319{
1320 ITree it;
1322
1324
1325 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1326 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1327
1328 if (pcity != NULL
1331 }
1332 }
1333}
1334
1335/************************************************************************/
1339 GtkTreeIter *iter, gpointer data)
1340{
1341 struct city *selected_pcity = city_model_get(model, iter);
1342 ITree it;
1343
1344 if (NULL == selected_pcity) {
1345 return;
1346 }
1347
1348 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1349 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1350
1351 if (NULL != pcity
1353 == tile_continent(selected_pcity->tile))) {
1355 }
1356 }
1357}
1358
1359/************************************************************************/
1369
1370/************************************************************************/
1374 GVariant *parameter,
1375 gpointer data)
1376{
1378 ITree it;
1380
1382
1383 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1384 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1385
1386 if (NULL != pcity
1387 && ((which == PCT_UNIT && VUT_UTYPE == pcity->production.kind)
1388 || (which == PCT_IMPROVEMENT
1389 && VUT_IMPROVEMENT == pcity->production.kind
1390 && !is_wonder(pcity->production.value.building))
1391 || (which == PCT_WONDER
1392 && VUT_IMPROVEMENT == pcity->production.kind
1393 && is_wonder(pcity->production.value.building)))) {
1395 }
1396 }
1397}
1398
1399/************************************************************************/
1402static void buy_iterate(GtkTreeModel *model, GtkTreePath *path,
1403 GtkTreeIter *iter, gpointer data)
1404{
1405 struct city *pcity = city_model_get(model, iter);
1406
1407 if (NULL != pcity) {
1409 }
1410}
1411
1412/************************************************************************/
1415static void center_iterate(GtkTreeModel *model, GtkTreePath *path,
1416 GtkTreeIter *iter, gpointer data)
1417{
1418 struct city *pcity = city_model_get(model, iter);
1419
1420 if (NULL != pcity) {
1422 }
1423}
1424
1425/************************************************************************/
1428static void popup_iterate(GtkTreeModel *model, GtkTreePath *path,
1429 GtkTreeIter *iter, gpointer data)
1430{
1431 struct city *pcity = city_model_get(model, iter);
1432
1433 if (NULL != pcity) {
1436 }
1438 }
1439}
1440
1441/************************************************************************/
1444static void city_command_callback(struct gui_dialog *dlg, int response,
1445 gpointer data)
1446{
1447 switch (response) {
1448 case CITY_CENTER:
1450 /* Center to city doesn't make sense if many city are selected. */
1452 NULL);
1453 }
1454 break;
1455 case CITY_POPUP:
1457 break;
1458 case CITY_BUY:
1460 break;
1461 default:
1462 gui_dialog_destroy(dlg);
1463 break;
1464 }
1465}
1466
1467/************************************************************************/
1472{
1473 GtkTreeModel *model;
1475 GdkSurface *win;
1476 GdkSeat *seat;
1478
1480
1481 if (!gtk_tree_model_get_iter(model, &iter, path)) {
1482 return;
1483 }
1484
1487
1489 NULL, NULL, &mask);
1490
1491 if (!(mask & GDK_CONTROL_MASK)) {
1492 popup_iterate(model, path, &iter, NULL);
1493 } else {
1494 center_iterate(model, path, &iter, NULL);
1495 }
1496}
1497
1498/************************************************************************/
1502{
1503 GHashTable *selected;
1504 ITree iter;
1505 gint city_id;
1506
1507 if (NULL == city_dialog_shell) {
1508 return;
1509 }
1510
1511 /* Save the selection. */
1512 selected = g_hash_table_new(NULL, NULL);
1514 !itree_end(&iter); itree_next(&iter)) {
1516 itree_get(&iter, CRD_COL_CITY_ID, &city_id, -1);
1517 g_hash_table_insert(selected, GINT_TO_POINTER(city_id), NULL);
1518 }
1519 }
1520
1521 /* Update and restore the selection. */
1524 g_hash_table_destroy(selected);
1525
1527}
1528
1529/************************************************************************/
1533{
1535
1536 if (NULL == city_dialog_shell) {
1537 return;
1538 }
1539
1542 }
1544
1546}
1547
1548/************************************************************************/
1557static GMenu *create_change_menu(GActionGroup *group, const char *mname,
1558 const char *human_mname,
1560{
1561 GMenu *menu = g_menu_new();
1562 GMenu *submenu;
1563 int n;
1564 char buf[128];
1565
1567
1568 submenu = g_menu_new();
1570 TRUE, FALSE, oper,
1573 fc_snprintf(buf, sizeof(buf), human_mname, _("Unit"));
1575
1576 submenu = g_menu_new();
1578 FALSE, FALSE, oper,
1581 fc_snprintf(buf, sizeof(buf), human_mname, _("Improvement"));
1583
1584 submenu = g_menu_new();
1586 FALSE, TRUE, oper,
1589 fc_snprintf(buf, sizeof(buf), human_mname, _("Wonder"));
1591
1592 return menu;
1593}
1594
1595/************************************************************************/
1599{
1600 int n;
1601 GMenu *menu = g_menu_new();
1602
1604
1605 append_impr_or_unit_to_menu(menu, group, "sell", "",
1609 n);
1610
1612 submenu_insert_unref(cityrep_menu, 2, _("S_ell"), G_MENU_MODEL(menu));
1613}
1614
1615/************************************************************************/
1619{
1620 GSimpleAction *act;
1621
1623
1624 /* TRANS: Menu name part to be used like "Change to Improvement"
1625 * This is about changing current production. */
1626 change_menu = create_change_menu(group, "change", _("Change to %s"), CO_CHANGE);
1628
1630
1631 /* TRANS: Menu name to be used like "Set Improvement first"
1632 * This is about adding item to the beginning of the worklist. */
1633 add_first_menu = create_change_menu(group, "first", _("Set %s first"), CO_FIRST);
1634 submenu_append_unref(prod_menu, _("Add _First"),
1636
1638
1639 /* TRANS: Menu name to be used like "Set Improvement last"
1640 * This is about adding item to the end of the worklist. */
1641 add_last_menu = create_change_menu(group, "last", _("Set %s last"), CO_LAST);
1642 submenu_append_unref(prod_menu, _("Add _Last"),
1644
1646
1647 /* TRANS: Menu name to be used like "Set Improvement next"
1648 * This is about adding item after current one on the worklist. */
1649 add_next_menu = create_change_menu(group, "next", _("Set %s next"), CO_NEXT);
1650 submenu_append_unref(prod_menu, _("Add _Next"),
1652
1654
1655 /* TRANS: Menu name to be used like "Set Improvement 2nd last"
1656 * This is about adding item as second last on the worklist. */
1657 add_2ndlast_menu = create_change_menu(group, "2ndlast", _("Set %s 2nd last"), CO_NEXT_TO_LAST);
1658 submenu_append_unref(prod_menu, _("Add _2nd Last"),
1660
1662 submenu_append_unref(prod_menu, _("Set Worklist"),
1664
1666 submenu_append_unref(prod_menu, _("Append Worklist"),
1668
1669 act = g_simple_action_new("clear_worklist", NULL);
1672 NULL);
1674 "win.clear_worklist"));
1675
1676 return prod_menu;
1677}
1678
1679/************************************************************************/
1698
1699/************************************************************************/
1702static bool city_building_impr_or_unit(const struct city *pcity,
1703 const struct universal *target)
1704{
1705 return are_universals_equal(&pcity->production, target);
1706}
1707
1708/************************************************************************/
1712{
1713 GSimpleAction *act;
1714 char buf[128];
1715
1717
1718#if 0
1721#endif
1722
1723 act = g_simple_action_new("select_all", NULL);
1726 NULL);
1728 "win.select_all"));
1729
1730 act = g_simple_action_new("select_none", NULL);
1733 NULL);
1735 "win.select_none"));
1736
1737 act = g_simple_action_new("select_invert", NULL);
1740 NULL);
1742 "win.select_invert"));
1743
1744 act = g_simple_action_new("select_build_unit", NULL);
1749 "win.select_build_unit"));
1750
1751 act = g_simple_action_new("select_build_impr", NULL);
1755 menu_item_append_unref(select_menu, g_menu_item_new(_("Building Improvements"),
1756 "win.select_build_impr"));
1757
1758 act = g_simple_action_new("select_build_wonder", NULL);
1763 "win.select_build_wonder"));
1764
1766 append_impr_or_unit_to_menu(unit_b_select_menu, group, "sel", "_b_u",
1767 TRUE, FALSE, CO_NONE,
1770 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Unit"));
1772
1774 append_impr_or_unit_to_menu(impr_b_select_menu, group, "sel", "_b_b",
1778 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Improvement"));
1780
1782 append_impr_or_unit_to_menu(wndr_b_select_menu, group, "sel", "_b_w",
1783 FALSE, TRUE, CO_NONE,
1786 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Wonder"));
1788
1789 act = g_simple_action_new("select_coastal", NULL);
1792 NULL);
1794 "win.select_coastal"));
1795
1796 act = g_simple_action_new("select_island", NULL);
1799 NULL);
1801 "win.select_island"));
1802
1804 append_impr_or_unit_to_menu(unit_s_select_menu, group, "sel", "_s_u",
1805 TRUE, FALSE, CO_NONE,
1808 fc_snprintf(buf, sizeof(buf), _("Supported %s"), _("Unit"));
1810
1812 append_impr_or_unit_to_menu(unit_p_select_menu, group, "sel", "_p_u",
1813 TRUE, FALSE, CO_NONE,
1816 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Unit"));
1818
1820 append_impr_or_unit_to_menu(impr_p_select_menu, group, "sel", "_p_b",
1824 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Improvement"));
1826
1828 append_impr_or_unit_to_menu(wndr_p_select_menu, group, "sel", "_p_w",
1829 FALSE, TRUE, CO_NONE,
1832 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Wonder"));
1834
1836 append_impr_or_unit_to_menu(unit_a_select_menu, group, "sel", "_a_u",
1837 TRUE, FALSE, CO_NONE,
1840 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Unit"));
1842
1844 append_impr_or_unit_to_menu(impr_a_select_menu, group, "sel", "_a_b",
1848 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Improvement"));
1850
1852 append_impr_or_unit_to_menu(wndr_a_select_menu, group, "sel", "_a_w",
1853 FALSE, TRUE, CO_NONE,
1856 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Wonder"));
1858
1860 submenu_append_unref(select_menu, _("Citizen Governor"),
1862
1863 return select_menu;
1864}
1865
1866/************************************************************************/
1889
1890/************************************************************************/
1894static void update_total_buy_cost(void)
1895{
1896 GtkWidget *label, *view;
1897 GList *rows, *p;
1898 GtkTreeModel *model;
1900 GtkTreePath *path;
1902 struct city *pcity;
1903 int total = 0;
1904
1905 view = city_view;
1907
1908 if (!view || !label) {
1909 return;
1910 }
1911
1914
1915 for (p = rows; p != NULL; p = p->next) {
1916 path = p->data;
1917 if (gtk_tree_model_get_iter(model, &iter, path)) {
1918 if ((pcity = city_model_get(model, &iter))) {
1919 total += pcity->client.buy_cost;
1920 }
1921 }
1922 gtk_tree_path_free(path);
1923 }
1925
1926 if (total > 0) {
1927 gchar *buf = g_strdup_printf(_("Total Buy Cost: %d"), total);
1928
1930 g_free(buf);
1931 } else {
1933 }
1934}
1935
1936/************************************************************************/
1941{
1942#ifdef MENUS_GTK3
1943 int n;
1944 bool obs_may, plr_may;
1945
1947 obs_may = n > 0;
1949#endif /* MENUS_GTK3 */
1950
1952
1953#ifdef MENUS_GTK3
1957#endif /* MENUS_GTK3 */
1958
1962
1963#ifdef MENUS_GTK3
1964 if (!plr_may) {
1966 }
1967#endif /* MENUS_GTK3 */
1968
1970}
1971
1972/************************************************************************/
1976 GtkTreePath *path,
1978 gpointer data)
1979{
1980 struct city *pcity = city_model_get(model, iter);
1981
1982 if (NULL != pcity) {
1983 struct worklist empty;
1984
1987 }
1988}
1989
1990/************************************************************************/
2005
2006/************************************************************************/
2012{
2013 ITree it;
2014 GtkTreeModel *model;
2015
2016 if (!city_dialog_shell) {
2017 return;
2018 }
2019
2020 model = GTK_TREE_MODEL(city_model);
2021
2023
2024 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
2025 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
2026
2027 if (NULL != pcity && is_city_hilited(pcity)) {
2029 }
2030 }
2031}
2032
2033/************************************************************************/
2037{
2039
2040 if (NULL == city_dialog_shell) {
2041 return;
2042 }
2043
2045 if (on_off) {
2047 } else {
2049 }
2050 }
2051}
#define n
Definition astring.c:77
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
Definition city.c:1240
#define cities_iterate_end
Definition city.h:514
#define city_list_iterate(citylist, pcity)
Definition city.h:505
#define cities_iterate(pcity)
Definition city.h:509
#define city_owner(_pcity_)
Definition city.h:560
#define city_list_iterate_end
Definition city.h:507
void get_city_dialog_production_row(char *buf[], size_t column_size, struct universal *target, struct city *pcity)
int city_set_worklist(struct city *pcity, const struct worklist *pworklist)
bool city_queue_insert(struct city *pcity, int position, struct universal *item)
bool city_queue_insert_worklist(struct city *pcity, int position, const struct worklist *worklist)
bool city_set_queue(struct city *pcity, const struct worklist *pqueue)
int city_change_production(struct city *pcity, struct universal *target)
int city_sell_improvement(struct city *pcity, Impr_type_id sell_id)
void popup_city_dialog(struct city *pcity)
void refresh_city_dialog(struct city *pcity)
bool can_city_sell_universal(const struct city *pcity, const struct universal *target)
struct city_report_spec * city_report_specs
int cityrepfield_compare(const char *str1, const char *str2)
#define NUM_CREPORT_COLS
Definition cityrepdata.h:25
struct civclient client
bool can_client_issue_orders(void)
bool client_has_player(void)
#define client_player()
bool city_unit_supported(const struct city *pcity, const struct universal *target)
Definition climisc.c:545
void cityrep_buy(struct city *pcity)
Definition climisc.c:1155
void name_and_sort_items(struct universal *targets, int num_targets, struct item *items, bool show_cost, struct city *pcity)
Definition climisc.c:650
cid cid_encode(struct universal target)
Definition climisc.c:483
bool city_building_present(const struct city *pcity, const struct universal *target)
Definition climisc.c:583
struct universal cid_decode(cid id)
Definition climisc.c:526
bool can_city_build_now_client(const struct city *pcity, const struct universal *target)
Definition climisc.c:593
bool city_unit_present(const struct city *pcity, const struct universal *target)
Definition climisc.c:564
int collect_production_targets(struct universal *targets, struct city **selected_cities, int num_selected_cities, bool append_units, bool append_wonders, bool change_prod, TestCityFunc test_func)
Definition climisc.c:700
#define MAX_NUM_PRODUCTION_TARGETS
Definition climisc.h:89
bool(* TestCityFunc)(const struct city *, const struct universal *)
Definition climisc.h:87
bool cm_are_parameter_equal(const struct cm_parameter *const p1, const struct cm_parameter *const p2)
Definition cm.c:2141
bool cma_is_city_under_agent(const struct city *pcity, struct cm_parameter *parameter)
Definition cma_core.c:552
void cma_put_city_under_agent(struct city *pcity, const struct cm_parameter *const parameter)
Definition cma_core.c:524
void cma_release_city(struct city *pcity)
Definition cma_core.c:542
char * cmafec_preset_get_descr(int idx)
Definition cma_fec.c:169
const struct cm_parameter * cmafec_preset_get_parameter(int idx)
Definition cma_fec.c:182
int cmafec_preset_get_index_of_parameter(const struct cm_parameter *const parameter)
Definition cma_fec.c:196
int cmafec_preset_num(void)
Definition cma_fec.c:213
char * incite_cost
Definition comments.c:76
void connection_do_buffer(struct connection *pc)
Definition connection.c:324
void connection_do_unbuffer(struct connection *pc)
Definition connection.c:336
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:78
int int id
Definition editgui_g.h:28
#define Q_(String)
Definition fcintl.h:70
#define PL_(String1, String2, n)
Definition fcintl.h:71
#define _(String)
Definition fcintl.h:67
struct world wld
Definition game.c:62
struct city * game_city_by_number(int id)
Definition game.c:106
struct global_worklist * global_worklist_by_id(int id)
const char * global_worklist_name(const struct global_worklist *pgwl)
int global_worklist_id(const struct global_worklist *pgwl)
const struct worklist * global_worklist_get(const struct global_worklist *pgwl)
#define global_worklists_iterate(pgwl)
#define global_worklists_iterate_end
static void append_worklist_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:857
static void create_city_report_dialog(bool make_modal)
Definition cityrep.c:1142
static void city_invert_selection_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1263
static GtkWidget * city_popup_command
Definition cityrep.c:119
static void worklist_next_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:513
static GtkWidget * city_total_buy_cost_label
Definition cityrep.c:124
static GtkWidget * city_buy_command
Definition cityrep.c:120
static void update_total_buy_cost(void)
Definition cityrep.c:1963
void real_city_report_dialog_update(void *unused)
Definition cityrep.c:1458
#define CRD_COL_CITY_ID
Definition cityrep.c:107
void real_city_report_update_city(struct city *pcity)
Definition cityrep.c:1493
static void city_select_building_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1332
static void popup_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1385
static void create_select_menu(GtkWidget *item)
Definition cityrep.c:1774
static void city_activated_callback(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data)
Definition cityrep.c:1427
static void select_impr_or_unit_callback(GtkWidget *wdg, gpointer data)
Definition cityrep.c:567
static void impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:456
static void city_model_fill(GtkListStore *store, GtkTreeSelection *selection, GHashTable *select)
Definition cityrep.c:262
static void center_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1372
void toggle_city_hilite(struct city *pcity, bool on_off)
Definition cityrep.c:2093
static bool city_building_impr_or_unit(const struct city *pcity, const struct universal *target)
Definition cityrep.c:1893
#define CMA_NONE
Definition cityrep.c:64
static gint cityrep_sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer data)
Definition cityrep.c:1123
static struct city * city_model_get(GtkTreeModel *model, GtkTreeIter *iter)
Definition cityrep.c:226
static void city_select_coastal_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1280
static void popup_select_menu(GtkMenuShell *menu, gpointer data)
Definition cityrep.c:1902
static void city_command_callback(struct gui_dialog *dlg, int response, gpointer data)
Definition cityrep.c:1401
static void city_model_set(GtkListStore *store, GtkTreeIter *iter, struct city *pcity)
Definition cityrep.c:207
static void city_clear_worklist_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:2053
static GtkListStore * city_model
Definition cityrep.c:106
static void clear_worklist_foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:2035
static GtkWidget * city_sell_command
Definition cityrep.c:123
#define NEG_VAL(x)
Definition cityrep.c:61
static void city_select_all_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1247
#define CMA_CUSTOM
Definition cityrep.c:65
static void sell_impr_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:548
static GtkTreeSelection * city_selection
Definition cityrep.c:105
static void same_island_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1300
static void set_worklist_callback(GtkMenuItem *menuitem, gpointer data)
Definition cityrep.c:913
static void city_selection_changed_callback(GtkTreeSelection *selection)
Definition cityrep.c:2009
static gboolean city_model_find(GtkTreeModel *model, GtkTreeIter *iter, const struct city *pcity)
Definition cityrep.c:242
static void worklist_next_to_last_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:532
static GtkListStore * city_report_dialog_store_new(void)
Definition cityrep.c:188
static int city_dialog_shell_is_modal
Definition cityrep.c:162
static void city_report_update_views(void)
Definition cityrep.c:986
static void get_city_table_header(char **text, int n)
Definition cityrep.c:169
void hilite_cities_from_canvas(void)
Definition cityrep.c:2070
void city_report_dialog_popdown(void)
Definition cityrep.c:312
void city_report_dialog_popup(bool raise)
Definition cityrep.c:292
static GtkWidget * city_view
Definition cityrep.c:104
@ CITY_POPUP
Definition cityrep.c:101
@ CITY_CENTER
Definition cityrep.c:101
@ CITY_BUY
Definition cityrep.c:101
static struct gui_dialog * city_dialog_shell
Definition cityrep.c:98
static void worklist_first_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:493
static void set_worklist_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:896
static void toggle_view(GtkCheckMenuItem *item, gpointer data)
Definition cityrep.c:1010
static void append_worklist_callback(GtkMenuItem *menuitem, gpointer data)
Definition cityrep.c:875
static void city_unselect_all_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1255
static void worklist_last_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:472
static GtkWidget * city_center_command
Definition cityrep.c:118
static void buy_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1359
city_operation_type
Definition cityrep.c:73
@ CO_SELL
Definition cityrep.c:74
@ CO_NEXT_TO_LAST
Definition cityrep.c:74
@ CO_NEXT
Definition cityrep.c:74
@ CO_CHANGE
Definition cityrep.c:74
@ CO_FIRST
Definition cityrep.c:74
@ CO_LAST
Definition cityrep.c:74
@ CO_NONE
Definition cityrep.c:74
static void recreate_sell_menu(void)
Definition cityrep.c:1747
static void create_change_menu(GtkWidget *item)
Definition cityrep.c:1512
static struct tile * pos
Definition finddlg.c:53
GtkWidget * top_notebook
Definition gui_main.c:130
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 itree_get(ITree *it,...)
Definition gui_stuff.c:164
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_response_set_callback(struct gui_dialog *dlg, GUI_DIALOG_RESPONSE_FUN fun)
Definition gui_stuff.c:988
void itree_begin(GtkTreeModel *model, ITree *it)
Definition gui_stuff.c:127
void itree_unselect(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:206
void gui_dialog_show_all(struct gui_dialog *dlg)
Definition gui_stuff.c:795
void itree_select(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:198
void gui_dialog_set_title(struct gui_dialog *dlg, const char *title)
Definition gui_stuff.c:935
void gui_dialog_set_default_size(struct gui_dialog *dlg, int width, int height)
Definition gui_stuff.c:919
void itree_next(ITree *it)
Definition gui_stuff.c:144
gboolean itree_is_selected(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:190
GtkWidget * gui_dialog_add_button(struct gui_dialog *dlg, const char *icon_name, const char *text, int response)
Definition gui_stuff.c:706
gboolean itree_end(ITree *it)
Definition gui_stuff.c:136
#define TREE_ITER_PTR(x)
Definition gui_stuff.h:38
static GMenu * impr_b_select_menu
Definition cityrep.c:136
static GtkWidget * create_city_report_menu(void)
Definition cityrep.c:1112
static GMenu * wl_set_menu
Definition cityrep.c:131
static void recreate_production_menu(GActionGroup *group)
Definition cityrep.c:1682
static GMenu * unit_b_select_menu
Definition cityrep.c:135
static void city_select_island_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition cityrep.c:1362
static GMenu * display_menu
Definition cityrep.c:151
static GMenu * add_first_menu
Definition cityrep.c:127
static GMenu * add_2ndlast_menu
Definition cityrep.c:130
static GMenu * add_next_menu
Definition cityrep.c:129
static GMenu * impr_a_select_menu
Definition cityrep.c:143
static void select_governor_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition cityrep.c:700
static GMenu * unit_s_select_menu
Definition cityrep.c:138
static GMenu * impr_p_select_menu
Definition cityrep.c:140
static GActionGroup * cityrep_group
Definition cityrep.c:150
static GMenu * wl_append_menu
Definition cityrep.c:132
static void governors_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:680
static GMenu * create_governor_menu(GActionGroup *group, bool change_governor)
Definition cityrep.c:759
static GMenu * create_display_menu(GActionGroup *group)
Definition cityrep.c:1084
static void recreate_select_menu(GActionGroup *group)
Definition cityrep.c:1869
static GMenu * create_production_menu(GActionGroup *group)
Definition cityrep.c:1618
static GMenuItem * create_display_menu_item(int pos)
Definition cityrep.c:1052
static GMenu * select_menu
Definition cityrep.c:134
static GMenu * prod_menu
Definition cityrep.c:125
static GMenu * add_last_menu
Definition cityrep.c:128
static GMenu * cityrep_menu
Definition cityrep.c:149
static GMenu * create_wl_menu(GActionGroup *group, const char *act_pfx, GCallback cb)
Definition cityrep.c:985
static void append_impr_or_unit_to_menu(GMenu *menu, GActionGroup *act_group, const char *act_pfx, const char *act_pfx2, bool append_units, bool append_wonders, enum city_operation_type city_operation, TestCityFunc test_func, GCallback callback, int size)
Definition cityrep.c:307
static GMenu * unit_a_select_menu
Definition cityrep.c:142
static GMenu * unit_p_select_menu
Definition cityrep.c:139
static void update_governor_menu(void)
Definition cityrep.c:891
static GMenu * governor_select_menu
Definition cityrep.c:145
static GMenu * change_menu
Definition cityrep.c:126
static GMenu * wndr_b_select_menu
Definition cityrep.c:137
static GMenu * wndr_p_select_menu
Definition cityrep.c:141
static GMenu * wndr_a_select_menu
Definition cityrep.c:144
gint blocking_dialog(GtkWidget *dlg)
Definition gui_stuff.c:1136
GtkWidget * aux_menu_new(void)
Definition gui_stuff.c:244
void gui_dialog_add_content_widget(struct gui_dialog *dlg, GtkWidget *wdg)
Definition gui_stuff.c:1105
GtkWidget * gui_dialog_add_action_widget(struct gui_dialog *dlg, GtkWidget *widget)
Definition gui_stuff.c:690
#define submenu_append_unref(menu, name, submenu)
Definition gui_stuff.h:165
#define menu_item_insert_unref(menu, index, item)
Definition gui_stuff.h:142
#define submenu_insert_unref(menu, index, name, submenu)
Definition gui_stuff.h:156
#define menu_item_append_unref(menu, item)
Definition gui_stuff.h:149
int impr_sell_gold(const struct impr_type *pimprove)
Impr_type_id improvement_number(const struct impr_type *pimprove)
bool is_wonder(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
#define fc_assert_ret(condition)
Definition log.h:192
#define fc_assert_action(condition, action)
Definition log.h:188
bool is_city_hilited(struct city *pcity)
void center_tile_mapcanvas(const struct tile *ptile)
#define fc_realloc(ptr, sz)
Definition mem.h:36
struct client_options gui_options
Definition options.c:71
struct city_list * cities
Definition packhand.c:119
bool are_universals_equal(const struct universal *psource1, const struct universal *psource2)
#define ARRAY_SIZE(x)
Definition shared.h:85
size_t size
Definition specvec.h:72
struct sprite int int int int struct sprite * mask
Definition sprite_g.h:32
const char *(* func)(const struct city *pcity, const void *data)
Definition cityrepdata.h:34
const char * title2
Definition cityrepdata.h:31
const char * explanation
Definition cityrepdata.h:32
const char * title1
Definition cityrepdata.h:30
Definition city.h:317
struct connection conn
Definition client_main.h:96
bool center_when_popup_city
Definition options.h:162
struct player * playing
Definition connection.h:151
Definition climisc.h:82
struct universal item
Definition climisc.h:83
struct city_list * cities
Definition player.h:281
int gold
Definition cityrep.c:69
int count
Definition cityrep.c:68
const struct impr_type * target
Definition cityrep.c:70
int id
Definition unit.h:147
struct tile * tile
Definition unit.h:142
struct unit::@84::@86 client
enum universals_n kind
Definition fc_types.h:608
universals_u value
Definition fc_types.h:607
struct civ_map map
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:960
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
bool is_terrain_class_near_tile(const struct civ_map *nmap, const struct tile *ptile, enum terrain_class tclass)
Definition terrain.c:612
#define tile_continent(_tile)
Definition tile.h:93
const struct impr_type * building
Definition fc_types.h:546
void worklist_init(struct worklist *pwl)
Definition worklist.c:38
int worklist_length(const struct worklist *pwl)
Definition worklist.c:57