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/gdk.h>
24
25/* utility */
26#include "fcintl.h"
27#include "log.h"
28#include "shared.h"
29#include "support.h"
30
31/* common */
32#include "city.h"
33#include "game.h"
34#include "packets.h"
35#include "unit.h"
36
37/* client/agents */
38#include "cma_fec.h"
39
40/* client */
41#include "citydlg_common.h"
42#include "cityrepdata.h"
43#include "client_main.h"
44#include "climisc.h"
45#include "global_worklist.h"
46#include "mapctrl_common.h" /* is_city_hilited() */
47#include "mapview_common.h"
48#include "options.h"
49
50/* client/gui-gtk-4.0 */
51#include "chatline.h"
52#include "citydlg.h"
53#include "gui_main.h"
54#include "gui_stuff.h"
55#include "mapview.h"
56#include "optiondlg.h"
57#include "repodlgs.h"
58
59#include "cityrep.h"
60
61#define NEG_VAL(x) ((x)<0 ? (x) : (-x))
62
63/* Some versions of gcc have problems with negative values here (PR#39722). */
64#define CMA_NONE (10000)
65#define CMA_CUSTOM (10001)
66
67struct sell_data {
68 int count; /* Number of cities. */
69 int gold; /* Amount of gold. */
70 const struct impr_type *target; /* The target for selling. */
71};
72
76
77/******************************************************************/
79
82
83static void city_command_callback(struct gui_dialog *dlg, int response,
84 gpointer data);
85
88 gpointer data);
89static void update_total_buy_cost(void);
90
93
94static GMenu *create_change_menu(GActionGroup *group, const char *mname,
95 const char *human_mname,
97
99
100enum {
103
107#define CRD_COL_CITY_ID (0 + NUM_CREPORT_COLS)
108
109static void recreate_production_menu(GActionGroup *group);
110static void recreate_select_menu(GActionGroup *group);
111static void recreate_sell_menu(GActionGroup *group);
112
117
126
139
143
144/************************************************************************/
147static void get_city_table_header(char **text, int n)
148{
149 struct city_report_spec *spec;
150 int i;
151
152 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
153 fc_snprintf(text[i], n, "%*s\n%*s",
154 NEG_VAL(spec->width), spec->title1 ? spec->title1 : "",
155 NEG_VAL(spec->width), spec->title2 ? spec->title2 : "");
156 }
157}
158
159/****************************************************************************
160 CITY REPORT DIALOG
161****************************************************************************/
162
163/************************************************************************/
167{
169 gint i;
170
171 /* City report data. */
172 for (i = 0; i < NUM_CREPORT_COLS; i++) {
174 }
175
176 /* Specific gtk client data. */
177 model_types[i++] = G_TYPE_INT; /* CRD_COL_CITY_ID */
178
180}
181
182/************************************************************************/
186 struct city *pcity)
187{
188 struct city_report_spec *spec;
189 char buf[64];
190 gint i;
191
192 for (i = 0; i < NUM_CREPORT_COLS; i++) {
193 spec = city_report_specs + i;
194 fc_snprintf(buf, sizeof(buf), "%*s", NEG_VAL(spec->width),
195 spec->func(pcity, spec->data));
196 gtk_list_store_set(store, iter, i, buf, -1);
197 }
199}
200
201/************************************************************************/
205{
206 struct city *pcity;
207 int id;
208
209 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
211 return ((NULL != pcity
214 ? NULL : pcity);
215}
216
217/************************************************************************/
221 const struct city *pcity)
222{
223 const int searched = pcity->id;
224 int id;
225
227 do {
228 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
229 if (searched == id) {
230 return TRUE;
231 }
232 } while (gtk_tree_model_iter_next(model, iter));
233 }
234 return FALSE;
235}
236
237/************************************************************************/
240static void city_model_fill(GtkListStore *store,
241 GtkTreeSelection *selection, GHashTable *select)
242{
244
245 if (client_has_player()) {
248 city_model_set(store, &iter, pcity);
249 if (NULL != select
252 }
254 } else {
255 /* Global observer case. */
258 city_model_set(store, &iter, pcity);
259 if (NULL != select
262 }
264 }
265}
266
267/************************************************************************/
282
283/************************************************************************/
292
293/************************************************************************/
298 const char *act_pfx,
299 const char *act_pfx2,
300 bool append_units,
301 bool append_wonders,
306 int size)
307{
309 struct item items[MAX_NUM_PRODUCTION_TARGETS];
310 int i, item, targets_used;
311 char *row[4];
312 char buf[4][64];
313
314 GtkSizeGroup *size_group[3];
315
316 if (city_operation != CO_NONE) {
317 GPtrArray *selected;
318 ITree it;
319 int num_selected = 0;
321 struct city **data;
322
323 selected = g_ptr_array_sized_new(size);
324
325 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
326 struct city *pcity;
327
329 || !(pcity = city_model_get(model, TREE_ITER_PTR(it)))) {
330 continue;
331 }
332
333 g_ptr_array_add(selected, pcity);
334 num_selected++;
335 }
336
337 data = (struct city **)g_ptr_array_free(selected, FALSE);
341 g_free(data);
342 } else {
345 test_func);
346 }
347
348 name_and_sort_items(targets, targets_used, items,
350
351 for (i = 0; i < 4; i++) {
352 row[i] = buf[i];
353 }
354
355
356 for (i = 0; i < 3; i++) {
358 }
359
360 for (item = 0; item < targets_used; item++) {
361 struct universal target = items[item].item;
363 char actbuf[256];
364 GSimpleAction *act;
365
366 get_city_dialog_production_row(row, sizeof(buf[0]), &target, NULL);
367
368 fc_snprintf(actbuf, sizeof(actbuf), "win.%s%s%d", act_pfx, act_pfx2, item);
369
371
372 fc_snprintf(actbuf, sizeof(actbuf), "%s%s%d", act_pfx, act_pfx2, item);
374 g_object_set_data(G_OBJECT(act), "freeciv_test_func", test_func);
375 g_object_set_data(G_OBJECT(act), "freeciv_city_operation",
378 g_signal_connect(act, "activate", callback,
379 GINT_TO_POINTER(cid_encode(target)));
381 }
382
383 for (i = 0; i < 3; i++) {
384 g_object_unref(size_group[i]);
385 }
386}
387
388/************************************************************************/
393{
394 struct universal target = cid_decode(GPOINTER_TO_INT(data));
395 struct city *pcity = city_model_get(model, iter);
396
397 if (NULL != pcity) {
399 }
400}
401
402/************************************************************************/
408 GtkTreePath *path,
410 gpointer data)
411{
412 struct universal target = cid_decode(GPOINTER_TO_INT(data));
413 struct city *pcity = city_model_get(model, iter);
414
415 if (NULL != pcity) {
416 (void) city_queue_insert(pcity, -1, &target);
417 }
418 /* Perhaps should warn the user if not successful? */
419}
420
421/************************************************************************/
429 GtkTreePath *path,
431 gpointer data)
432{
433 struct universal target = cid_decode(GPOINTER_TO_INT(data));
434 struct city *pcity = city_model_get(model, iter);
435
436 if (NULL != pcity) {
437 (void) city_queue_insert(pcity, 0, &target);
438 }
439 /* Perhaps should warn the user if not successful? */
440}
441
442/************************************************************************/
449 GtkTreePath *path,
451 gpointer data)
452{
453 struct universal target = cid_decode(GPOINTER_TO_INT(data));
454 struct city *pcity = city_model_get(model, iter);
455
456 if (NULL != pcity) {
457 (void) city_queue_insert(pcity, 1, &target);
458 }
459 /* Perhaps should warn the user if not successful? */
460}
461
462/************************************************************************/
468 GtkTreePath *path,
470 gpointer data)
471{
472 struct universal target = cid_decode(GPOINTER_TO_INT(data));
473 struct city *pcity = city_model_get(model, iter);
474
475 if (NULL != pcity) {
476 city_queue_insert(pcity, worklist_length(&pcity->worklist), &target);
477 }
478}
479
480/************************************************************************/
485{
486 struct sell_data *sd = (struct sell_data *) data;
487 struct city *pcity = city_model_get(model, iter);
488
489 if (NULL != pcity
490 && !pcity->did_sell
491 && city_has_building(pcity, sd->target)) {
492 sd->count++;
493 sd->gold += impr_sell_gold(sd->target);
495 }
496}
497
498/************************************************************************/
503 GVariant *parameter,
504 gpointer data)
505{
506 struct universal target = cid_decode(GPOINTER_TO_INT(data));
507 TestCityFunc test_func = g_object_get_data(G_OBJECT(action), "freeciv_test_func");
509 GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "freeciv_city_operation"));
510
511 /* If this is not a city operation: */
512 if (city_operation == CO_NONE) {
514 ITree it;
515
517 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
518 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
519
520 if (NULL != pcity && test_func(pcity, &target)) {
522 }
523 }
524 } else {
526
528 switch (city_operation) {
529 case CO_LAST:
532 GINT_TO_POINTER(cid_encode(target)));
533 break;
534 case CO_CHANGE:
537 GINT_TO_POINTER(cid_encode(target)));
538 break;
539 case CO_FIRST:
542 GINT_TO_POINTER(cid_encode(target)));
543 break;
544 case CO_NEXT:
547 GINT_TO_POINTER(cid_encode(target)));
548 break;
549 case CO_NEXT_TO_LAST:
552 GINT_TO_POINTER(cid_encode(target)));
553 break;
554 case CO_SELL:
555 fc_assert_action(target.kind == VUT_IMPROVEMENT, break);
556 {
557 const struct impr_type *building = target.value.building;
558 struct sell_data sd = { 0, 0, building };
559 GtkWidget *w;
560 gint res;
561 gchar *buf;
562 const char *imprname = improvement_name_translation(building);
563
564 /* Ask confirmation */
565 buf = g_strdup_printf(_("Are you sure you want to sell those %s?"), imprname);
568 GTK_BUTTONS_YES_NO, "%s", buf);
569 g_free(buf);
570 res = blocking_dialog(w); /* Synchron. */
572 if (res == GTK_RESPONSE_NO) {
573 break;
574 }
575
578 if (sd.count > 0) {
579 /* FIXME: plurality of sd.count is ignored! */
580 /* TRANS: "Sold 3 Harbor for 90 gold." (Pluralisation is in gold --
581 * second %d -- not in buildings.) */
584 PL_("Sold %d %s for %d gold.",
585 "Sold %d %s for %d gold.",
586 sd.gold),
587 sd.count, imprname, sd.gold);
588 } else {
591 _("No %s could be sold."),
592 imprname);
593 }
594
595 g_signal_connect(w, "response",
597 gtk_window_present(GTK_WINDOW(w)); /* Asynchron. */
598 }
599 break;
600 case CO_NONE:
601 break;
602 }
604 }
605}
606
607/************************************************************************/
612{
613 struct city *pcity = city_model_get(model, iter);
614 int idx = GPOINTER_TO_INT(data);
615
616 if (NULL != pcity) {
617 if (CMA_NONE == idx) {
619 } else {
621 }
623 }
624}
625
626/************************************************************************/
631 GVariant *parameter,
632 gpointer data)
633{
634 int idx = GPOINTER_TO_INT(data);
635 bool change_governor =
637 struct cm_parameter cm;
638
639 /* If this is not the change button but the select cities button. */
640 if (!change_governor) {
641 ITree it;
643
645 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
646 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
647 int controlled;
648 bool select;
649
650 if (NULL == pcity) {
651 continue;
652 }
654 select = FALSE;
655
656 if (idx == CMA_NONE) {
657 /* CMA_NONE selects not-controlled, all others require controlled */
658 if (!controlled) {
659 select = TRUE;
660 }
661 } else if (controlled) {
662 if (idx == CMA_CUSTOM) {
664 select = TRUE;
665 }
666 } else if (cm_are_parameter_equal(&cm,
668 select = TRUE;
669 }
670 }
671
672 if (select) {
674 }
675 }
676 } else {
679 GINT_TO_POINTER(idx));
680 }
681}
682
683/************************************************************************/
690 bool change_governor)
691{
692 GMenu *menu;
693 int i;
694 struct cm_parameter cm;
695
696 menu = g_menu_new();
697
699 return menu;
700 }
701
702 if (change_governor) {
703 GSimpleAction *act;
704
705 act = g_simple_action_new("chg_governor_none", NULL);
706 g_object_set_data(G_OBJECT(act), "governor",
712 g_menu_item_new(Q_("?cma:none"),
713 "win.chg_governor_none"));
714
715 for (i = 0; i < cmafec_preset_num(); i++) {
716 char buf[128];
717
718 fc_snprintf(buf, sizeof(buf), "chg_governor_%d", i);
720 g_object_set_data(G_OBJECT(act), "governor",
725 fc_snprintf(buf, sizeof(buf), "win.chg_governor_%d", i);
728 }
729 } else {
730 /* Search for a "none" */
731 bool found;
732
733 found = FALSE;
736 found = TRUE;
737 break;
738 }
740
741 if (found) {
742 GSimpleAction *act;
743
744 act = g_simple_action_new("sel_governor_none", NULL);
745 g_object_set_data(G_OBJECT(act), "governor",
751 g_menu_item_new(Q_("?cma:none"),
752 "win.sel_governor_none"));
753 }
754
755 /*
756 * Search for a city that's under custom (not preset) agent. Might
757 * take a lonnggg time.
758 */
759 found = FALSE;
763 found = TRUE;
764 break;
765 }
767
768 if (found) {
769 /* We found city that's under agent but not a preset */
770 GSimpleAction *act;
771
772 act = g_simple_action_new("sel_governor_custom", NULL);
773 g_object_set_data(G_OBJECT(act), "governor",
779 g_menu_item_new(Q_("?cma:custom"),
780 "win.sel_governor_custom"));
781 }
782
783 /* Only fill in presets that are being used. */
784 for (i = 0; i < cmafec_preset_num(); i++) {
785 found = FALSE;
790 found = TRUE;
791 break;
792 }
794
795 if (found) {
796 GSimpleAction *act;
797 char buf[128];
798
799 fc_snprintf(buf, sizeof(buf), "sel_governor_%d", i);
800
802 g_object_set_data(G_OBJECT(act), "governor",
807 fc_snprintf(buf, sizeof(buf), "win.sel_governor_%d", i);
810 buf));
811 }
812 }
813 }
814
815 return menu;
816}
817
818/************************************************************************/
827
828/************************************************************************/
835{
836 const struct worklist *pwl = data;
837 struct city *pcity = city_model_get(model, iter);
838
840
841 if (NULL != pcity) {
843 }
844}
845
846/************************************************************************/
852 GVariant *parameter,
853 gpointer data)
854{
855 struct global_worklist *pgwl =
857
859
860 if (!pgwl) {
861 /* Maybe removed by an other way, not an error. */
862 return;
863 }
864
868}
869
870/************************************************************************/
876{
877 const struct worklist *pwl = data;
878 struct city *pcity = city_model_get(model, iter);
879
881
882 if (NULL != pcity) {
884 }
885}
886
887/************************************************************************/
892 GVariant *parameter,
893 gpointer data)
894{
895 struct global_worklist *pgwl =
897
901
902 if (!pgwl) {
903 /* Maybe removed by an other way, not an error. */
904 return;
905 }
906
910}
911
912/************************************************************************/
915static GMenu *create_wl_menu(GActionGroup *group, const char *act_pfx,
916 GCallback cb)
917{
918 GMenu *menu;
919 GSimpleAction *act;
920 int count = 0;
921
922 menu = g_menu_new();
923
925 return NULL;
926 }
927
929 char buf[128];
930
931 fc_snprintf(buf, sizeof(buf), "wl%s%d", act_pfx, count);
934 g_signal_connect(act, "activate", cb,
936 fc_snprintf(buf, sizeof(buf), "win.wl%s%d", act_pfx, count);
939 buf));
940 count++;
942
943 if (count == 0) {
944 char buf[64];
945
946 fc_snprintf(buf, sizeof(buf), "win.wl%s_dummy", act_pfx);
948 g_menu_item_new(_("(no worklists defined)"), buf));
949 }
950
951 return menu;
952}
953
954/************************************************************************/
958{
959 struct city_report_spec *spec;
962 GList *columns, *p;
963
966
968
969 for (p = columns; p != NULL; p = p->next) {
970 col = p->data;
971 spec = g_object_get_data(G_OBJECT(col), "city_report_spec");
973 }
974
976}
977
978/************************************************************************/
983{
985 char act_name[50];
986 struct city_report_spec *spec = city_report_specs + pos;
987
988 fc_snprintf(act_name, sizeof(act_name), "win.display%d(%s)",
989 pos, spec->show ? "true" : "false");
992
993 return item;
994}
995
996/************************************************************************/
1000{
1001 struct city_report_spec *spec = data;
1002 int idx = spec - city_report_specs;
1003
1004 spec->show ^= 1;
1006
1009}
1010
1011/************************************************************************/
1015{
1016 struct city_report_spec *spec;
1017 int i;
1019
1021 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
1022 GSimpleAction *act;
1023 char act_name[50];
1024 GVariant *var = g_variant_new("b", TRUE);
1025
1026 fc_snprintf(act_name, sizeof(act_name), "display%d", i);
1029 g_signal_connect(act, "change-state", G_CALLBACK(toggle_view), (gpointer)spec);
1030
1032 }
1033
1035
1036 return display_menu;
1037}
1038
1039/************************************************************************/
1077
1078/************************************************************************/
1083{
1085 gchar *str1, *str2;
1086 int i;
1087
1088 gtk_tree_model_get(model, a, col, &str1, -1);
1089 gtk_tree_model_get(model, b, col, &str2, -1);
1090
1092 g_free(str1);
1093 g_free(str2);
1094 return i;
1095}
1096
1097/************************************************************************/
1101{
1102 static char **titles;
1103 static char (*buf)[128];
1104 struct city_report_spec *spec;
1105
1106 GtkWidget *w, *sw, *aux_menu;
1107 int i;
1108
1111
1113
1116
1117 /* Menu */
1120
1121 /* Buttons */
1128
1130 _("_Buy"), CITY_BUY);
1131 city_buy_command = w;
1132
1134 _("_Inspect"), CITY_POPUP);
1136
1138 _("Cen_ter"), CITY_CENTER);
1140
1141 /* Tree view */
1142 buf = fc_realloc(buf, NUM_CREPORT_COLS * sizeof(buf[0]));
1144 for (i = 0; i < NUM_CREPORT_COLS; i++) {
1145 titles[i] = buf[i];
1146 }
1147 get_city_table_header(titles, sizeof(buf[0]));
1148
1150
1155 gtk_widget_set_name(city_view, "small_font");
1156 g_signal_connect(city_view, "row_activated",
1162
1163 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
1164 GtkWidget *header;
1165 GtkCellRenderer *renderer;
1167
1168 renderer = gtk_cell_renderer_text_new();
1170 "text", i, NULL);
1171 header = gtk_label_new(titles[i]);
1178 g_object_set_data(G_OBJECT(col), "city_report_spec", spec);
1182 NULL);
1183 }
1184
1190
1192
1195
1196 /* Real menus */
1200
1202}
1203
1204/************************************************************************/
1213
1214/************************************************************************/
1223
1224/************************************************************************/
1228 GVariant *parameter,
1229 gpointer data)
1230{
1231 ITree it;
1233
1234 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1237 } else {
1239 }
1240 }
1241}
1242
1243/************************************************************************/
1247 GVariant *parameter,
1248 gpointer data)
1249{
1250 ITree it;
1252
1254
1255 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1256 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1257
1258 if (pcity != NULL
1261 }
1262 }
1263}
1264
1265/************************************************************************/
1269 GtkTreeIter *iter, gpointer data)
1270{
1271 struct city *selected_pcity = city_model_get(model, iter);
1272 ITree it;
1273
1274 if (NULL == selected_pcity) {
1275 return;
1276 }
1277
1278 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1279 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1280
1281 if (NULL != pcity
1283 == tile_continent(selected_pcity->tile))) {
1285 }
1286 }
1287}
1288
1289/************************************************************************/
1299
1300/************************************************************************/
1304 GVariant *parameter,
1305 gpointer data)
1306{
1308 ITree it;
1310
1312
1313 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1314 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1315
1316 if (NULL != pcity
1317 && ((which == PCT_UNIT && VUT_UTYPE == pcity->production.kind)
1318 || (which == PCT_IMPROVEMENT
1319 && VUT_IMPROVEMENT == pcity->production.kind
1320 && !is_wonder(pcity->production.value.building))
1321 || (which == PCT_WONDER
1322 && VUT_IMPROVEMENT == pcity->production.kind
1323 && is_wonder(pcity->production.value.building)))) {
1325 }
1326 }
1327}
1328
1329/************************************************************************/
1332static void buy_iterate(GtkTreeModel *model, GtkTreePath *path,
1333 GtkTreeIter *iter, gpointer data)
1334{
1335 struct city *pcity = city_model_get(model, iter);
1336
1337 if (NULL != pcity) {
1339 }
1340}
1341
1342/************************************************************************/
1345static void center_iterate(GtkTreeModel *model, GtkTreePath *path,
1346 GtkTreeIter *iter, gpointer data)
1347{
1348 struct city *pcity = city_model_get(model, iter);
1349
1350 if (NULL != pcity) {
1352 }
1353}
1354
1355/************************************************************************/
1358static void popup_iterate(GtkTreeModel *model, GtkTreePath *path,
1359 GtkTreeIter *iter, gpointer data)
1360{
1361 struct city *pcity = city_model_get(model, iter);
1362
1363 if (NULL != pcity) {
1366 }
1368 }
1369}
1370
1371/************************************************************************/
1374static void city_command_callback(struct gui_dialog *dlg, int response,
1375 gpointer data)
1376{
1377 switch (response) {
1378 case CITY_CENTER:
1380 /* Center to city doesn't make sense if many city are selected. */
1382 NULL);
1383 }
1384 break;
1385 case CITY_POPUP:
1387 break;
1388 case CITY_BUY:
1390 break;
1391 default:
1392 gui_dialog_destroy(dlg);
1393 break;
1394 }
1395}
1396
1397/************************************************************************/
1402{
1403 GtkTreeModel *model;
1405 GdkSurface *win;
1406 GdkSeat *seat;
1408
1410
1411 if (!gtk_tree_model_get_iter(model, &iter, path)) {
1412 return;
1413 }
1414
1417
1419 NULL, NULL, &mask);
1420
1421 if (!(mask & GDK_CONTROL_MASK)) {
1422 popup_iterate(model, path, &iter, NULL);
1423 } else {
1424 center_iterate(model, path, &iter, NULL);
1425 }
1426}
1427
1428/************************************************************************/
1432{
1433 GHashTable *selected;
1434 ITree iter;
1435 gint city_id;
1436
1437 if (NULL == city_dialog_shell) {
1438 return;
1439 }
1440
1441 /* Save the selection. */
1442 selected = g_hash_table_new(NULL, NULL);
1444 !itree_end(&iter); itree_next(&iter)) {
1446 itree_get(&iter, CRD_COL_CITY_ID, &city_id, -1);
1447 g_hash_table_insert(selected, GINT_TO_POINTER(city_id), NULL);
1448 }
1449 }
1450
1451 /* Update and restore the selection. */
1454 g_hash_table_destroy(selected);
1455
1457}
1458
1459/************************************************************************/
1463{
1465
1466 if (NULL == city_dialog_shell) {
1467 return;
1468 }
1469
1472 }
1474
1476}
1477
1478/************************************************************************/
1487static GMenu *create_change_menu(GActionGroup *group, const char *mname,
1488 const char *human_mname,
1490{
1491 GMenu *menu = g_menu_new();
1492 GMenu *submenu;
1493 int n;
1494 char buf[128];
1495
1497
1498 submenu = g_menu_new();
1500 TRUE, FALSE, oper,
1503 fc_snprintf(buf, sizeof(buf), human_mname, _("Unit"));
1505
1506 submenu = g_menu_new();
1508 FALSE, FALSE, oper,
1511 fc_snprintf(buf, sizeof(buf), human_mname, _("Improvement"));
1513
1514 submenu = g_menu_new();
1516 FALSE, TRUE, oper,
1519 fc_snprintf(buf, sizeof(buf), human_mname, _("Wonder"));
1521
1522 return menu;
1523}
1524
1525/************************************************************************/
1529{
1530 int n;
1531 GMenu *menu = g_menu_new();
1532
1534
1535 append_impr_or_unit_to_menu(menu, group, "sell", "",
1539 n);
1540
1542 submenu_insert_unref(cityrep_menu, 2, _("S_ell"), G_MENU_MODEL(menu));
1543}
1544
1545/************************************************************************/
1549{
1550 GSimpleAction *act;
1551
1553
1554 /* TRANS: Menu name part to be used like "Change to Improvement"
1555 * This is about changing current production. */
1556 change_menu = create_change_menu(group, "change", _("Change to %s"), CO_CHANGE);
1558
1560
1561 /* TRANS: Menu name to be used like "Set Improvement first"
1562 * This is about adding item to the beginning of the worklist. */
1563 add_first_menu = create_change_menu(group, "first", _("Set %s first"), CO_FIRST);
1564 submenu_append_unref(prod_menu, _("Add _First"),
1566
1568
1569 /* TRANS: Menu name to be used like "Set Improvement last"
1570 * This is about adding item to the end of the worklist. */
1571 add_last_menu = create_change_menu(group, "last", _("Set %s last"), CO_LAST);
1572 submenu_append_unref(prod_menu, _("Add _Last"),
1574
1576
1577 /* TRANS: Menu name to be used like "Set Improvement next"
1578 * This is about adding item after current one on the worklist. */
1579 add_next_menu = create_change_menu(group, "next", _("Set %s next"), CO_NEXT);
1580 submenu_append_unref(prod_menu, _("Add _Next"),
1582
1584
1585 /* TRANS: Menu name to be used like "Set Improvement 2nd last"
1586 * This is about adding item as second last on the worklist. */
1587 add_2ndlast_menu = create_change_menu(group, "2ndlast", _("Set %s 2nd last"), CO_NEXT_TO_LAST);
1588 submenu_append_unref(prod_menu, _("Add _2nd Last"),
1590
1592 submenu_append_unref(prod_menu, _("Set Worklist"),
1594
1596 submenu_append_unref(prod_menu, _("Append Worklist"),
1598
1599 act = g_simple_action_new("clear_worklist", NULL);
1602 NULL);
1604 "win.clear_worklist"));
1605
1606 return prod_menu;
1607}
1608
1609/************************************************************************/
1628
1629/************************************************************************/
1632static bool city_building_impr_or_unit(const struct city *pcity,
1633 const struct universal *target)
1634{
1635 return are_universals_equal(&pcity->production, target);
1636}
1637
1638/************************************************************************/
1642{
1643 GSimpleAction *act;
1644 char buf[128];
1645
1647
1648#if 0
1651#endif
1652
1653 act = g_simple_action_new("select_all", NULL);
1656 NULL);
1658 "win.select_all"));
1659
1660 act = g_simple_action_new("select_none", NULL);
1663 NULL);
1665 "win.select_none"));
1666
1667 act = g_simple_action_new("select_invert", NULL);
1670 NULL);
1672 "win.select_invert"));
1673
1674 act = g_simple_action_new("select_build_unit", NULL);
1679 "win.select_build_unit"));
1680
1681 act = g_simple_action_new("select_build_impr", NULL);
1685 menu_item_append_unref(select_menu, g_menu_item_new(_("Building Improvements"),
1686 "win.select_build_impr"));
1687
1688 act = g_simple_action_new("select_build_wonder", NULL);
1693 "win.select_build_wonder"));
1694
1696 append_impr_or_unit_to_menu(unit_b_select_menu, group, "sel", "_b_u",
1697 TRUE, FALSE, CO_NONE,
1700 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Unit"));
1702
1704 append_impr_or_unit_to_menu(impr_b_select_menu, group, "sel", "_b_b",
1708 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Improvement"));
1710
1712 append_impr_or_unit_to_menu(wndr_b_select_menu, group, "sel", "_b_w",
1713 FALSE, TRUE, CO_NONE,
1716 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Wonder"));
1718
1719 act = g_simple_action_new("select_coastal", NULL);
1722 NULL);
1724 "win.select_coastal"));
1725
1726 act = g_simple_action_new("select_island", NULL);
1729 NULL);
1731 "win.select_island"));
1732
1734 append_impr_or_unit_to_menu(unit_s_select_menu, group, "sel", "_s_u",
1735 TRUE, FALSE, CO_NONE,
1738 fc_snprintf(buf, sizeof(buf), _("Supported %s"), _("Unit"));
1740
1742 append_impr_or_unit_to_menu(unit_p_select_menu, group, "sel", "_p_u",
1743 TRUE, FALSE, CO_NONE,
1746 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Unit"));
1748
1750 append_impr_or_unit_to_menu(impr_p_select_menu, group, "sel", "_p_b",
1754 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Improvement"));
1756
1758 append_impr_or_unit_to_menu(wndr_p_select_menu, group, "sel", "_p_w",
1759 FALSE, TRUE, CO_NONE,
1762 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Wonder"));
1764
1766 append_impr_or_unit_to_menu(unit_a_select_menu, group, "sel", "_a_u",
1767 TRUE, FALSE, CO_NONE,
1770 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Unit"));
1772
1774 append_impr_or_unit_to_menu(impr_a_select_menu, group, "sel", "_a_b",
1778 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Improvement"));
1780
1782 append_impr_or_unit_to_menu(wndr_a_select_menu, group, "sel", "_a_w",
1783 FALSE, TRUE, CO_NONE,
1786 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Wonder"));
1788
1790 submenu_append_unref(select_menu, _("Citizen Governor"),
1792
1793 return select_menu;
1794}
1795
1796/************************************************************************/
1819
1820/************************************************************************/
1824static void update_total_buy_cost(void)
1825{
1826 GtkWidget *label, *view;
1827 GList *rows, *p;
1828 GtkTreeModel *model;
1830 GtkTreePath *path;
1832 struct city *pcity;
1833 int total = 0;
1834
1835 view = city_view;
1837
1838 if (!view || !label) {
1839 return;
1840 }
1841
1844
1845 for (p = rows; p != NULL; p = p->next) {
1846 path = p->data;
1847 if (gtk_tree_model_get_iter(model, &iter, path)) {
1848 if ((pcity = city_model_get(model, &iter))) {
1849 total += pcity->client.buy_cost;
1850 }
1851 }
1852 gtk_tree_path_free(path);
1853 }
1855
1856 if (total > 0) {
1857 gchar *buf = g_strdup_printf(_("Total Buy Cost: %d"), total);
1858
1860 g_free(buf);
1861 } else {
1863 }
1864}
1865
1866/************************************************************************/
1880
1881/************************************************************************/
1885 GtkTreePath *path,
1887 gpointer data)
1888{
1889 struct city *pcity = city_model_get(model, iter);
1890
1891 if (NULL != pcity) {
1892 struct worklist empty;
1893
1896 }
1897}
1898
1899/************************************************************************/
1914
1915/************************************************************************/
1921{
1922 ITree it;
1923 GtkTreeModel *model;
1924
1925 if (!city_dialog_shell) {
1926 return;
1927 }
1928
1929 model = GTK_TREE_MODEL(city_model);
1930
1932
1933 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1934 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1935
1936 if (NULL != pcity && is_city_hilited(pcity)) {
1938 }
1939 }
1940}
1941
1942/************************************************************************/
1946{
1948
1949 if (NULL == city_dialog_shell) {
1950 return;
1951 }
1952
1954 if (on_off) {
1956 } else {
1958 }
1959 }
1960}
#define n
Definition astring.c:77
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
Definition city.c:1240
#define cities_iterate_end
Definition city.h:514
#define city_list_iterate(citylist, pcity)
Definition city.h:505
#define cities_iterate(pcity)
Definition city.h:509
#define city_owner(_pcity_)
Definition city.h:560
#define city_list_iterate_end
Definition city.h:507
void get_city_dialog_production_row(char *buf[], size_t column_size, struct universal *target, struct city *pcity)
int city_set_worklist(struct city *pcity, const struct worklist *pworklist)
bool city_queue_insert(struct city *pcity, int position, struct universal *item)
bool city_queue_insert_worklist(struct city *pcity, int position, const struct worklist *worklist)
bool city_set_queue(struct city *pcity, const struct worklist *pqueue)
int city_change_production(struct city *pcity, struct universal *target)
int city_sell_improvement(struct city *pcity, Impr_type_id sell_id)
void popup_city_dialog(struct city *pcity)
void refresh_city_dialog(struct city *pcity)
bool can_city_sell_universal(const struct city *pcity, const struct universal *target)
struct city_report_spec * city_report_specs
int cityrepfield_compare(const char *str1, const char *str2)
#define NUM_CREPORT_COLS
Definition cityrepdata.h:25
struct civclient client
bool can_client_issue_orders(void)
bool client_has_player(void)
#define client_player()
bool city_unit_supported(const struct city *pcity, const struct universal *target)
Definition climisc.c:545
void cityrep_buy(struct city *pcity)
Definition climisc.c:1155
void name_and_sort_items(struct universal *targets, int num_targets, struct item *items, bool show_cost, struct city *pcity)
Definition climisc.c:650
cid cid_encode(struct universal target)
Definition climisc.c:483
bool city_building_present(const struct city *pcity, const struct universal *target)
Definition climisc.c:583
struct universal cid_decode(cid id)
Definition climisc.c:526
bool can_city_build_now_client(const struct city *pcity, const struct universal *target)
Definition climisc.c:593
bool city_unit_present(const struct city *pcity, const struct universal *target)
Definition climisc.c:564
int collect_production_targets(struct universal *targets, struct city **selected_cities, int num_selected_cities, bool append_units, bool append_wonders, bool change_prod, TestCityFunc test_func)
Definition climisc.c:700
#define MAX_NUM_PRODUCTION_TARGETS
Definition climisc.h:89
bool(* TestCityFunc)(const struct city *, const struct universal *)
Definition climisc.h:87
bool cm_are_parameter_equal(const struct cm_parameter *const p1, const struct cm_parameter *const p2)
Definition cm.c:2141
bool cma_is_city_under_agent(const struct city *pcity, struct cm_parameter *parameter)
Definition cma_core.c:552
void cma_put_city_under_agent(struct city *pcity, const struct cm_parameter *const parameter)
Definition cma_core.c:524
void cma_release_city(struct city *pcity)
Definition cma_core.c:542
char * cmafec_preset_get_descr(int idx)
Definition cma_fec.c:169
const struct cm_parameter * cmafec_preset_get_parameter(int idx)
Definition cma_fec.c:182
int cmafec_preset_get_index_of_parameter(const struct cm_parameter *const parameter)
Definition cma_fec.c:196
int cmafec_preset_num(void)
Definition cma_fec.c:213
char * incite_cost
Definition comments.c:76
void connection_do_buffer(struct connection *pc)
Definition connection.c:324
void connection_do_unbuffer(struct connection *pc)
Definition connection.c:336
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:77
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:853
static void create_city_report_dialog(bool make_modal)
Definition cityrep.c:1138
static void city_invert_selection_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1259
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:509
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:1959
void real_city_report_dialog_update(void *unused)
Definition cityrep.c:1454
#define CRD_COL_CITY_ID
Definition cityrep.c:107
void real_city_report_update_city(struct city *pcity)
Definition cityrep.c:1489
static void city_select_building_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1328
static void popup_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1381
static void create_select_menu(GtkWidget *item)
Definition cityrep.c:1770
static void city_activated_callback(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data)
Definition cityrep.c:1423
static void select_impr_or_unit_callback(GtkWidget *wdg, gpointer data)
Definition cityrep.c:563
static void impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:452
static void city_model_fill(GtkListStore *store, GtkTreeSelection *selection, GHashTable *select)
Definition cityrep.c:260
static void center_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1368
void toggle_city_hilite(struct city *pcity, bool on_off)
Definition cityrep.c:2089
static bool city_building_impr_or_unit(const struct city *pcity, const struct universal *target)
Definition cityrep.c:1889
#define CMA_NONE
Definition cityrep.c:64
static gint cityrep_sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer data)
Definition cityrep.c:1119
static struct city * city_model_get(GtkTreeModel *model, GtkTreeIter *iter)
Definition cityrep.c:224
static void city_select_coastal_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1276
static void popup_select_menu(GtkMenuShell *menu, gpointer data)
Definition cityrep.c:1898
static void city_command_callback(struct gui_dialog *dlg, int response, gpointer data)
Definition cityrep.c:1397
static void city_model_set(GtkListStore *store, GtkTreeIter *iter, struct city *pcity)
Definition cityrep.c:205
static void city_clear_worklist_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:2049
static GtkListStore * city_model
Definition cityrep.c:106
static void clear_worklist_foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:2031
#define NEG_VAL(x)
Definition cityrep.c:61
static void city_select_all_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1243
#define CMA_CUSTOM
Definition cityrep.c:65
static void sell_impr_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:544
static GtkTreeSelection * city_selection
Definition cityrep.c:105
static void same_island_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1296
static void set_worklist_callback(GtkMenuItem *menuitem, gpointer data)
Definition cityrep.c:909
static void city_selection_changed_callback(GtkTreeSelection *selection)
Definition cityrep.c:2005
static gboolean city_model_find(GtkTreeModel *model, GtkTreeIter *iter, const struct city *pcity)
Definition cityrep.c:240
static void worklist_next_to_last_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:528
static GtkListStore * city_report_dialog_store_new(void)
Definition cityrep.c:186
static void city_report_update_views(void)
Definition cityrep.c:982
static void get_city_table_header(char **text, int n)
Definition cityrep.c:167
void hilite_cities_from_canvas(void)
Definition cityrep.c:2066
void city_report_dialog_popdown(void)
Definition cityrep.c:308
void city_report_dialog_popup(bool raise)
Definition cityrep.c:290
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:489
static void set_worklist_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:892
static void toggle_view(GtkCheckMenuItem *item, gpointer data)
Definition cityrep.c:1006
static void append_worklist_callback(GtkMenuItem *menuitem, gpointer data)
Definition cityrep.c:871
static void city_unselect_all_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1251
static void worklist_last_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:468
static GtkWidget * city_center_command
Definition cityrep.c:118
static void buy_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1355
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:1743
static void create_change_menu(GtkWidget *item)
Definition cityrep.c:1508
static struct tile * pos
Definition finddlg.c:53
GtkWidget * top_notebook
Definition gui_main.c:130
void gui_dialog_destroy(struct gui_dialog *dlg)
Definition gui_stuff.c:954
void gui_dialog_present(struct gui_dialog *dlg)
Definition gui_stuff.c:835
void itree_get(ITree *it,...)
Definition gui_stuff.c:164
void gui_dialog_raise(struct gui_dialog *dlg)
Definition gui_stuff.c:865
void gui_dialog_new(struct gui_dialog **pdlg, GtkNotebook *notebook, gpointer user_data, bool check_top)
Definition gui_stuff.c:517
void gui_dialog_response_set_callback(struct gui_dialog *dlg, GUI_DIALOG_RESPONSE_FUN fun)
Definition gui_stuff.c:988
void itree_begin(GtkTreeModel *model, ITree *it)
Definition gui_stuff.c:127
void itree_unselect(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:206
void gui_dialog_show_all(struct gui_dialog *dlg)
Definition gui_stuff.c:795
void itree_select(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:198
void gui_dialog_set_title(struct gui_dialog *dlg, const char *title)
Definition gui_stuff.c:935
void gui_dialog_set_default_size(struct gui_dialog *dlg, int width, int height)
Definition gui_stuff.c:919
void itree_next(ITree *it)
Definition gui_stuff.c:144
gboolean itree_is_selected(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:190
GtkWidget * gui_dialog_add_button(struct gui_dialog *dlg, const char *icon_name, const char *text, int response)
Definition gui_stuff.c:706
gboolean itree_end(ITree *it)
Definition gui_stuff.c:136
#define TREE_ITER_PTR(x)
Definition gui_stuff.h:38
static GMenu * impr_b_select_menu
Definition cityrep.c:129
static GtkWidget * create_city_report_menu(void)
Definition cityrep.c:1042
static GMenu * wl_set_menu
Definition cityrep.c:124
static void recreate_production_menu(GActionGroup *group)
Definition cityrep.c:1612
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:1292
static GMenu * display_menu
Definition cityrep.c:142
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:630
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:141
static GMenu * wl_append_menu
Definition cityrep.c:125
static void governors_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:610
static GMenu * create_governor_menu(GActionGroup *group, bool change_governor)
Definition cityrep.c:689
static GMenu * create_display_menu(GActionGroup *group)
Definition cityrep.c:1014
static void recreate_select_menu(GActionGroup *group)
Definition cityrep.c:1799
static GMenu * create_production_menu(GActionGroup *group)
Definition cityrep.c:1548
static GMenuItem * create_display_menu_item(int pos)
Definition cityrep.c:982
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:140
static GMenu * create_wl_menu(GActionGroup *group, const char *act_pfx, GCallback cb)
Definition cityrep.c:915
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:296
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:821
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
gint blocking_dialog(GtkWidget *dlg)
Definition gui_stuff.c:1139
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:1108
GtkWidget * gui_dialog_add_action_widget(struct gui_dialog *dlg, GtkWidget *widget)
Definition gui_stuff.c:690
#define submenu_append_unref(menu, name, submenu)
Definition gui_stuff.h:165
#define menu_item_insert_unref(menu, index, item)
Definition gui_stuff.h:142
#define submenu_insert_unref(menu, index, name, submenu)
Definition gui_stuff.h:156
#define menu_item_append_unref(menu, item)
Definition gui_stuff.h:149
int impr_sell_gold(const struct impr_type *pimprove)
Impr_type_id improvement_number(const struct impr_type *pimprove)
bool is_wonder(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
#define fc_assert_ret(condition)
Definition log.h:192
#define fc_assert_action(condition, action)
Definition log.h:188
bool is_city_hilited(struct city *pcity)
void center_tile_mapcanvas(const struct tile *ptile)
#define fc_realloc(ptr, sz)
Definition mem.h:36
struct client_options gui_options
Definition options.c:71
struct city_list * cities
Definition packhand.c:119
bool are_universals_equal(const struct universal *psource1, const struct universal *psource2)
size_t size
Definition specvec.h:72
struct sprite int int int int struct sprite * mask
Definition sprite_g.h:32
const char *(* func)(const struct city *pcity, const void *data)
Definition cityrepdata.h:34
const char * title2
Definition cityrepdata.h:31
const char * explanation
Definition cityrepdata.h:32
const char * title1
Definition cityrepdata.h:30
Definition city.h:317
struct connection conn
Definition client_main.h:96
bool center_when_popup_city
Definition options.h:161
struct player * playing
Definition connection.h:151
Definition climisc.h:82
struct universal item
Definition climisc.h:83
struct city_list * cities
Definition player.h:281
int gold
Definition cityrep.c:69
int count
Definition cityrep.c:68
const struct impr_type * target
Definition cityrep.c:70
int id
Definition unit.h:146
struct tile * tile
Definition unit.h:141
struct unit::@84::@86 client
enum universals_n kind
Definition fc_types.h:609
universals_u value
Definition fc_types.h:608
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:611
#define tile_continent(_tile)
Definition tile.h:93
const struct impr_type * building
Definition fc_types.h:547
void worklist_init(struct worklist *pwl)
Definition worklist.c:38
int worklist_length(const struct worklist *pwl)
Definition worklist.c:57