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-5.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
110#define CRD_COL_CITY_ID (0 + NUM_CREPORT_COLS)
111
112#ifdef MENUS_GTK3
113static void popup_select_menu(GtkMenuShell *menu, gpointer data);
114#endif /* MENUS_GTK3 */
115
116static void recreate_production_menu(GActionGroup *group);
117static void recreate_select_menu(GActionGroup *group);
118static void recreate_sell_menu(GActionGroup *group);
119
123#ifdef MENUS_GTK3
125#endif /* MENUS_GTK3 */
127
136
149
151
155
156#define FC_TYPE_CITY_ROW (fc_city_row_get_type())
157
159
167
172
174
175/**********************************************************************/
179{
181
182 free(row->columns);
183 row->columns = nullptr;
184
186}
187
188/**********************************************************************/
191static void
198
199/**********************************************************************/
202static void
204{
205 self->columns = fc_malloc(sizeof(char *) * NUM_CREPORT_COLS);
206}
207
208/**********************************************************************/
212{
213 FcCityRow *result;
214
215 result = g_object_new(FC_TYPE_CITY_ROW, nullptr);
216
217 return result;
218}
219
220/************************************************************************/
223static void get_city_table_header(char **text, int n)
224{
225 struct city_report_spec *spec;
226 int i;
227
228 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
229 fc_snprintf(text[i], n, "%*s\n%*s",
230 NEG_VAL(spec->width), spec->title1 ? spec->title1 : "",
231 NEG_VAL(spec->width), spec->title2 ? spec->title2 : "");
232 }
233}
234
235/****************************************************************************
236 CITY REPORT DIALOG
237****************************************************************************/
238
239/**********************************************************************/
253
254/**********************************************************************/
263
264/************************************************************************/
268{
270 gint i;
271
272 /* City report data. */
273 for (i = 0; i < NUM_CREPORT_COLS; i++) {
275 }
276
277 /* Specific gtk client data. */
278 model_types[i++] = G_TYPE_INT; /* CRD_COL_CITY_ID */
279
281}
282
283/************************************************************************/
287 struct city *pcity)
288{
289 struct city_report_spec *spec;
290 char buf[64];
291 gint i;
292
293 for (i = 0; i < NUM_CREPORT_COLS; i++) {
294 spec = city_report_specs + i;
295 fc_snprintf(buf, sizeof(buf), "%*s", NEG_VAL(spec->width),
296 spec->func(pcity, spec->data));
297 gtk_list_store_set(store, iter, i, buf, -1);
298 }
300}
301
302/************************************************************************/
305static void city_store_set(FcCityRow *row, struct city *pcity)
306{
307 struct city_report_spec *spec;
308 char buf[64];
309 gint i;
310
311 row->city_id = pcity->id;
312
313 for (i = 0; i < NUM_CREPORT_COLS; i++) {
314 spec = city_report_specs + i;
315 fc_snprintf(buf, sizeof(buf), "%*s", NEG_VAL(spec->width),
316 spec->func(pcity, spec->data));
317 row->columns[i] = fc_strdup(buf);
318 }
319}
320
321/************************************************************************/
325{
326 struct city *pcity;
327 int id;
328
329 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
331 return ((NULL != pcity
334 ? NULL : pcity);
335}
336
337/************************************************************************/
341 const struct city *pcity)
342{
343 const int searched = pcity->id;
344 int id;
345
347 do {
348 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
349 if (searched == id) {
350 return TRUE;
351 }
352 } while (gtk_tree_model_iter_next(model, iter));
353 }
354 return FALSE;
355}
356
357/************************************************************************/
361 GtkTreeSelection *selection, GHashTable *select)
362{
364
365 if (client_has_player()) {
369 if (NULL != select
372 }
374 } else {
375 /* Global observer case. */
379 if (NULL != select
382 }
384 }
385}
386
387/************************************************************************/
390static void city_store_fill(GListStore *store,
391 GtkMultiSelection *selection, GHashTable *select)
392{
393 if (client_has_player()) {
396
400 if (NULL != select
404 FALSE);
405 }
407 } else {
408 /* Global observer case. */
411
415 if (NULL != select
419 FALSE);
420 }
422 }
423}
424
425/************************************************************************/
442
443/************************************************************************/
452
453/************************************************************************/
458 const char *act_pfx,
459 const char *act_pfx2,
460 bool append_units,
461 bool append_wonders,
466 int size)
467{
469 struct item items[MAX_NUM_PRODUCTION_TARGETS];
470 int i, item, targets_used;
471 char *row[4];
472 char buf[4][64];
473
474 GtkSizeGroup *size_group[3];
475
476#ifdef MENUS_GTK3
477 const char *markup[3] = {
478 "weight=\"bold\"",
479 "",
480 ""
481 };
482#endif
483
484 if (city_operation != CO_NONE) {
485 GPtrArray *selected;
486 ITree it;
487 int num_selected = 0;
489 struct city **data;
490
491 selected = g_ptr_array_sized_new(size);
492
493 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
494 struct city *pcity;
495
497 || !(pcity = city_model_get(model, TREE_ITER_PTR(it)))) {
498 continue;
499 }
500
501 g_ptr_array_add(selected, pcity);
502 num_selected++;
503 }
504
505 data = (struct city **)g_ptr_array_free(selected, FALSE);
509 g_free(data);
510 } else {
513 test_func);
514 }
515
516 name_and_sort_items(targets, targets_used, items,
518
519 for (i = 0; i < 4; i++) {
520 row[i] = buf[i];
521 }
522
523
524 for (i = 0; i < 3; i++) {
526 }
527
528 for (item = 0; item < targets_used; item++) {
529 struct universal target = items[item].item;
531 char actbuf[256];
532 GSimpleAction *act;
533#ifdef MENUS_GTK3
534 char txt[256];
535 GtkWidget *hgrid, *label;
536 int grid_col = 0;
537#endif /* MENUS_GTK3 */
538
539 get_city_dialog_production_row(row, sizeof(buf[0]), &target, NULL);
540
541 fc_snprintf(actbuf, sizeof(actbuf), "win.%s%s%d", act_pfx, act_pfx2, item);
542
544
545 fc_snprintf(actbuf, sizeof(actbuf), "%s%s%d", act_pfx, act_pfx2, item);
547 g_object_set_data(G_OBJECT(act), "freeciv_test_func", test_func);
548 g_object_set_data(G_OBJECT(act), "freeciv_city_operation",
551 g_signal_connect(act, "activate", callback,
552 GINT_TO_POINTER(cid_encode(target)));
554
555#ifdef MENUS_GTK3
559
560 for (i = 0; i < 3; i++) {
561 if (row[i][0] == '\0') {
562 continue;
563 }
564
565 if (city_operation == CO_SELL && i != 0) {
566 continue;
567 }
568
569 fc_snprintf(txt, ARRAY_SIZE(txt), "<span %s>%s</span>",
570 markup[i], row[i]);
571
572 label = gtk_label_new(NULL);
574
575 switch (i) {
576 case 0:
579 break;
580 case 2:
583 break;
584 default:
585 break;
586 }
587
588 gtk_grid_attach(GTK_GRID(hgrid), label, grid_col++, 0, 1, 1);
589 gtk_size_group_add_widget(size_group[i], label);
590 }
591
594 GINT_TO_POINTER(cid_encode(target)));
595#endif /* MENUS_GTK3 */
596 }
597
598 for (i = 0; i < 3; i++) {
599 g_object_unref(size_group[i]);
600 }
601
602#ifdef MENUS_GTK3
604#endif
605}
606
607/************************************************************************/
612{
613 struct universal target = cid_decode(GPOINTER_TO_INT(data));
614 struct city *pcity = city_model_get(model, iter);
615
616 if (NULL != pcity) {
618 }
619}
620
621/************************************************************************/
627 GtkTreePath *path,
629 gpointer data)
630{
631 struct universal target = cid_decode(GPOINTER_TO_INT(data));
632 struct city *pcity = city_model_get(model, iter);
633
634 if (NULL != pcity) {
635 (void) city_queue_insert(pcity, -1, &target);
636 }
637 /* Perhaps should warn the user if not successful? */
638}
639
640/************************************************************************/
648 GtkTreePath *path,
650 gpointer data)
651{
652 struct universal target = cid_decode(GPOINTER_TO_INT(data));
653 struct city *pcity = city_model_get(model, iter);
654
655 if (NULL != pcity) {
656 (void) city_queue_insert(pcity, 0, &target);
657 }
658 /* Perhaps should warn the user if not successful? */
659}
660
661/************************************************************************/
668 GtkTreePath *path,
670 gpointer data)
671{
672 struct universal target = cid_decode(GPOINTER_TO_INT(data));
673 struct city *pcity = city_model_get(model, iter);
674
675 if (NULL != pcity) {
676 (void) city_queue_insert(pcity, 1, &target);
677 }
678 /* Perhaps should warn the user if not successful? */
679}
680
681/************************************************************************/
687 GtkTreePath *path,
689 gpointer data)
690{
691 struct universal target = cid_decode(GPOINTER_TO_INT(data));
692 struct city *pcity = city_model_get(model, iter);
693
694 if (NULL != pcity) {
695 city_queue_insert(pcity, worklist_length(&pcity->worklist), &target);
696 }
697}
698
699/************************************************************************/
704{
705 struct sell_data *sd = (struct sell_data *) data;
706 struct city *pcity = city_model_get(model, iter);
707
708 if (NULL != pcity
709 && !pcity->did_sell
710 && city_has_building(pcity, sd->target)) {
711 sd->count++;
712 sd->gold += impr_sell_gold(sd->target);
714 }
715}
716
717struct scbs_data {
718 const struct impr_type *building;
719 const char *imprname;
720};
721
722/************************************************************************/
725static void sell_callback_response(GObject *dialog, GAsyncResult *result,
726 gpointer data)
727{
729 result, NULL);
730
731 if (button == 0) {
732 struct scbs_data *scbs = (struct scbs_data *)data;
733 struct sell_data sd = { 0, 0, scbs->building };
734 GtkWidget *w;
735
738 if (sd.count > 0) {
739 /* FIXME: plurality of sd.count is ignored! */
740 /* TRANS: "Sold 3 Harbor for 90 gold." (Pluralisation is in gold --
741 * second %d -- not in buildings.) */
744 PL_("Sold %d %s for %d gold.",
745 "Sold %d %s for %d gold.",
746 sd.gold),
747 sd.count, scbs->imprname, sd.gold);
748 } else {
751 _("No %s could be sold."),
752 scbs->imprname);
753 }
754
755 g_signal_connect(w, "response",
757 gtk_window_present(GTK_WINDOW(w)); /* Asynchron. */
758 }
759
760 free(data);
761}
762
763/************************************************************************/
768 GVariant *parameter,
769 gpointer data)
770{
771 struct universal target = cid_decode(GPOINTER_TO_INT(data));
772 TestCityFunc test_func = g_object_get_data(G_OBJECT(action), "freeciv_test_func");
774 GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "freeciv_city_operation"));
775
776 /* If this is not a city operation: */
777 if (city_operation == CO_NONE) {
779 ITree it;
780
782 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
783 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
784
785 if (NULL != pcity && test_func(pcity, &target)) {
787 }
788 }
789 } else {
791
793 switch (city_operation) {
794 case CO_LAST:
797 GINT_TO_POINTER(cid_encode(target)));
798 break;
799 case CO_CHANGE:
802 GINT_TO_POINTER(cid_encode(target)));
803 break;
804 case CO_FIRST:
807 GINT_TO_POINTER(cid_encode(target)));
808 break;
809 case CO_NEXT:
812 GINT_TO_POINTER(cid_encode(target)));
813 break;
814 case CO_NEXT_TO_LAST:
817 GINT_TO_POINTER(cid_encode(target)));
818 break;
819 case CO_SELL:
820 fc_assert_action(target.kind == VUT_IMPROVEMENT, break);
821 {
822 struct scbs_data *scbs = fc_malloc(sizeof(struct scbs_data));
824 gchar *buf;
825 const char *buttons[] = { _("Yes"), _("No"), NULL };
826
827 scbs->building = target.value.building;
828 scbs->imprname = improvement_name_translation(scbs->building);
829
830 /* Ask confirmation */
831 buf = g_strdup_printf(_("Are you sure you want to sell those %s?"), scbs->imprname);
832 w = gtk_alert_dialog_new("%s", buf);
833 g_free(buf);
838 }
839 break;
840 case CO_NONE:
841 break;
842 }
844 }
845}
846
847/************************************************************************/
852{
853 struct city *pcity = city_model_get(model, iter);
854 int idx = GPOINTER_TO_INT(data);
855
856 if (NULL != pcity) {
857 if (CMA_NONE == idx) {
859 } else {
861 }
863 }
864}
865
866/************************************************************************/
871 GVariant *parameter,
872 gpointer data)
873{
874 int idx = GPOINTER_TO_INT(data);
875 bool change_governor =
877 struct cm_parameter cm;
878
879 /* If this is not the change button but the select cities button. */
880 if (!change_governor) {
881 ITree it;
883
885 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
886 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
887 int controlled;
888 bool select;
889
890 if (NULL == pcity) {
891 continue;
892 }
894 select = FALSE;
895
896 if (idx == CMA_NONE) {
897 /* CMA_NONE selects not-controlled, all others require controlled */
898 if (!controlled) {
899 select = TRUE;
900 }
901 } else if (controlled) {
902 if (idx == CMA_CUSTOM) {
904 select = TRUE;
905 }
906 } else if (cm_are_parameter_equal(&cm,
908 select = TRUE;
909 }
910 }
911
912 if (select) {
914 }
915 }
916 } else {
919 GINT_TO_POINTER(idx));
920 }
921}
922
923/************************************************************************/
930 bool change_governor)
931{
932 GMenu *menu;
933 int i;
934 struct cm_parameter cm;
935
936 menu = g_menu_new();
937
939 return menu;
940 }
941
942 if (change_governor) {
943 GSimpleAction *act;
944
945 act = g_simple_action_new("chg_governor_none", NULL);
946 g_object_set_data(G_OBJECT(act), "governor",
952 g_menu_item_new(Q_("?cma:none"),
953 "win.chg_governor_none"));
954
955 for (i = 0; i < cmafec_preset_num(); i++) {
956 char buf[128];
957
958 fc_snprintf(buf, sizeof(buf), "chg_governor_%d", i);
960 g_object_set_data(G_OBJECT(act), "governor",
965 fc_snprintf(buf, sizeof(buf), "win.chg_governor_%d", i);
968 }
969 } else {
970 /* Search for a "none" */
971 bool found;
972
973 found = FALSE;
976 found = TRUE;
977 break;
978 }
980
981 if (found) {
982 GSimpleAction *act;
983
984 act = g_simple_action_new("sel_governor_none", NULL);
985 g_object_set_data(G_OBJECT(act), "governor",
991 g_menu_item_new(Q_("?cma:none"),
992 "win.sel_governor_none"));
993 }
994
995 /*
996 * Search for a city that's under custom (not preset) agent. Might
997 * take a lonnggg time.
998 */
999 found = FALSE;
1003 found = TRUE;
1004 break;
1005 }
1007
1008 if (found) {
1009 /* We found city that's under agent but not a preset */
1010 GSimpleAction *act;
1011
1012 act = g_simple_action_new("sel_governor_custom", NULL);
1013 g_object_set_data(G_OBJECT(act), "governor",
1019 g_menu_item_new(Q_("?cma:custom"),
1020 "win.sel_governor_custom"));
1021 }
1022
1023 /* Only fill in presets that are being used. */
1024 for (i = 0; i < cmafec_preset_num(); i++) {
1025 found = FALSE;
1030 found = TRUE;
1031 break;
1032 }
1034
1035 if (found) {
1036 GSimpleAction *act;
1037 char buf[128];
1038
1039 fc_snprintf(buf, sizeof(buf), "sel_governor_%d", i);
1040
1042 g_object_set_data(G_OBJECT(act), "governor",
1047 fc_snprintf(buf, sizeof(buf), "win.sel_governor_%d", i);
1050 buf));
1051 }
1052 }
1053 }
1054
1055 return menu;
1056}
1057
1058/************************************************************************/
1067
1068/************************************************************************/
1074 GtkTreeIter *iter, gpointer data)
1075{
1076 const struct worklist *pwl = data;
1077 struct city *pcity = city_model_get(model, iter);
1078
1080
1081 if (NULL != pcity) {
1083 }
1084}
1085
1086/************************************************************************/
1092 GVariant *parameter,
1093 gpointer data)
1094{
1095 struct global_worklist *pgwl =
1097
1099
1100 if (!pgwl) {
1101 /* Maybe removed by an other way, not an error. */
1102 return;
1103 }
1104
1108}
1109
1110/************************************************************************/
1115 GtkTreeIter *iter, gpointer data)
1116{
1117 const struct worklist *pwl = data;
1118 struct city *pcity = city_model_get(model, iter);
1119
1121
1122 if (NULL != pcity) {
1124 }
1125}
1126
1127/************************************************************************/
1132 GVariant *parameter,
1133 gpointer data)
1134{
1135 struct global_worklist *pgwl =
1137
1141
1142 if (!pgwl) {
1143 /* Maybe removed by an other way, not an error. */
1144 return;
1145 }
1146
1150}
1151
1152/************************************************************************/
1155static GMenu *create_wl_menu(GActionGroup *group, const char *act_pfx,
1156 GCallback cb)
1157{
1158 GMenu *menu;
1159 GSimpleAction *act;
1160 int count = 0;
1161
1162 menu = g_menu_new();
1163
1164 if (!can_client_issue_orders()) {
1165 return NULL;
1166 }
1167
1169 char buf[128];
1170
1171 fc_snprintf(buf, sizeof(buf), "wl%s%d", act_pfx, count);
1174 g_signal_connect(act, "activate", cb,
1176 fc_snprintf(buf, sizeof(buf), "win.wl%s%d", act_pfx, count);
1179 buf));
1180 count++;
1182
1183 if (count == 0) {
1184 char buf[64];
1185
1186 fc_snprintf(buf, sizeof(buf), "win.wl%s_dummy", act_pfx);
1188 g_menu_item_new(_("(no worklists defined)"), buf));
1189 }
1190
1191 return menu;
1192}
1193
1194/************************************************************************/
1198{
1199 struct city_report_spec *spec;
1202 GList *columns, *p;
1203
1206
1208
1209 for (p = columns; p != NULL; p = p->next) {
1210 col = p->data;
1211 spec = g_object_get_data(G_OBJECT(col), "city_report_spec");
1213 }
1214
1215 g_list_free(columns);
1216}
1217
1218/************************************************************************/
1223{
1224 GMenuItem *item;
1225 char act_name[50];
1226 struct city_report_spec *spec = city_report_specs + pos;
1227
1228 fc_snprintf(act_name, sizeof(act_name), "win.display%d(%s)",
1229 pos, spec->show ? "true" : "false");
1232
1233 return item;
1234}
1235
1236/************************************************************************/
1240{
1241 struct city_report_spec *spec = data;
1242 int idx = spec - city_report_specs;
1243
1244 spec->show ^= 1;
1246
1249}
1250
1251/************************************************************************/
1255{
1256 struct city_report_spec *spec;
1257 int i;
1259
1261 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
1262 GSimpleAction *act;
1263 char act_name[50];
1264 GVariant *var = g_variant_new("b", TRUE);
1265
1266 fc_snprintf(act_name, sizeof(act_name), "display%d", i);
1269 g_signal_connect(act, "change-state", G_CALLBACK(toggle_view), (gpointer)spec);
1270
1272 }
1273
1275
1276 return display_menu;
1277}
1278
1279/************************************************************************/
1317
1318/************************************************************************/
1323{
1325 gchar *str1, *str2;
1326 int i;
1327
1328 gtk_tree_model_get(model, a, col, &str1, -1);
1329 gtk_tree_model_get(model, b, col, &str2, -1);
1330
1332 g_free(str1);
1333 g_free(str2);
1334 return i;
1335}
1336
1337/************************************************************************/
1341{
1342 static char **titles;
1343 static char (*buf)[128];
1344 struct city_report_spec *spec;
1345
1346 GtkWidget *w, *sw, *aux_menu;
1347 int i;
1348
1351
1353
1356
1357 /* Menu */
1360
1361 /* Buttons */
1368
1370 _("_Buy"), CITY_BUY);
1371 city_buy_command = w;
1372
1374 _("_Inspect"), CITY_POPUP);
1376
1378 _("Cen_ter"), CITY_CENTER);
1380
1382
1387
1388 /* Tree view */
1389 buf = fc_realloc(buf, NUM_CREPORT_COLS * sizeof(buf[0]));
1391 for (i = 0; i < NUM_CREPORT_COLS; i++) {
1392 titles[i] = buf[i];
1393 }
1394 get_city_table_header(titles, sizeof(buf[0]));
1395
1396 for (i = 0; i < NUM_CREPORT_COLS; i++) {
1399
1405
1408 }
1409
1414 gtk_widget_set_name(city_view_depr, "small_font");
1415 g_signal_connect(city_view_depr, "row_activated",
1421
1422 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
1423 GtkWidget *header;
1424 GtkCellRenderer *renderer;
1426
1427 renderer = gtk_cell_renderer_text_new();
1429 "text", i, NULL);
1430 header = gtk_label_new(titles[i]);
1437 g_object_set_data(G_OBJECT(col), "city_report_spec", spec);
1441 NULL);
1442 }
1443
1449
1451
1453 city_store_fill(city_store, nullptr, nullptr);
1455
1456 /* Real menus */
1460
1462}
1463
1464/************************************************************************/
1473
1474/************************************************************************/
1483
1484/************************************************************************/
1488 GVariant *parameter,
1489 gpointer data)
1490{
1491 ITree it;
1493
1494 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1497 } else {
1499 }
1500 }
1501}
1502
1503/************************************************************************/
1507 GVariant *parameter,
1508 gpointer data)
1509{
1510 ITree it;
1512
1514
1515 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1516 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1517
1518 if (pcity != NULL
1521 }
1522 }
1523}
1524
1525/************************************************************************/
1529 GtkTreeIter *iter, gpointer data)
1530{
1531 struct city *selected_pcity = city_model_get(model, iter);
1532 ITree it;
1533
1534 if (NULL == selected_pcity) {
1535 return;
1536 }
1537
1538 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1539 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1540
1541 if (NULL != pcity
1543 == tile_continent(selected_pcity->tile))) {
1545 }
1546 }
1547}
1548
1549/************************************************************************/
1559
1560/************************************************************************/
1564 GVariant *parameter,
1565 gpointer data)
1566{
1568 ITree it;
1570
1572
1573 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1574 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1575
1576 if (NULL != pcity
1577 && ((which == PCT_UNIT && VUT_UTYPE == pcity->production.kind)
1578 || (which == PCT_IMPROVEMENT
1579 && VUT_IMPROVEMENT == pcity->production.kind
1580 && !is_wonder(pcity->production.value.building))
1581 || (which == PCT_WONDER
1582 && VUT_IMPROVEMENT == pcity->production.kind
1583 && is_wonder(pcity->production.value.building)))) {
1585 }
1586 }
1587}
1588
1589/************************************************************************/
1592static void buy_iterate(GtkTreeModel *model, GtkTreePath *path,
1593 GtkTreeIter *iter, gpointer data)
1594{
1595 struct city *pcity = city_model_get(model, iter);
1596
1597 if (NULL != pcity) {
1599 }
1600}
1601
1602/************************************************************************/
1605static void center_iterate(GtkTreeModel *model, GtkTreePath *path,
1606 GtkTreeIter *iter, gpointer data)
1607{
1608 struct city *pcity = city_model_get(model, iter);
1609
1610 if (NULL != pcity) {
1612 }
1613}
1614
1615/************************************************************************/
1618static void popup_iterate(GtkTreeModel *model, GtkTreePath *path,
1619 GtkTreeIter *iter, gpointer data)
1620{
1621 struct city *pcity = city_model_get(model, iter);
1622
1623 if (NULL != pcity) {
1626 }
1628 }
1629}
1630
1631/************************************************************************/
1634static void city_command_callback(struct gui_dialog *dlg, int response,
1635 gpointer data)
1636{
1637 switch (response) {
1638 case CITY_CENTER:
1640 /* Center to city doesn't make sense if many city are selected. */
1642 NULL);
1643 }
1644 break;
1645 case CITY_POPUP:
1647 break;
1648 case CITY_BUY:
1650 break;
1651 default:
1652 gui_dialog_destroy(dlg);
1653 break;
1654 }
1655}
1656
1657/************************************************************************/
1662{
1663 GtkTreeModel *model;
1665 GdkSurface *win;
1666 GdkSeat *seat;
1668
1670
1671 if (!gtk_tree_model_get_iter(model, &iter, path)) {
1672 return;
1673 }
1674
1677
1679 NULL, NULL, &mask);
1680
1681 if (!(mask & GDK_CONTROL_MASK)) {
1682 popup_iterate(model, path, &iter, NULL);
1683 } else {
1684 center_iterate(model, path, &iter, NULL);
1685 }
1686}
1687
1688/************************************************************************/
1692{
1693 GHashTable *selected;
1694 ITree iter;
1695 gint city_id;
1696
1697 if (NULL == city_dialog_shell) {
1698 return;
1699 }
1700
1701 /* Save the selection. */
1702 selected = g_hash_table_new(NULL, NULL);
1704 !itree_end(&iter); itree_next(&iter)) {
1706 itree_get(&iter, CRD_COL_CITY_ID, &city_id, -1);
1707 g_hash_table_insert(selected, GINT_TO_POINTER(city_id), NULL);
1708 }
1709 }
1710
1711 /* Update and restore the selection. */
1714
1717 g_hash_table_destroy(selected);
1718
1720}
1721
1722/************************************************************************/
1740
1741/************************************************************************/
1750static GMenu *create_change_menu(GActionGroup *group, const char *mname,
1751 const char *human_mname,
1753{
1754 GMenu *menu = g_menu_new();
1755 GMenu *submenu;
1756 int n;
1757 char buf[128];
1758
1760
1761 submenu = g_menu_new();
1763 TRUE, FALSE, oper,
1766 fc_snprintf(buf, sizeof(buf), human_mname, _("Unit"));
1768
1769 submenu = g_menu_new();
1771 FALSE, FALSE, oper,
1774 fc_snprintf(buf, sizeof(buf), human_mname, _("Improvement"));
1776
1777 submenu = g_menu_new();
1779 FALSE, TRUE, oper,
1782 fc_snprintf(buf, sizeof(buf), human_mname, _("Wonder"));
1784
1785 return menu;
1786}
1787
1788/************************************************************************/
1792{
1793 int n;
1794 GMenu *menu = g_menu_new();
1795
1797
1798 append_impr_or_unit_to_menu(menu, group, "sell", "",
1802 n);
1803
1805 submenu_insert_unref(cityrep_menu, 2, _("S_ell"), G_MENU_MODEL(menu));
1806}
1807
1808/************************************************************************/
1812{
1813 GSimpleAction *act;
1814
1816
1817 /* TRANS: Menu name part to be used like "Change to Improvement"
1818 * This is about changing current production. */
1819 change_menu = create_change_menu(group, "change", _("Change to %s"), CO_CHANGE);
1821
1823
1824 /* TRANS: Menu name to be used like "Set Improvement first"
1825 * This is about adding item to the beginning of the worklist. */
1826 add_first_menu = create_change_menu(group, "first", _("Set %s first"), CO_FIRST);
1827 submenu_append_unref(prod_menu, _("Add _First"),
1829
1831
1832 /* TRANS: Menu name to be used like "Set Improvement last"
1833 * This is about adding item to the end of the worklist. */
1834 add_last_menu = create_change_menu(group, "last", _("Set %s last"), CO_LAST);
1835 submenu_append_unref(prod_menu, _("Add _Last"),
1837
1839
1840 /* TRANS: Menu name to be used like "Set Improvement next"
1841 * This is about adding item after current one on the worklist. */
1842 add_next_menu = create_change_menu(group, "next", _("Set %s next"), CO_NEXT);
1843 submenu_append_unref(prod_menu, _("Add _Next"),
1845
1847
1848 /* TRANS: Menu name to be used like "Set Improvement 2nd last"
1849 * This is about adding item as second last on the worklist. */
1850 add_2ndlast_menu = create_change_menu(group, "2ndlast", _("Set %s 2nd last"), CO_NEXT_TO_LAST);
1851 submenu_append_unref(prod_menu, _("Add _2nd Last"),
1853
1855 submenu_append_unref(prod_menu, _("Set Worklist"),
1857
1859 submenu_append_unref(prod_menu, _("Append Worklist"),
1861
1862 act = g_simple_action_new("clear_worklist", NULL);
1865 NULL);
1867 "win.clear_worklist"));
1868
1869 return prod_menu;
1870}
1871
1872/************************************************************************/
1891
1892/************************************************************************/
1895static bool city_building_impr_or_unit(const struct city *pcity,
1896 const struct universal *target)
1897{
1898 return are_universals_equal(&pcity->production, target);
1899}
1900
1901/************************************************************************/
1905{
1906 GSimpleAction *act;
1907 char buf[128];
1908
1910
1911#if 0
1914#endif
1915
1916 act = g_simple_action_new("select_all", NULL);
1919 NULL);
1921 "win.select_all"));
1922
1923 act = g_simple_action_new("select_none", NULL);
1926 NULL);
1928 "win.select_none"));
1929
1930 act = g_simple_action_new("select_invert", NULL);
1933 NULL);
1935 "win.select_invert"));
1936
1937 act = g_simple_action_new("select_build_unit", NULL);
1942 "win.select_build_unit"));
1943
1944 act = g_simple_action_new("select_build_impr", NULL);
1948 menu_item_append_unref(select_menu, g_menu_item_new(_("Building Improvements"),
1949 "win.select_build_impr"));
1950
1951 act = g_simple_action_new("select_build_wonder", NULL);
1956 "win.select_build_wonder"));
1957
1959 append_impr_or_unit_to_menu(unit_b_select_menu, group, "sel", "_b_u",
1960 TRUE, FALSE, CO_NONE,
1963 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Unit"));
1965
1967 append_impr_or_unit_to_menu(impr_b_select_menu, group, "sel", "_b_b",
1971 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Improvement"));
1973
1975 append_impr_or_unit_to_menu(wndr_b_select_menu, group, "sel", "_b_w",
1976 FALSE, TRUE, CO_NONE,
1979 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Wonder"));
1981
1982 act = g_simple_action_new("select_coastal", NULL);
1985 NULL);
1987 "win.select_coastal"));
1988
1989 act = g_simple_action_new("select_island", NULL);
1992 NULL);
1994 "win.select_island"));
1995
1997 append_impr_or_unit_to_menu(unit_s_select_menu, group, "sel", "_s_u",
1998 TRUE, FALSE, CO_NONE,
2001 fc_snprintf(buf, sizeof(buf), _("Supported %s"), _("Unit"));
2003
2005 append_impr_or_unit_to_menu(unit_p_select_menu, group, "sel", "_p_u",
2006 TRUE, FALSE, CO_NONE,
2009 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Unit"));
2011
2013 append_impr_or_unit_to_menu(impr_p_select_menu, group, "sel", "_p_b",
2017 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Improvement"));
2019
2021 append_impr_or_unit_to_menu(wndr_p_select_menu, group, "sel", "_p_w",
2022 FALSE, TRUE, CO_NONE,
2025 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Wonder"));
2027
2029 append_impr_or_unit_to_menu(unit_a_select_menu, group, "sel", "_a_u",
2030 TRUE, FALSE, CO_NONE,
2033 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Unit"));
2035
2037 append_impr_or_unit_to_menu(impr_a_select_menu, group, "sel", "_a_b",
2041 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Improvement"));
2043
2045 append_impr_or_unit_to_menu(wndr_a_select_menu, group, "sel", "_a_w",
2046 FALSE, TRUE, CO_NONE,
2049 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Wonder"));
2051
2053 submenu_append_unref(select_menu, _("Citizen Governor"),
2055
2056 return select_menu;
2057}
2058
2059/************************************************************************/
2082
2083/************************************************************************/
2087static void update_total_buy_cost(void)
2088{
2089 GtkWidget *label, *view;
2090 GList *rows, *p;
2091 GtkTreeModel *model;
2093 GtkTreePath *path;
2095 struct city *pcity;
2096 int total = 0;
2097
2100
2101 if (!view || !label) {
2102 return;
2103 }
2104
2107
2108 for (p = rows; p != NULL; p = p->next) {
2109 path = p->data;
2110 if (gtk_tree_model_get_iter(model, &iter, path)) {
2111 if ((pcity = city_model_get(model, &iter))) {
2112 total += pcity->client.buy_cost;
2113 }
2114 }
2115 gtk_tree_path_free(path);
2116 }
2118
2119 if (total > 0) {
2120 gchar *buf = g_strdup_printf(_("Total Buy Cost: %d"), total);
2121
2123 g_free(buf);
2124 } else {
2126 }
2127}
2128
2129/************************************************************************/
2134{
2135#ifdef MENUS_GTK3
2136 int n;
2137 bool obs_may, plr_may;
2138
2140 obs_may = n > 0;
2142#endif /* MENUS_GTK3 */
2143
2145
2146#ifdef MENUS_GTK3
2150#endif /* MENUS_GTK3 */
2151
2155
2156#ifdef MENUS_GTK3
2157 if (!plr_may) {
2159 }
2160#endif /* MENUS_GTK3 */
2161
2163}
2164
2165/************************************************************************/
2169 GtkTreePath *path,
2171 gpointer data)
2172{
2173 struct city *pcity = city_model_get(model, iter);
2174
2175 if (NULL != pcity) {
2176 struct worklist empty;
2177
2180 }
2181}
2182
2183/************************************************************************/
2198
2199/************************************************************************/
2205{
2206 ITree it;
2207 GtkTreeModel *model;
2208
2209 if (!city_dialog_shell) {
2210 return;
2211 }
2212
2214
2216
2217 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
2218 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
2219
2220 if (NULL != pcity && is_city_hilited(pcity)) {
2222 }
2223 }
2224}
2225
2226/************************************************************************/
2230{
2232
2233 if (NULL == city_dialog_shell) {
2234 return;
2235 }
2236
2238 if (on_off) {
2240 } else {
2242 }
2243 }
2244}
#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
static struct ai_type * self
Definition classicai.c:46
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 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_clear_worklist_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:2053
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 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
GtkWidget * toplevel
Definition gui_main.c:126
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
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
static void sell_callback_response(GObject *dialog, GAsyncResult *result, gpointer data)
Definition cityrep.c:725
static void fc_city_row_finalize(GObject *gobject)
Definition cityrep.c:178
static void city_factory_bind(GtkSignalListItemFactory *self, GtkListItem *list_item, gpointer user_data)
Definition cityrep.c:242
#define FC_TYPE_CITY_ROW
Definition cityrep.c:156
static GtkTreeSelection * city_selection_depr
Definition cityrep.c:105
static void fc_city_row_init(FcCityRow *self)
Definition cityrep.c:203
static void city_model_fill_depr(GtkListStore *store, GtkTreeSelection *selection, GHashTable *select)
Definition cityrep.c:360
static void city_model_set_depr(GtkListStore *store, GtkTreeIter *iter, struct city *pcity)
Definition cityrep.c:286
static void fc_city_row_class_init(FcCityRowClass *klass)
Definition cityrep.c:192
static GtkListStore * city_model_depr
Definition cityrep.c:106
static void city_store_set(FcCityRow *row, struct city *pcity)
Definition cityrep.c:305
static GtkWidget * city_view_depr
Definition cityrep.c:104
static void city_store_fill(GListStore *store, GtkMultiSelection *selection, GHashTable *select)
Definition cityrep.c:390
static GtkListStore * city_report_dialog_store_new_depr(void)
Definition cityrep.c:267
static FcCityRow * fc_city_row_new(void)
Definition cityrep.c:211
static GListStore * city_store
Definition cityrep.c:109
static void city_factory_setup(GtkSignalListItemFactory *self, GtkListItem *list_item, gpointer user_data)
Definition cityrep.c:257
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_strdup(str)
Definition mem.h:43
#define fc_realloc(ptr, sz)
Definition mem.h:36
#define fc_malloc(sz)
Definition mem.h:34
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
GObjectClass parent_class
Definition cityrep.c:170
GObject parent_instance
Definition cityrep.c:162
int city_id
Definition cityrep.c:165
char ** columns
Definition cityrep.c:164
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
const char * imprname
Definition cityrep.c:719
const struct impr_type * building
Definition cityrep.c:718
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