Freeciv-3.4
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
112static void recreate_production_menu(GActionGroup *group);
113static void recreate_select_menu(GActionGroup *group);
114static void recreate_sell_menu(GActionGroup *group);
115
120
129
142
144
148
149#define FC_TYPE_CITY_ROW (fc_city_row_get_type())
150
152
160
165
167
168/**********************************************************************/
172{
174
175 free(row->columns);
176 row->columns = nullptr;
177
179}
180
181/**********************************************************************/
184static void
191
192/**********************************************************************/
195static void
197{
198 self->columns = fc_malloc(sizeof(char *) * NUM_CREPORT_COLS);
199}
200
201/**********************************************************************/
205{
206 FcCityRow *result;
207
208 result = g_object_new(FC_TYPE_CITY_ROW, nullptr);
209
210 return result;
211}
212
213/************************************************************************/
216static void get_city_table_header(char **text, int n)
217{
218 struct city_report_spec *spec;
219 int i;
220
221 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
222 fc_snprintf(text[i], n, "%*s\n%*s",
223 NEG_VAL(spec->width), spec->title1 ? spec->title1 : "",
224 NEG_VAL(spec->width), spec->title2 ? spec->title2 : "");
225 }
226}
227
228/****************************************************************************
229 CITY REPORT DIALOG
230****************************************************************************/
231
232/**********************************************************************/
246
247/**********************************************************************/
256
257/************************************************************************/
261{
263 gint i;
264
265 /* City report data. */
266 for (i = 0; i < NUM_CREPORT_COLS; i++) {
268 }
269
270 /* Specific gtk client data. */
271 model_types[i++] = G_TYPE_INT; /* CRD_COL_CITY_ID */
272
274}
275
276/************************************************************************/
280 struct city *pcity)
281{
282 struct city_report_spec *spec;
283 char buf[64];
284 gint i;
285
286 for (i = 0; i < NUM_CREPORT_COLS; i++) {
287 spec = city_report_specs + i;
288 fc_snprintf(buf, sizeof(buf), "%*s", NEG_VAL(spec->width),
289 spec->func(pcity, spec->data));
290 gtk_list_store_set(store, iter, i, buf, -1);
291 }
293}
294
295/************************************************************************/
298static void city_store_set(FcCityRow *row, struct city *pcity)
299{
300 struct city_report_spec *spec;
301 char buf[64];
302 gint i;
303
304 row->city_id = pcity->id;
305
306 for (i = 0; i < NUM_CREPORT_COLS; i++) {
307 spec = city_report_specs + i;
308 fc_snprintf(buf, sizeof(buf), "%*s", NEG_VAL(spec->width),
309 spec->func(pcity, spec->data));
310 row->columns[i] = fc_strdup(buf);
311 }
312}
313
314/************************************************************************/
318{
319 struct city *pcity;
320 int id;
321
322 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
324 return ((NULL != pcity
327 ? NULL : pcity);
328}
329
330/************************************************************************/
334 const struct city *pcity)
335{
336 const int searched = pcity->id;
337 int id;
338
340 do {
341 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
342 if (searched == id) {
343 return TRUE;
344 }
345 } while (gtk_tree_model_iter_next(model, iter));
346 }
347 return FALSE;
348}
349
350/************************************************************************/
354 GtkTreeSelection *selection, GHashTable *select)
355{
357
358 if (client_has_player()) {
362 if (NULL != select
365 }
367 } else {
368 /* Global observer case. */
372 if (NULL != select
375 }
377 }
378}
379
380/************************************************************************/
383static void city_store_fill(GListStore *store,
384 GtkMultiSelection *selection, GHashTable *select)
385{
386 if (client_has_player()) {
389
393 if (NULL != select
397 FALSE);
398 }
400 } else {
401 /* Global observer case. */
404
408 if (NULL != select
412 FALSE);
413 }
415 }
416}
417
418/************************************************************************/
435
436/************************************************************************/
445
446/************************************************************************/
451 const char *act_pfx,
452 const char *act_pfx2,
453 bool append_units,
454 bool append_wonders,
459 int size)
460{
462 struct item items[MAX_NUM_PRODUCTION_TARGETS];
463 int i, item, targets_used;
464 char *row[4];
465 char buf[4][64];
466
467 GtkSizeGroup *size_group[3];
468
469 if (city_operation != CO_NONE) {
470 GPtrArray *selected;
471 ITree it;
472 int num_selected = 0;
474 struct city **data;
475
476 selected = g_ptr_array_sized_new(size);
477
478 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
479 struct city *pcity;
480
482 || !(pcity = city_model_get(model, TREE_ITER_PTR(it)))) {
483 continue;
484 }
485
486 g_ptr_array_add(selected, pcity);
487 num_selected++;
488 }
489
490 data = (struct city **)g_ptr_array_free(selected, FALSE);
494 g_free(data);
495 } else {
498 test_func);
499 }
500
501 name_and_sort_items(targets, targets_used, items,
503
504 for (i = 0; i < 4; i++) {
505 row[i] = buf[i];
506 }
507
508
509 for (i = 0; i < 3; i++) {
511 }
512
513 for (item = 0; item < targets_used; item++) {
514 struct universal target = items[item].item;
516 char actbuf[256];
517 GSimpleAction *act;
518
519 get_city_dialog_production_row(row, sizeof(buf[0]), &target, NULL);
520
521 fc_snprintf(actbuf, sizeof(actbuf), "win.%s%s%d", act_pfx, act_pfx2, item);
522
524
525 fc_snprintf(actbuf, sizeof(actbuf), "%s%s%d", act_pfx, act_pfx2, item);
527 g_object_set_data(G_OBJECT(act), "freeciv_test_func", test_func);
528 g_object_set_data(G_OBJECT(act), "freeciv_city_operation",
531 g_signal_connect(act, "activate", callback,
532 GINT_TO_POINTER(cid_encode(target)));
534 }
535
536 for (i = 0; i < 3; i++) {
537 g_object_unref(size_group[i]);
538 }
539}
540
541/************************************************************************/
546{
547 struct universal target = cid_decode(GPOINTER_TO_INT(data));
548 struct city *pcity = city_model_get(model, iter);
549
550 if (NULL != pcity) {
552 }
553}
554
555/************************************************************************/
561 GtkTreePath *path,
563 gpointer data)
564{
565 struct universal target = cid_decode(GPOINTER_TO_INT(data));
566 struct city *pcity = city_model_get(model, iter);
567
568 if (NULL != pcity) {
569 (void) city_queue_insert(pcity, -1, &target);
570 }
571 /* Perhaps should warn the user if not successful? */
572}
573
574/************************************************************************/
582 GtkTreePath *path,
584 gpointer data)
585{
586 struct universal target = cid_decode(GPOINTER_TO_INT(data));
587 struct city *pcity = city_model_get(model, iter);
588
589 if (NULL != pcity) {
590 (void) city_queue_insert(pcity, 0, &target);
591 }
592 /* Perhaps should warn the user if not successful? */
593}
594
595/************************************************************************/
602 GtkTreePath *path,
604 gpointer data)
605{
606 struct universal target = cid_decode(GPOINTER_TO_INT(data));
607 struct city *pcity = city_model_get(model, iter);
608
609 if (NULL != pcity) {
610 (void) city_queue_insert(pcity, 1, &target);
611 }
612 /* Perhaps should warn the user if not successful? */
613}
614
615/************************************************************************/
621 GtkTreePath *path,
623 gpointer data)
624{
625 struct universal target = cid_decode(GPOINTER_TO_INT(data));
626 struct city *pcity = city_model_get(model, iter);
627
628 if (NULL != pcity) {
629 city_queue_insert(pcity, worklist_length(&pcity->worklist), &target);
630 }
631}
632
633/************************************************************************/
638{
639 struct sell_data *sd = (struct sell_data *) data;
640 struct city *pcity = city_model_get(model, iter);
641
642 if (NULL != pcity
643 && !pcity->did_sell
644 && city_has_building(pcity, sd->target)) {
645 sd->count++;
646 sd->gold += impr_sell_gold(sd->target);
648 }
649}
650
651struct scbs_data {
652 const struct impr_type *building;
653 const char *imprname;
654};
655
656/************************************************************************/
659static void sell_callback_response(GObject *dialog, GAsyncResult *result,
660 gpointer data)
661{
663 result, NULL);
664
665 if (button == 0) {
666 struct scbs_data *scbs = (struct scbs_data *)data;
667 struct sell_data sd = { 0, 0, scbs->building };
668 GtkWidget *w;
669
672 if (sd.count > 0) {
673 /* FIXME: plurality of sd.count is ignored! */
674 /* TRANS: "Sold 3 Harbor for 90 gold." (Pluralisation is in gold --
675 * second %d -- not in buildings.) */
678 PL_("Sold %d %s for %d gold.",
679 "Sold %d %s for %d gold.",
680 sd.gold),
681 sd.count, scbs->imprname, sd.gold);
682 } else {
685 _("No %s could be sold."),
686 scbs->imprname);
687 }
688
689 g_signal_connect(w, "response",
691 gtk_window_present(GTK_WINDOW(w)); /* Asynchron. */
692 }
693
694 free(data);
695}
696
697/************************************************************************/
702 GVariant *parameter,
703 gpointer data)
704{
705 struct universal target = cid_decode(GPOINTER_TO_INT(data));
706 TestCityFunc test_func = g_object_get_data(G_OBJECT(action), "freeciv_test_func");
708 GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "freeciv_city_operation"));
709
710 /* If this is not a city operation: */
711 if (city_operation == CO_NONE) {
713 ITree it;
714
716 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
717 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
718
719 if (NULL != pcity && test_func(pcity, &target)) {
721 }
722 }
723 } else {
725
727 switch (city_operation) {
728 case CO_LAST:
731 GINT_TO_POINTER(cid_encode(target)));
732 break;
733 case CO_CHANGE:
736 GINT_TO_POINTER(cid_encode(target)));
737 break;
738 case CO_FIRST:
741 GINT_TO_POINTER(cid_encode(target)));
742 break;
743 case CO_NEXT:
746 GINT_TO_POINTER(cid_encode(target)));
747 break;
748 case CO_NEXT_TO_LAST:
751 GINT_TO_POINTER(cid_encode(target)));
752 break;
753 case CO_SELL:
754 fc_assert_action(target.kind == VUT_IMPROVEMENT, break);
755 {
756 struct scbs_data *scbs = fc_malloc(sizeof(struct scbs_data));
758 gchar *buf;
759 const char *buttons[] = { _("Yes"), _("No"), NULL };
760
761 scbs->building = target.value.building;
762 scbs->imprname = improvement_name_translation(scbs->building);
763
764 /* Ask confirmation */
765 buf = g_strdup_printf(_("Are you sure you want to sell those %s?"), scbs->imprname);
766 w = gtk_alert_dialog_new("%s", buf);
767 g_free(buf);
772 }
773 break;
774 case CO_NONE:
775 break;
776 }
778 }
779}
780
781/************************************************************************/
786{
787 struct city *pcity = city_model_get(model, iter);
788 int idx = GPOINTER_TO_INT(data);
789
790 if (NULL != pcity) {
791 if (CMA_NONE == idx) {
793 } else {
795 }
797 }
798}
799
800/************************************************************************/
805 GVariant *parameter,
806 gpointer data)
807{
808 int idx = GPOINTER_TO_INT(data);
809 bool change_governor =
811 struct cm_parameter cm;
812
813 /* If this is not the change button but the select cities button. */
814 if (!change_governor) {
815 ITree it;
817
819 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
820 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
821 int controlled;
822 bool select;
823
824 if (NULL == pcity) {
825 continue;
826 }
828 select = FALSE;
829
830 if (idx == CMA_NONE) {
831 /* CMA_NONE selects not-controlled, all others require controlled */
832 if (!controlled) {
833 select = TRUE;
834 }
835 } else if (controlled) {
836 if (idx == CMA_CUSTOM) {
838 select = TRUE;
839 }
840 } else if (cm_are_parameter_equal(&cm,
842 select = TRUE;
843 }
844 }
845
846 if (select) {
848 }
849 }
850 } else {
853 GINT_TO_POINTER(idx));
854 }
855}
856
857/************************************************************************/
864 bool change_governor)
865{
866 GMenu *menu;
867 int i;
868 struct cm_parameter cm;
869
870 menu = g_menu_new();
871
873 return menu;
874 }
875
876 if (change_governor) {
877 GSimpleAction *act;
878
879 act = g_simple_action_new("chg_governor_none", NULL);
880 g_object_set_data(G_OBJECT(act), "governor",
886 g_menu_item_new(Q_("?cma:none"),
887 "win.chg_governor_none"));
888
889 for (i = 0; i < cmafec_preset_num(); i++) {
890 char buf[128];
891
892 fc_snprintf(buf, sizeof(buf), "chg_governor_%d", i);
894 g_object_set_data(G_OBJECT(act), "governor",
899 fc_snprintf(buf, sizeof(buf), "win.chg_governor_%d", i);
902 }
903 } else {
904 /* Search for a "none" */
905 bool found;
906
907 found = FALSE;
910 found = TRUE;
911 break;
912 }
914
915 if (found) {
916 GSimpleAction *act;
917
918 act = g_simple_action_new("sel_governor_none", NULL);
919 g_object_set_data(G_OBJECT(act), "governor",
925 g_menu_item_new(Q_("?cma:none"),
926 "win.sel_governor_none"));
927 }
928
929 /*
930 * Search for a city that's under custom (not preset) agent. Might
931 * take a lonnggg time.
932 */
933 found = FALSE;
937 found = TRUE;
938 break;
939 }
941
942 if (found) {
943 /* We found city that's under agent but not a preset */
944 GSimpleAction *act;
945
946 act = g_simple_action_new("sel_governor_custom", NULL);
947 g_object_set_data(G_OBJECT(act), "governor",
953 g_menu_item_new(Q_("?cma:custom"),
954 "win.sel_governor_custom"));
955 }
956
957 /* Only fill in presets that are being used. */
958 for (i = 0; i < cmafec_preset_num(); i++) {
959 found = FALSE;
964 found = TRUE;
965 break;
966 }
968
969 if (found) {
970 GSimpleAction *act;
971 char buf[128];
972
973 fc_snprintf(buf, sizeof(buf), "sel_governor_%d", i);
974
976 g_object_set_data(G_OBJECT(act), "governor",
981 fc_snprintf(buf, sizeof(buf), "win.sel_governor_%d", i);
984 buf));
985 }
986 }
987 }
988
989 return menu;
990}
991
992/************************************************************************/
1001
1002/************************************************************************/
1008 GtkTreeIter *iter, gpointer data)
1009{
1010 const struct worklist *pwl = data;
1011 struct city *pcity = city_model_get(model, iter);
1012
1014
1015 if (NULL != pcity) {
1017 }
1018}
1019
1020/************************************************************************/
1026 GVariant *parameter,
1027 gpointer data)
1028{
1029 struct global_worklist *pgwl =
1031
1033
1034 if (!pgwl) {
1035 /* Maybe removed by an other way, not an error. */
1036 return;
1037 }
1038
1042}
1043
1044/************************************************************************/
1049 GtkTreeIter *iter, gpointer data)
1050{
1051 const struct worklist *pwl = data;
1052 struct city *pcity = city_model_get(model, iter);
1053
1055
1056 if (NULL != pcity) {
1058 }
1059}
1060
1061/************************************************************************/
1066 GVariant *parameter,
1067 gpointer data)
1068{
1069 struct global_worklist *pgwl =
1071
1075
1076 if (!pgwl) {
1077 /* Maybe removed by an other way, not an error. */
1078 return;
1079 }
1080
1084}
1085
1086/************************************************************************/
1089static GMenu *create_wl_menu(GActionGroup *group, const char *act_pfx,
1090 GCallback cb)
1091{
1092 GMenu *menu;
1093 GSimpleAction *act;
1094 int count = 0;
1095
1096 menu = g_menu_new();
1097
1098 if (!can_client_issue_orders()) {
1099 return NULL;
1100 }
1101
1103 char buf[128];
1104
1105 fc_snprintf(buf, sizeof(buf), "wl%s%d", act_pfx, count);
1108 g_signal_connect(act, "activate", cb,
1110 fc_snprintf(buf, sizeof(buf), "win.wl%s%d", act_pfx, count);
1113 buf));
1114 count++;
1116
1117 if (count == 0) {
1118 char buf[64];
1119
1120 fc_snprintf(buf, sizeof(buf), "win.wl%s_dummy", act_pfx);
1122 g_menu_item_new(_("(no worklists defined)"), buf));
1123 }
1124
1125 return menu;
1126}
1127
1128/************************************************************************/
1132{
1133 struct city_report_spec *spec;
1136 GList *columns, *p;
1137
1140
1142
1143 for (p = columns; p != NULL; p = p->next) {
1144 col = p->data;
1145 spec = g_object_get_data(G_OBJECT(col), "city_report_spec");
1147 }
1148
1149 g_list_free(columns);
1150}
1151
1152/************************************************************************/
1157{
1158 GMenuItem *item;
1159 char act_name[50];
1160 struct city_report_spec *spec = city_report_specs + pos;
1161
1162 fc_snprintf(act_name, sizeof(act_name), "win.display%d(%s)",
1163 pos, spec->show ? "true" : "false");
1166
1167 return item;
1168}
1169
1170/************************************************************************/
1174{
1175 struct city_report_spec *spec = data;
1176 int idx = spec - city_report_specs;
1177
1178 spec->show ^= 1;
1180
1183}
1184
1185/************************************************************************/
1189{
1190 struct city_report_spec *spec;
1191 int i;
1193
1195 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
1196 GSimpleAction *act;
1197 char act_name[50];
1198 GVariant *var = g_variant_new("b", TRUE);
1199
1200 fc_snprintf(act_name, sizeof(act_name), "display%d", i);
1203 g_signal_connect(act, "change-state", G_CALLBACK(toggle_view), (gpointer)spec);
1204
1206 }
1207
1209
1210 return display_menu;
1211}
1212
1213/************************************************************************/
1251
1252/************************************************************************/
1257{
1259 gchar *str1, *str2;
1260 int i;
1261
1262 gtk_tree_model_get(model, a, col, &str1, -1);
1263 gtk_tree_model_get(model, b, col, &str2, -1);
1264
1266 g_free(str1);
1267 g_free(str2);
1268 return i;
1269}
1270
1271/************************************************************************/
1275{
1276 static char **titles;
1277 static char (*buf)[128];
1278 struct city_report_spec *spec;
1279
1280 GtkWidget *w, *sw, *aux_menu;
1281 int i;
1282
1285
1287
1290
1291 /* Menu */
1294
1295 /* Buttons */
1302
1304 _("_Buy"), CITY_BUY);
1305 city_buy_command = w;
1306
1308 _("_Inspect"), CITY_POPUP);
1310
1312 _("Cen_ter"), CITY_CENTER);
1314
1316
1321
1322 /* Tree view */
1323 buf = fc_realloc(buf, NUM_CREPORT_COLS * sizeof(buf[0]));
1325 for (i = 0; i < NUM_CREPORT_COLS; i++) {
1326 titles[i] = buf[i];
1327 }
1328 get_city_table_header(titles, sizeof(buf[0]));
1329
1330 for (i = 0; i < NUM_CREPORT_COLS; i++) {
1333
1339
1342 }
1343
1348 gtk_widget_set_name(city_view_depr, "small_font");
1349 g_signal_connect(city_view_depr, "row_activated",
1355
1356 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
1357 GtkWidget *header;
1358 GtkCellRenderer *renderer;
1360
1361 renderer = gtk_cell_renderer_text_new();
1363 "text", i, NULL);
1364 header = gtk_label_new(titles[i]);
1371 g_object_set_data(G_OBJECT(col), "city_report_spec", spec);
1375 NULL);
1376 }
1377
1383
1385
1387 city_store_fill(city_store, nullptr, nullptr);
1389
1390 /* Real menus */
1394
1396}
1397
1398/************************************************************************/
1407
1408/************************************************************************/
1417
1418/************************************************************************/
1422 GVariant *parameter,
1423 gpointer data)
1424{
1425 ITree it;
1427
1428 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1431 } else {
1433 }
1434 }
1435}
1436
1437/************************************************************************/
1441 GVariant *parameter,
1442 gpointer data)
1443{
1444 ITree it;
1446
1448
1449 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1450 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1451
1452 if (pcity != NULL
1455 }
1456 }
1457}
1458
1459/************************************************************************/
1463 GtkTreeIter *iter, gpointer data)
1464{
1465 struct city *selected_pcity = city_model_get(model, iter);
1466 ITree it;
1467
1468 if (NULL == selected_pcity) {
1469 return;
1470 }
1471
1472 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1473 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1474
1475 if (NULL != pcity
1477 == tile_continent(selected_pcity->tile))) {
1479 }
1480 }
1481}
1482
1483/************************************************************************/
1493
1494/************************************************************************/
1498 GVariant *parameter,
1499 gpointer data)
1500{
1502 ITree it;
1504
1506
1507 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1508 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1509
1510 if (NULL != pcity
1511 && ((which == PCT_UNIT && VUT_UTYPE == pcity->production.kind)
1512 || (which == PCT_IMPROVEMENT
1513 && VUT_IMPROVEMENT == pcity->production.kind
1514 && !is_wonder(pcity->production.value.building))
1515 || (which == PCT_WONDER
1516 && VUT_IMPROVEMENT == pcity->production.kind
1517 && is_wonder(pcity->production.value.building)))) {
1519 }
1520 }
1521}
1522
1523/************************************************************************/
1526static void buy_iterate(GtkTreeModel *model, GtkTreePath *path,
1527 GtkTreeIter *iter, gpointer data)
1528{
1529 struct city *pcity = city_model_get(model, iter);
1530
1531 if (NULL != pcity) {
1533 }
1534}
1535
1536/************************************************************************/
1539static void center_iterate(GtkTreeModel *model, GtkTreePath *path,
1540 GtkTreeIter *iter, gpointer data)
1541{
1542 struct city *pcity = city_model_get(model, iter);
1543
1544 if (NULL != pcity) {
1546 }
1547}
1548
1549/************************************************************************/
1552static void popup_iterate(GtkTreeModel *model, GtkTreePath *path,
1553 GtkTreeIter *iter, gpointer data)
1554{
1555 struct city *pcity = city_model_get(model, iter);
1556
1557 if (NULL != pcity) {
1560 }
1562 }
1563}
1564
1565/************************************************************************/
1568static void city_command_callback(struct gui_dialog *dlg, int response,
1569 gpointer data)
1570{
1571 switch (response) {
1572 case CITY_CENTER:
1574 /* Center to city doesn't make sense if many city are selected. */
1576 NULL);
1577 }
1578 break;
1579 case CITY_POPUP:
1581 break;
1582 case CITY_BUY:
1584 break;
1585 default:
1586 gui_dialog_destroy(dlg);
1587 break;
1588 }
1589}
1590
1591/************************************************************************/
1596{
1597 GtkTreeModel *model;
1599 GdkSurface *win;
1600 GdkSeat *seat;
1602
1604
1605 if (!gtk_tree_model_get_iter(model, &iter, path)) {
1606 return;
1607 }
1608
1611
1613 NULL, NULL, &mask);
1614
1615 if (!(mask & GDK_CONTROL_MASK)) {
1616 popup_iterate(model, path, &iter, NULL);
1617 } else {
1618 center_iterate(model, path, &iter, NULL);
1619 }
1620}
1621
1622/************************************************************************/
1626{
1627 GHashTable *selected;
1628 ITree iter;
1629 gint city_id;
1630
1631 if (NULL == city_dialog_shell) {
1632 return;
1633 }
1634
1635 /* Save the selection. */
1636 selected = g_hash_table_new(NULL, NULL);
1638 !itree_end(&iter); itree_next(&iter)) {
1640 itree_get(&iter, CRD_COL_CITY_ID, &city_id, -1);
1641 g_hash_table_insert(selected, GINT_TO_POINTER(city_id), NULL);
1642 }
1643 }
1644
1645 /* Update and restore the selection. */
1648
1651 g_hash_table_destroy(selected);
1652
1654}
1655
1656/************************************************************************/
1674
1675/************************************************************************/
1684static GMenu *create_change_menu(GActionGroup *group, const char *mname,
1685 const char *human_mname,
1687{
1688 GMenu *menu = g_menu_new();
1689 GMenu *submenu;
1690 int n;
1691 char buf[128];
1692
1694
1695 submenu = g_menu_new();
1697 TRUE, FALSE, oper,
1700 fc_snprintf(buf, sizeof(buf), human_mname, _("Unit"));
1702
1703 submenu = g_menu_new();
1705 FALSE, FALSE, oper,
1708 fc_snprintf(buf, sizeof(buf), human_mname, _("Improvement"));
1710
1711 submenu = g_menu_new();
1713 FALSE, TRUE, oper,
1716 fc_snprintf(buf, sizeof(buf), human_mname, _("Wonder"));
1718
1719 return menu;
1720}
1721
1722/************************************************************************/
1726{
1727 int n;
1728 GMenu *menu = g_menu_new();
1729
1731
1732 append_impr_or_unit_to_menu(menu, group, "sell", "",
1736 n);
1737
1739 submenu_insert_unref(cityrep_menu, 2, _("S_ell"), G_MENU_MODEL(menu));
1740}
1741
1742/************************************************************************/
1746{
1747 GSimpleAction *act;
1748
1750
1751 /* TRANS: Menu name part to be used like "Change to Improvement"
1752 * This is about changing current production. */
1753 change_menu = create_change_menu(group, "change", _("Change to %s"), CO_CHANGE);
1755
1757
1758 /* TRANS: Menu name to be used like "Set Improvement first"
1759 * This is about adding item to the beginning of the worklist. */
1760 add_first_menu = create_change_menu(group, "first", _("Set %s first"), CO_FIRST);
1761 submenu_append_unref(prod_menu, _("Add _First"),
1763
1765
1766 /* TRANS: Menu name to be used like "Set Improvement last"
1767 * This is about adding item to the end of the worklist. */
1768 add_last_menu = create_change_menu(group, "last", _("Set %s last"), CO_LAST);
1769 submenu_append_unref(prod_menu, _("Add _Last"),
1771
1773
1774 /* TRANS: Menu name to be used like "Set Improvement next"
1775 * This is about adding item after current one on the worklist. */
1776 add_next_menu = create_change_menu(group, "next", _("Set %s next"), CO_NEXT);
1777 submenu_append_unref(prod_menu, _("Add _Next"),
1779
1781
1782 /* TRANS: Menu name to be used like "Set Improvement 2nd last"
1783 * This is about adding item as second last on the worklist. */
1784 add_2ndlast_menu = create_change_menu(group, "2ndlast", _("Set %s 2nd last"), CO_NEXT_TO_LAST);
1785 submenu_append_unref(prod_menu, _("Add _2nd Last"),
1787
1789 submenu_append_unref(prod_menu, _("Set Worklist"),
1791
1793 submenu_append_unref(prod_menu, _("Append Worklist"),
1795
1796 act = g_simple_action_new("clear_worklist", NULL);
1799 NULL);
1801 "win.clear_worklist"));
1802
1803 return prod_menu;
1804}
1805
1806/************************************************************************/
1825
1826/************************************************************************/
1829static bool city_building_impr_or_unit(const struct city *pcity,
1830 const struct universal *target)
1831{
1832 return are_universals_equal(&pcity->production, target);
1833}
1834
1835/************************************************************************/
1839{
1840 GSimpleAction *act;
1841 char buf[128];
1842
1844
1845#if 0
1848#endif
1849
1850 act = g_simple_action_new("select_all", NULL);
1853 NULL);
1855 "win.select_all"));
1856
1857 act = g_simple_action_new("select_none", NULL);
1860 NULL);
1862 "win.select_none"));
1863
1864 act = g_simple_action_new("select_invert", NULL);
1867 NULL);
1869 "win.select_invert"));
1870
1871 act = g_simple_action_new("select_build_unit", NULL);
1876 "win.select_build_unit"));
1877
1878 act = g_simple_action_new("select_build_impr", NULL);
1882 menu_item_append_unref(select_menu, g_menu_item_new(_("Building Improvements"),
1883 "win.select_build_impr"));
1884
1885 act = g_simple_action_new("select_build_wonder", NULL);
1890 "win.select_build_wonder"));
1891
1893 append_impr_or_unit_to_menu(unit_b_select_menu, group, "sel", "_b_u",
1894 TRUE, FALSE, CO_NONE,
1897 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Unit"));
1899
1901 append_impr_or_unit_to_menu(impr_b_select_menu, group, "sel", "_b_b",
1905 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Improvement"));
1907
1909 append_impr_or_unit_to_menu(wndr_b_select_menu, group, "sel", "_b_w",
1910 FALSE, TRUE, CO_NONE,
1913 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Wonder"));
1915
1916 act = g_simple_action_new("select_coastal", NULL);
1919 NULL);
1921 "win.select_coastal"));
1922
1923 act = g_simple_action_new("select_island", NULL);
1926 NULL);
1928 "win.select_island"));
1929
1931 append_impr_or_unit_to_menu(unit_s_select_menu, group, "sel", "_s_u",
1932 TRUE, FALSE, CO_NONE,
1935 fc_snprintf(buf, sizeof(buf), _("Supported %s"), _("Unit"));
1937
1939 append_impr_or_unit_to_menu(unit_p_select_menu, group, "sel", "_p_u",
1940 TRUE, FALSE, CO_NONE,
1943 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Unit"));
1945
1947 append_impr_or_unit_to_menu(impr_p_select_menu, group, "sel", "_p_b",
1951 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Improvement"));
1953
1955 append_impr_or_unit_to_menu(wndr_p_select_menu, group, "sel", "_p_w",
1956 FALSE, TRUE, CO_NONE,
1959 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Wonder"));
1961
1963 append_impr_or_unit_to_menu(unit_a_select_menu, group, "sel", "_a_u",
1964 TRUE, FALSE, CO_NONE,
1967 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Unit"));
1969
1971 append_impr_or_unit_to_menu(impr_a_select_menu, group, "sel", "_a_b",
1975 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Improvement"));
1977
1979 append_impr_or_unit_to_menu(wndr_a_select_menu, group, "sel", "_a_w",
1980 FALSE, TRUE, CO_NONE,
1983 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Wonder"));
1985
1987 submenu_append_unref(select_menu, _("Citizen Governor"),
1989
1990 return select_menu;
1991}
1992
1993/************************************************************************/
2016
2017/************************************************************************/
2021static void update_total_buy_cost(void)
2022{
2023 GtkWidget *label, *view;
2024 GList *rows, *p;
2025 GtkTreeModel *model;
2027 GtkTreePath *path;
2029 struct city *pcity;
2030 int total = 0;
2031
2034
2035 if (!view || !label) {
2036 return;
2037 }
2038
2041
2042 for (p = rows; p != NULL; p = p->next) {
2043 path = p->data;
2044 if (gtk_tree_model_get_iter(model, &iter, path)) {
2045 if ((pcity = city_model_get(model, &iter))) {
2046 total += pcity->client.buy_cost;
2047 }
2048 }
2049 gtk_tree_path_free(path);
2050 }
2052
2053 if (total > 0) {
2054 gchar *buf = g_strdup_printf(_("Total Buy Cost: %d"), total);
2055
2057 g_free(buf);
2058 } else {
2060 }
2061}
2062
2063/************************************************************************/
2077
2078/************************************************************************/
2082 GtkTreePath *path,
2084 gpointer data)
2085{
2086 struct city *pcity = city_model_get(model, iter);
2087
2088 if (NULL != pcity) {
2089 struct worklist empty;
2090
2093 }
2094}
2095
2096/************************************************************************/
2111
2112/************************************************************************/
2118{
2119 ITree it;
2120 GtkTreeModel *model;
2121
2122 if (!city_dialog_shell) {
2123 return;
2124 }
2125
2127
2129
2130 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
2131 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
2132
2133 if (NULL != pcity && is_city_hilited(pcity)) {
2135 }
2136 }
2137}
2138
2139/************************************************************************/
2143{
2145
2146 if (NULL == city_dialog_shell) {
2147 return;
2148 }
2149
2151 if (on_off) {
2153 } else {
2155 }
2156 }
2157}
#define n
Definition astring.c:77
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
Definition city.c:1280
#define cities_iterate_end
Definition city.h:517
#define city_list_iterate(citylist, pcity)
Definition city.h:508
#define cities_iterate(pcity)
Definition city.h:512
#define city_owner(_pcity_)
Definition city.h:564
#define city_list_iterate_end
Definition city.h:510
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:2143
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:77
void connection_do_buffer(struct connection *pc)
Definition connection.c:325
void connection_do_unbuffer(struct connection *pc)
Definition connection.c:337
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:63
struct city * game_city_by_number(int id)
Definition game.c:107
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
#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:129
static GtkWidget * create_city_report_menu(void)
Definition cityrep.c:1046
static GMenu * wl_set_menu
Definition cityrep.c:124
static void recreate_production_menu(GActionGroup *group)
Definition cityrep.c:1616
static GMenu * unit_b_select_menu
Definition cityrep.c:128
static void city_select_island_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition cityrep.c:1296
static GMenu * display_menu
Definition cityrep.c:144
static GMenu * add_first_menu
Definition cityrep.c:120
static GMenu * add_2ndlast_menu
Definition cityrep.c:123
static GMenu * add_next_menu
Definition cityrep.c:122
static GMenu * impr_a_select_menu
Definition cityrep.c:136
static void select_governor_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition cityrep.c:634
static GMenu * unit_s_select_menu
Definition cityrep.c:131
static GMenu * impr_p_select_menu
Definition cityrep.c:133
static GActionGroup * cityrep_group
Definition cityrep.c:143
static GMenu * wl_append_menu
Definition cityrep.c:125
static void governors_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:614
static GMenu * create_governor_menu(GActionGroup *group, bool change_governor)
Definition cityrep.c:693
static GMenu * create_display_menu(GActionGroup *group)
Definition cityrep.c:1018
static void recreate_select_menu(GActionGroup *group)
Definition cityrep.c:1803
static GMenu * create_production_menu(GActionGroup *group)
Definition cityrep.c:1552
static GMenuItem * create_display_menu_item(int pos)
Definition cityrep.c:986
static GMenu * select_menu
Definition cityrep.c:127
static GMenu * prod_menu
Definition cityrep.c:118
static GMenu * add_last_menu
Definition cityrep.c:121
static GMenu * cityrep_menu
Definition cityrep.c:142
static GMenu * create_wl_menu(GActionGroup *group, const char *act_pfx, GCallback cb)
Definition cityrep.c:919
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:300
static GMenu * unit_a_select_menu
Definition cityrep.c:135
static GMenu * unit_p_select_menu
Definition cityrep.c:132
static void update_governor_menu(void)
Definition cityrep.c:825
static GMenu * governor_select_menu
Definition cityrep.c:138
static GMenu * change_menu
Definition cityrep.c:119
static GMenu * wndr_b_select_menu
Definition cityrep.c:130
static GMenu * wndr_p_select_menu
Definition cityrep.c:134
static GMenu * wndr_a_select_menu
Definition cityrep.c:137
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:659
static void fc_city_row_finalize(GObject *gobject)
Definition cityrep.c:171
static void city_factory_bind(GtkSignalListItemFactory *self, GtkListItem *list_item, gpointer user_data)
Definition cityrep.c:235
#define FC_TYPE_CITY_ROW
Definition cityrep.c:149
static GtkTreeSelection * city_selection_depr
Definition cityrep.c:105
static void fc_city_row_init(FcCityRow *self)
Definition cityrep.c:196
static void city_model_fill_depr(GtkListStore *store, GtkTreeSelection *selection, GHashTable *select)
Definition cityrep.c:353
static void city_model_set_depr(GtkListStore *store, GtkTreeIter *iter, struct city *pcity)
Definition cityrep.c:279
static void fc_city_row_class_init(FcCityRowClass *klass)
Definition cityrep.c:185
static GtkListStore * city_model_depr
Definition cityrep.c:106
static void city_store_set(FcCityRow *row, struct city *pcity)
Definition cityrep.c:298
static GtkWidget * city_view_depr
Definition cityrep.c:104
static void city_store_fill(GListStore *store, GtkMultiSelection *selection, GHashTable *select)
Definition cityrep.c:383
static GtkListStore * city_report_dialog_store_new_depr(void)
Definition cityrep.c:260
static FcCityRow * fc_city_row_new(void)
Definition cityrep.c:204
static GListStore * city_store
Definition cityrep.c:109
static void city_factory_setup(GtkSignalListItemFactory *self, GtkListItem *list_item, gpointer user_data)
Definition cityrep.c:250
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:120
bool are_universals_equal(const struct universal *psource1, const struct universal *psource2)
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:163
GObject parent_instance
Definition cityrep.c:155
int city_id
Definition cityrep.c:158
char ** columns
Definition cityrep.c:157
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:318
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:653
const struct impr_type * building
Definition cityrep.c:652
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:595
universals_u value
Definition fc_types.h:594
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:615
#define tile_continent(_tile)
Definition tile.h:93
const struct impr_type * building
Definition fc_types.h:529
void worklist_init(struct worklist *pwl)
Definition worklist.c:38
int worklist_length(const struct worklist *pwl)
Definition worklist.c:57