Freeciv-3.2
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
114
123
136
140
141/************************************************************************/
144static void get_city_table_header(char **text, int n)
145{
146 struct city_report_spec *spec;
147 int i;
148
149 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
150 fc_snprintf(text[i], n, "%*s\n%*s",
151 NEG_VAL(spec->width), spec->title1 ? spec->title1 : "",
152 NEG_VAL(spec->width), spec->title2 ? spec->title2 : "");
153 }
154}
155
156/****************************************************************************
157 CITY REPORT DIALOG
158****************************************************************************/
159
160/************************************************************************/
164{
166 gint i;
167
168 /* City report data. */
169 for (i = 0; i < NUM_CREPORT_COLS; i++) {
171 }
172
173 /* Specific gtk client data. */
174 model_types[i++] = G_TYPE_INT; /* CRD_COL_CITY_ID */
175
177}
178
179/************************************************************************/
183 struct city *pcity)
184{
185 struct city_report_spec *spec;
186 char buf[64];
187 gint i;
188
189 for (i = 0; i < NUM_CREPORT_COLS; i++) {
190 spec = city_report_specs + i;
191 fc_snprintf(buf, sizeof(buf), "%*s", NEG_VAL(spec->width),
192 spec->func(pcity, spec->data));
193 gtk_list_store_set(store, iter, i, buf, -1);
194 }
195 gtk_list_store_set(store, iter, CRD_COL_CITY_ID, pcity->id, -1);
196}
197
198/************************************************************************/
202{
203 struct city *pcity;
204 int id;
205
206 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
207 pcity = game_city_by_number(id);
208 return ((NULL != pcity
210 && city_owner(pcity) != client_player())
211 ? NULL : pcity);
212}
213
214/************************************************************************/
218 const struct city *pcity)
219{
220 const int searched = pcity->id;
221 int id;
222
224 do {
225 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
226 if (searched == id) {
227 return TRUE;
228 }
229 } while (gtk_tree_model_iter_next(model, iter));
230 }
231 return FALSE;
232}
233
234/************************************************************************/
237static void city_model_fill(GtkListStore *store,
238 GtkTreeSelection *selection, GHashTable *select)
239{
241
242 if (client_has_player()) {
245 city_model_set(store, &iter, pcity);
246 if (NULL != select
247 && g_hash_table_remove(select, GINT_TO_POINTER(pcity->id))) {
249 }
251 } else {
252 /* Global observer case. */
253 cities_iterate(pcity) {
255 city_model_set(store, &iter, pcity);
256 if (NULL != select
257 && g_hash_table_remove(select, GINT_TO_POINTER(pcity->id))) {
259 }
261 }
262}
263
264/************************************************************************/
279
280/************************************************************************/
289
290/************************************************************************/
295 const char *act_pfx,
296 const char *act_pfx2,
297 bool append_units,
298 bool append_wonders,
303 int size)
304{
306 struct item items[MAX_NUM_PRODUCTION_TARGETS];
307 int i, item, targets_used;
308 char *row[4];
309 char buf[4][64];
310
311 GtkSizeGroup *size_group[3];
312
313 if (city_operation != CO_NONE) {
314 GPtrArray *selected;
315 ITree it;
316 int num_selected = 0;
318 struct city **data;
319
320 selected = g_ptr_array_sized_new(size);
321
322 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
323 struct city *pcity;
324
326 || !(pcity = city_model_get(model, TREE_ITER_PTR(it)))) {
327 continue;
328 }
329
330 g_ptr_array_add(selected, pcity);
331 num_selected++;
332 }
333
334 data = (struct city **)g_ptr_array_free(selected, FALSE);
338 g_free(data);
339 } else {
342 test_func);
343 }
344
345 name_and_sort_items(targets, targets_used, items,
347
348 for (i = 0; i < 4; i++) {
349 row[i] = buf[i];
350 }
351
352
353 for (i = 0; i < 3; i++) {
355 }
356
357 for (item = 0; item < targets_used; item++) {
358 struct universal target = items[item].item;
360 char actbuf[256];
361 GSimpleAction *act;
362
363 get_city_dialog_production_row(row, sizeof(buf[0]), &target, NULL);
364
365 fc_snprintf(actbuf, sizeof(actbuf), "win.%s%s%d", act_pfx, act_pfx2, item);
366
368
369 fc_snprintf(actbuf, sizeof(actbuf), "%s%s%d", act_pfx, act_pfx2, item);
371 g_object_set_data(G_OBJECT(act), "freeciv_test_func", test_func);
372 g_object_set_data(G_OBJECT(act), "freeciv_city_operation",
375 g_signal_connect(act, "activate", callback,
376 GINT_TO_POINTER(cid_encode(target)));
378 }
379
380 for (i = 0; i < 3; i++) {
381 g_object_unref(size_group[i]);
382 }
383}
384
385/************************************************************************/
390{
391 struct universal target = cid_decode(GPOINTER_TO_INT(data));
392 struct city *pcity = city_model_get(model, iter);
393
394 if (NULL != pcity) {
395 city_change_production(pcity, &target);
396 }
397}
398
399/************************************************************************/
405 GtkTreePath *path,
407 gpointer data)
408{
409 struct universal target = cid_decode(GPOINTER_TO_INT(data));
410 struct city *pcity = city_model_get(model, iter);
411
412 if (NULL != pcity) {
413 (void) city_queue_insert(pcity, -1, &target);
414 }
415 /* Perhaps should warn the user if not successful? */
416}
417
418/************************************************************************/
426 GtkTreePath *path,
428 gpointer data)
429{
430 struct universal target = cid_decode(GPOINTER_TO_INT(data));
431 struct city *pcity = city_model_get(model, iter);
432
433 if (NULL != pcity) {
434 (void) city_queue_insert(pcity, 0, &target);
435 }
436 /* Perhaps should warn the user if not successful? */
437}
438
439/************************************************************************/
446 GtkTreePath *path,
448 gpointer data)
449{
450 struct universal target = cid_decode(GPOINTER_TO_INT(data));
451 struct city *pcity = city_model_get(model, iter);
452
453 if (NULL != pcity) {
454 (void) city_queue_insert(pcity, 1, &target);
455 }
456 /* perhaps should warn the user if not successful? */
457}
458
459/************************************************************************/
465 GtkTreePath *path,
467 gpointer data)
468{
469 struct universal target = cid_decode(GPOINTER_TO_INT(data));
470 struct city *pcity = city_model_get(model, iter);
471
472 if (NULL != pcity) {
473 city_queue_insert(pcity, worklist_length(&pcity->worklist), &target);
474 }
475}
476
477/************************************************************************/
482{
483 struct sell_data *sd = (struct sell_data *) data;
484 struct city *pcity = city_model_get(model, iter);
485
486 if (NULL != pcity
487 && !pcity->did_sell
488 && city_has_building(pcity, sd->target)) {
489 sd->count++;
490 sd->gold += impr_sell_gold(sd->target);
492 }
493}
494
495/************************************************************************/
500 GVariant *parameter,
501 gpointer data)
502{
503 struct universal target = cid_decode(GPOINTER_TO_INT(data));
504 TestCityFunc test_func = g_object_get_data(G_OBJECT(action), "freeciv_test_func");
506 GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "freeciv_city_operation"));
507
508 /* If this is not a city operation: */
509 if (city_operation == CO_NONE) {
511 ITree it;
512
514 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
515 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
516
517 if (NULL != pcity && test_func(pcity, &target)) {
519 }
520 }
521 } else {
523
525 switch (city_operation) {
526 case CO_LAST:
529 GINT_TO_POINTER(cid_encode(target)));
530 break;
531 case CO_CHANGE:
534 GINT_TO_POINTER(cid_encode(target)));
535 break;
536 case CO_FIRST:
539 GINT_TO_POINTER(cid_encode(target)));
540 break;
541 case CO_NEXT:
544 GINT_TO_POINTER(cid_encode(target)));
545 break;
546 case CO_NEXT_TO_LAST:
549 GINT_TO_POINTER(cid_encode(target)));
550 break;
551 case CO_SELL:
552 fc_assert_action(target.kind == VUT_IMPROVEMENT, break);
553 {
554 const struct impr_type *building = target.value.building;
555 struct sell_data sd = { 0, 0, building };
556 GtkWidget *w;
557 gint res;
558 gchar *buf;
559 const char *imprname = improvement_name_translation(building);
560
561 /* Ask confirmation */
562 buf = g_strdup_printf(_("Are you sure you want to sell those %s?"), imprname);
565 GTK_BUTTONS_YES_NO, "%s", buf);
566 g_free(buf);
567 res = blocking_dialog(w); /* Synchron. */
569 if (res == GTK_RESPONSE_NO) {
570 break;
571 }
572
575 if (sd.count > 0) {
576 /* FIXME: plurality of sd.count is ignored! */
577 /* TRANS: "Sold 3 Harbor for 90 gold." (Pluralisation is in gold --
578 * second %d -- not in buildings.) */
581 PL_("Sold %d %s for %d gold.",
582 "Sold %d %s for %d gold.",
583 sd.gold),
584 sd.count, imprname, sd.gold);
585 } else {
588 _("No %s could be sold."),
589 imprname);
590 }
591
592 g_signal_connect(w, "response",
594 gtk_window_present(GTK_WINDOW(w)); /* Asynchron. */
595 }
596 break;
597 case CO_NONE:
598 break;
599 }
601 }
602}
603
604/************************************************************************/
609{
610 struct city *pcity = city_model_get(model, iter);
611 int idx = GPOINTER_TO_INT(data);
612
613 if (NULL != pcity) {
614 if (CMA_NONE == idx) {
615 cma_release_city(pcity);
616 } else {
618 }
619 refresh_city_dialog(pcity);
620 }
621}
622
623/************************************************************************/
628 GVariant *parameter,
629 gpointer data)
630{
631 int idx = GPOINTER_TO_INT(data);
632 bool change_governor =
634 struct cm_parameter cm;
635
636 /* If this is not the change button but the select cities button. */
637 if (!change_governor) {
638 ITree it;
640
642 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
643 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
644 int controlled;
645 bool select;
646
647 if (NULL == pcity) {
648 continue;
649 }
651 select = FALSE;
652
653 if (idx == CMA_NONE) {
654 /* CMA_NONE selects not-controlled, all others require controlled */
655 if (!controlled) {
656 select = TRUE;
657 }
658 } else if (controlled) {
659 if (idx == CMA_CUSTOM) {
661 select = TRUE;
662 }
663 } else if (cm_are_parameter_equal(&cm,
665 select = TRUE;
666 }
667 }
668
669 if (select) {
671 }
672 }
673 } else {
676 GINT_TO_POINTER(idx));
677 }
678}
679
680/************************************************************************/
687 bool change_governor)
688{
689 GMenu *menu;
690 int i;
691 struct cm_parameter cm;
692
693 menu = g_menu_new();
694
696 return menu;
697 }
698
699 if (change_governor) {
700 GSimpleAction *act;
701
702 act = g_simple_action_new("chg_governor_none", NULL);
703 g_object_set_data(G_OBJECT(act), "governor",
709 g_menu_item_new(Q_("?cma:none"),
710 "win.chg_governor_none"));
711
712 for (i = 0; i < cmafec_preset_num(); i++) {
713 char buf[128];
714
715 fc_snprintf(buf, sizeof(buf), "chg_governor_%d", i);
717 g_object_set_data(G_OBJECT(act), "governor",
722 fc_snprintf(buf, sizeof(buf), "win.chg_governor_%d", i);
725 }
726 } else {
727 /* Search for a "none" */
728 bool found;
729
730 found = FALSE;
732 if (!cma_is_city_under_agent(pcity, NULL)) {
733 found = TRUE;
734 break;
735 }
737
738 if (found) {
739 GSimpleAction *act;
740
741 act = g_simple_action_new("sel_governor_none", NULL);
742 g_object_set_data(G_OBJECT(act), "governor",
748 g_menu_item_new(Q_("?cma:none"),
749 "win.sel_governor_none"));
750 }
751
752 /*
753 * Search for a city that's under custom (not preset) agent. Might
754 * take a lonnggg time.
755 */
756 found = FALSE;
758 if (cma_is_city_under_agent(pcity, &cm)
760 found = TRUE;
761 break;
762 }
764
765 if (found) {
766 /* We found city that's under agent but not a preset */
767 GSimpleAction *act;
768
769 act = g_simple_action_new("sel_governor_custom", NULL);
770 g_object_set_data(G_OBJECT(act), "governor",
776 g_menu_item_new(Q_("?cma:custom"),
777 "win.sel_governor_custom"));
778 }
779
780 /* Only fill in presets that are being used. */
781 for (i = 0; i < cmafec_preset_num(); i++) {
782 found = FALSE;
784 if (cma_is_city_under_agent(pcity, &cm)
787 found = TRUE;
788 break;
789 }
791
792 if (found) {
793 GSimpleAction *act;
794 char buf[128];
795
796 fc_snprintf(buf, sizeof(buf), "sel_governor_%d", i);
797
799 g_object_set_data(G_OBJECT(act), "governor",
804 fc_snprintf(buf, sizeof(buf), "win.sel_governor_%d", i);
807 buf));
808 }
809 }
810 }
811
812 return menu;
813}
814
815/************************************************************************/
824
825/************************************************************************/
832{
833 const struct worklist *pwl = data;
834 struct city *pcity = city_model_get(model, iter);
835
837
838 if (NULL != pcity) {
840 }
841}
842
843/************************************************************************/
849 GVariant *parameter,
850 gpointer data)
851{
852 struct global_worklist *pgwl =
854
856
857 if (!pgwl) {
858 /* Maybe removed by an other way, not an error. */
859 return;
860 }
861
865}
866
867/************************************************************************/
873{
874 const struct worklist *pwl = data;
875 struct city *pcity = city_model_get(model, iter);
876
878
879 if (NULL != pcity) {
880 city_set_queue(pcity, pwl);
881 }
882}
883
884/************************************************************************/
889 GVariant *parameter,
890 gpointer data)
891{
892 struct global_worklist *pgwl =
894
898
899 if (!pgwl) {
900 /* Maybe removed by an other way, not an error. */
901 return;
902 }
903
907}
908
909/************************************************************************/
912static GMenu *create_wl_menu(GActionGroup *group, const char *act_pfx,
913 GCallback cb)
914{
915 GMenu *menu;
916 GSimpleAction *act;
917 int count = 0;
918
919 menu = g_menu_new();
920
922 return NULL;
923 }
924
926 char buf[128];
927
928 fc_snprintf(buf, sizeof(buf), "wl%s%d", act_pfx, count);
931 g_signal_connect(act, "activate", cb,
933 fc_snprintf(buf, sizeof(buf), "win.wl%s%d", act_pfx, count);
936 buf));
937 count++;
939
940 if (count == 0) {
941 char buf[64];
942
943 fc_snprintf(buf, sizeof(buf), "win.wl%s_dummy", act_pfx);
945 g_menu_item_new(_("(no worklists defined)"), buf));
946 }
947
948 return menu;
949}
950
951/************************************************************************/
955{
956 struct city_report_spec *spec;
959 GList *columns, *p;
960
963
965
966 for (p = columns; p != NULL; p = p->next) {
967 col = p->data;
968 spec = g_object_get_data(G_OBJECT(col), "city_report_spec");
970 }
971
973}
974
975/************************************************************************/
980{
982 char act_name[50];
983 struct city_report_spec *spec = city_report_specs + pos;
984
985 fc_snprintf(act_name, sizeof(act_name), "win.display%d(%s)",
986 pos, spec->show ? "true" : "false");
989
990 return item;
991}
992
993/************************************************************************/
997{
998 struct city_report_spec *spec = data;
999 int idx = spec - city_report_specs;
1000
1001 spec->show ^= 1;
1003
1006}
1007
1008/************************************************************************/
1012{
1013 struct city_report_spec *spec;
1014 int i;
1016
1018 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
1019 GSimpleAction *act;
1020 char act_name[50];
1021 GVariant *var = g_variant_new("b", TRUE);
1022
1023 fc_snprintf(act_name, sizeof(act_name), "display%d", i);
1026 g_signal_connect(act, "change-state", G_CALLBACK(toggle_view), (gpointer)spec);
1027
1029 }
1030
1032
1033 return display_menu;
1034}
1035
1036/************************************************************************/
1074
1075/************************************************************************/
1080{
1082 gchar *str1, *str2;
1083 int i;
1084
1085 gtk_tree_model_get(model, a, col, &str1, -1);
1086 gtk_tree_model_get(model, b, col, &str2, -1);
1087
1089 g_free(str1);
1090 g_free(str2);
1091 return i;
1092}
1093
1094/************************************************************************/
1098{
1099 static char **titles;
1100 static char (*buf)[128];
1101 struct city_report_spec *spec;
1102
1103 GtkWidget *sw, *aux_menu;
1104 int i;
1105
1108
1110
1113
1114 /* Menu */
1117
1118 /* Buttons */
1125
1127 _("_Buy"), CITY_BUY);
1128
1130 _("_Inspect"), CITY_POPUP);
1131
1133 _("Cen_ter"), CITY_CENTER);
1134
1135 /* Tree view */
1136 buf = fc_realloc(buf, NUM_CREPORT_COLS * sizeof(buf[0]));
1138 for (i = 0; i < NUM_CREPORT_COLS; i++) {
1139 titles[i] = buf[i];
1140 }
1141 get_city_table_header(titles, sizeof(buf[0]));
1142
1144
1149 gtk_widget_set_name(city_view, "small_font");
1150 g_signal_connect(city_view, "row_activated",
1156
1157 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
1158 GtkWidget *header;
1159 GtkCellRenderer *renderer;
1161
1162 renderer = gtk_cell_renderer_text_new();
1164 "text", i, NULL);
1165 header = gtk_label_new(titles[i]);
1172 g_object_set_data(G_OBJECT(col), "city_report_spec", spec);
1176 NULL);
1177 }
1178
1184
1186
1189
1190 /* Real menus */
1194
1196}
1197
1198/************************************************************************/
1207
1208/************************************************************************/
1217
1218/************************************************************************/
1222 GVariant *parameter,
1223 gpointer data)
1224{
1225 ITree it;
1227
1228 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1231 } else {
1233 }
1234 }
1235}
1236
1237/************************************************************************/
1241 GVariant *parameter,
1242 gpointer data)
1243{
1244 ITree it;
1246
1248
1249 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1250 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1251
1252 if (pcity != NULL
1255 }
1256 }
1257}
1258
1259/************************************************************************/
1263 GtkTreeIter *iter, gpointer data)
1264{
1265 struct city *selected_pcity = city_model_get(model, iter);
1266 ITree it;
1267
1268 if (NULL == selected_pcity) {
1269 return;
1270 }
1271
1272 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1273 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1274
1275 if (NULL != pcity
1276 && (tile_continent(pcity->tile)
1277 == tile_continent(selected_pcity->tile))) {
1279 }
1280 }
1281}
1282
1283/************************************************************************/
1293
1294/************************************************************************/
1298 GVariant *parameter,
1299 gpointer data)
1300{
1302 ITree it;
1304
1306
1307 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1308 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1309
1310 if (NULL != pcity
1311 && ((which == PCT_UNIT && VUT_UTYPE == pcity->production.kind)
1313 && VUT_IMPROVEMENT == pcity->production.kind
1314 && !is_wonder(pcity->production.value.building))
1315 || (which == PCT_WONDER
1316 && VUT_IMPROVEMENT == pcity->production.kind
1317 && is_wonder(pcity->production.value.building)))) {
1319 }
1320 }
1321}
1322
1323/************************************************************************/
1326static void buy_iterate(GtkTreeModel *model, GtkTreePath *path,
1327 GtkTreeIter *iter, gpointer data)
1328{
1329 struct city *pcity = city_model_get(model, iter);
1330
1331 if (NULL != pcity) {
1332 cityrep_buy(pcity);
1333 }
1334}
1335
1336/************************************************************************/
1339static void center_iterate(GtkTreeModel *model, GtkTreePath *path,
1340 GtkTreeIter *iter, gpointer data)
1341{
1342 struct city *pcity = city_model_get(model, iter);
1343
1344 if (NULL != pcity) {
1346 }
1347}
1348
1349/************************************************************************/
1352static void popup_iterate(GtkTreeModel *model, GtkTreePath *path,
1353 GtkTreeIter *iter, gpointer data)
1354{
1355 struct city *pcity = city_model_get(model, iter);
1356
1357 if (NULL != pcity) {
1360 }
1361 popup_city_dialog(pcity);
1362 }
1363}
1364
1365/************************************************************************/
1368static void city_command_callback(struct gui_dialog *dlg, int response,
1369 gpointer data)
1370{
1371 switch (response) {
1372 case CITY_CENTER:
1374 /* Center to city doesn't make sense if many city are selected. */
1376 NULL);
1377 }
1378 break;
1379 case CITY_POPUP:
1381 break;
1382 case CITY_BUY:
1384 break;
1385 default:
1386 gui_dialog_destroy(dlg);
1387 break;
1388 }
1389}
1390
1391/************************************************************************/
1396{
1397 GtkTreeModel *model;
1399 GdkSurface *win;
1400 GdkSeat *seat;
1402
1404
1405 if (!gtk_tree_model_get_iter(model, &iter, path)) {
1406 return;
1407 }
1408
1411
1413 NULL, NULL, &mask);
1414
1415 if (!(mask & GDK_CONTROL_MASK)) {
1416 popup_iterate(model, path, &iter, NULL);
1417 } else {
1418 center_iterate(model, path, &iter, NULL);
1419 }
1420}
1421
1422/************************************************************************/
1426{
1427 GHashTable *selected;
1428 ITree iter;
1429 gint city_id;
1430
1431 if (NULL == city_dialog_shell) {
1432 return;
1433 }
1434
1435 /* Save the selection. */
1436 selected = g_hash_table_new(NULL, NULL);
1438 !itree_end(&iter); itree_next(&iter)) {
1440 itree_get(&iter, CRD_COL_CITY_ID, &city_id, -1);
1441 g_hash_table_insert(selected, GINT_TO_POINTER(city_id), NULL);
1442 }
1443 }
1444
1445 /* Update and restore the selection. */
1448 g_hash_table_destroy(selected);
1449
1451}
1452
1453/************************************************************************/
1457{
1459
1460 if (NULL == city_dialog_shell) {
1461 return;
1462 }
1463
1466 }
1467 city_model_set(city_model, &iter, pcity);
1468
1470}
1471
1472/************************************************************************/
1481static GMenu *create_change_menu(GActionGroup *group, const char *mname,
1482 const char *human_mname,
1484{
1485 GMenu *menu = g_menu_new();
1486 GMenu *submenu;
1487 int n;
1488 char buf[128];
1489
1491
1492 submenu = g_menu_new();
1494 TRUE, FALSE, oper,
1497 fc_snprintf(buf, sizeof(buf), human_mname, _("Unit"));
1499
1500 submenu = g_menu_new();
1502 FALSE, FALSE, oper,
1505 fc_snprintf(buf, sizeof(buf), human_mname, _("Improvement"));
1507
1508 submenu = g_menu_new();
1510 FALSE, TRUE, oper,
1513 fc_snprintf(buf, sizeof(buf), human_mname, _("Wonder"));
1515
1516 return menu;
1517}
1518
1519/************************************************************************/
1523{
1524 int n;
1525 GMenu *menu = g_menu_new();
1526
1528
1529 append_impr_or_unit_to_menu(menu, group, "sell", "",
1533 n);
1534
1536 submenu_insert_unref(cityrep_menu, 2, _("S_ell"), G_MENU_MODEL(menu));
1537}
1538
1539/************************************************************************/
1543{
1544 GSimpleAction *act;
1545
1547
1548 /* TRANS: Menu name part to be used like "Change to Improvement"
1549 * This is about changing current production. */
1550 change_menu = create_change_menu(group, "change", _("Change to %s"), CO_CHANGE);
1552
1554
1555 /* TRANS: Menu name to be used like "Set Improvement first"
1556 * This is about adding item to the beginning of the worklist. */
1557 add_first_menu = create_change_menu(group, "first", _("Set %s first"), CO_FIRST);
1558 submenu_append_unref(prod_menu, _("Add _First"),
1560
1562
1563 /* TRANS: Menu name to be used like "Set Improvement last"
1564 * This is about adding item to the end of the worklist. */
1565 add_last_menu = create_change_menu(group, "last", _("Set %s last"), CO_LAST);
1566 submenu_append_unref(prod_menu, _("Add _Last"),
1568
1570
1571 /* TRANS: Menu name to be used like "Set Improvement next"
1572 * This is about adding item after current one on the worklist. */
1573 add_next_menu = create_change_menu(group, "next", _("Set %s next"), CO_NEXT);
1574 submenu_append_unref(prod_menu, _("Add _Next"),
1576
1578
1579 /* TRANS: Menu name to be used like "Set Improvement 2nd last"
1580 * This is about adding item as second last on the worklist. */
1581 add_2ndlast_menu = create_change_menu(group, "2ndlast", _("Set %s 2nd last"), CO_NEXT_TO_LAST);
1582 submenu_append_unref(prod_menu, _("Add _2nd Last"),
1584
1586 submenu_append_unref(prod_menu, _("Set Worklist"),
1588
1590 submenu_append_unref(prod_menu, _("Append Worklist"),
1592
1593 act = g_simple_action_new("clear_worklist", NULL);
1596 NULL);
1598 "win.clear_worklist"));
1599
1600 return prod_menu;
1601}
1602
1603/************************************************************************/
1622
1623/************************************************************************/
1626static bool city_building_impr_or_unit(const struct city *pcity,
1627 const struct universal *target)
1628{
1629 return are_universals_equal(&pcity->production, target);
1630}
1631
1632/************************************************************************/
1636{
1637 GSimpleAction *act;
1638 char buf[128];
1639
1641
1642#if 0
1645#endif
1646
1647 act = g_simple_action_new("select_all", NULL);
1650 NULL);
1652 "win.select_all"));
1653
1654 act = g_simple_action_new("select_none", NULL);
1657 NULL);
1659 "win.select_none"));
1660
1661 act = g_simple_action_new("select_invert", NULL);
1664 NULL);
1666 "win.select_invert"));
1667
1668 act = g_simple_action_new("select_build_unit", NULL);
1673 "win.select_build_unit"));
1674
1675 act = g_simple_action_new("select_build_impr", NULL);
1679 menu_item_append_unref(select_menu, g_menu_item_new(_("Building Improvements"),
1680 "win.select_build_impr"));
1681
1682 act = g_simple_action_new("select_build_wonder", NULL);
1687 "win.select_build_wonder"));
1688
1690 append_impr_or_unit_to_menu(unit_b_select_menu, group, "sel", "_b_u",
1691 TRUE, FALSE, CO_NONE,
1694 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Unit"));
1696
1698 append_impr_or_unit_to_menu(impr_b_select_menu, group, "sel", "_b_b",
1702 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Improvement"));
1704
1706 append_impr_or_unit_to_menu(wndr_b_select_menu, group, "sel", "_b_w",
1707 FALSE, TRUE, CO_NONE,
1710 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Wonder"));
1712
1713 act = g_simple_action_new("select_coastal", NULL);
1716 NULL);
1718 "win.select_coastal"));
1719
1720 act = g_simple_action_new("select_island", NULL);
1723 NULL);
1725 "win.select_island"));
1726
1728 append_impr_or_unit_to_menu(unit_s_select_menu, group, "sel", "_s_u",
1729 TRUE, FALSE, CO_NONE,
1732 fc_snprintf(buf, sizeof(buf), _("Supported %s"), _("Unit"));
1734
1736 append_impr_or_unit_to_menu(unit_p_select_menu, group, "sel", "_p_u",
1737 TRUE, FALSE, CO_NONE,
1740 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Unit"));
1742
1744 append_impr_or_unit_to_menu(impr_p_select_menu, group, "sel", "_p_b",
1748 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Improvement"));
1750
1752 append_impr_or_unit_to_menu(wndr_p_select_menu, group, "sel", "_p_w",
1753 FALSE, TRUE, CO_NONE,
1756 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Wonder"));
1758
1760 append_impr_or_unit_to_menu(unit_a_select_menu, group, "sel", "_a_u",
1761 TRUE, FALSE, CO_NONE,
1764 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Unit"));
1766
1768 append_impr_or_unit_to_menu(impr_a_select_menu, group, "sel", "_a_b",
1772 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Improvement"));
1774
1776 append_impr_or_unit_to_menu(wndr_a_select_menu, group, "sel", "_a_w",
1777 FALSE, TRUE, CO_NONE,
1780 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Wonder"));
1782
1784 submenu_append_unref(select_menu, _("Citizen Governor"),
1786
1787 return select_menu;
1788}
1789
1790/************************************************************************/
1813
1814/************************************************************************/
1818static void update_total_buy_cost(void)
1819{
1820 GtkWidget *label, *view;
1821 GList *rows, *p;
1822 GtkTreeModel *model;
1824 GtkTreePath *path;
1826 struct city *pcity;
1827 int total = 0;
1828
1829 view = city_view;
1831
1832 if (!view || !label) {
1833 return;
1834 }
1835
1838
1839 for (p = rows; p != NULL; p = p->next) {
1840 path = p->data;
1841 if (gtk_tree_model_get_iter(model, &iter, path)) {
1842 if ((pcity = city_model_get(model, &iter))) {
1843 total += pcity->client.buy_cost;
1844 }
1845 }
1846 gtk_tree_path_free(path);
1847 }
1849
1850 if (total > 0) {
1851 gchar *buf = g_strdup_printf(_("Total Buy Cost: %d"), total);
1852
1854 g_free(buf);
1855 } else {
1857 }
1858}
1859
1860/************************************************************************/
1874
1875/************************************************************************/
1879 GtkTreePath *path,
1881 gpointer data)
1882{
1883 struct city *pcity = city_model_get(model, iter);
1884
1885 if (NULL != pcity) {
1886 struct worklist empty;
1887
1889 city_set_worklist(pcity, &empty);
1890 }
1891}
1892
1893/************************************************************************/
1908
1909/************************************************************************/
1915{
1916 ITree it;
1917 GtkTreeModel *model;
1918
1919 if (!city_dialog_shell) return;
1920
1921 model = GTK_TREE_MODEL(city_model);
1922
1924
1925 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1926 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1927
1928 if (NULL != pcity && is_city_hilited(pcity)) {
1930 }
1931 }
1932}
1933
1934/************************************************************************/
1937void toggle_city_hilite(struct city *pcity, bool on_off)
1938{
1940
1941 if (NULL == city_dialog_shell) {
1942 return;
1943 }
1944
1946 if (on_off) {
1948 } else {
1950 }
1951 }
1952}
#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: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:563
#define city_list_iterate_end
Definition city.h:510
production_class_type
Definition city.h:38
@ PCT_UNIT
Definition city.h:39
@ PCT_NORMAL_IMPROVEMENT
Definition city.h:40
@ PCT_WONDER
Definition city.h:41
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:544
void cityrep_buy(struct city *pcity)
Definition climisc.c:1154
void name_and_sort_items(struct universal *targets, int num_targets, struct item *items, bool show_cost, struct city *pcity)
Definition climisc.c:649
cid cid_encode(struct universal target)
Definition climisc.c:482
bool city_building_present(const struct city *pcity, const struct universal *target)
Definition climisc.c:582
struct universal cid_decode(cid id)
Definition climisc.c:525
bool can_city_build_now_client(const struct city *pcity, const struct universal *target)
Definition climisc.c:592
bool city_unit_present(const struct city *pcity, const struct universal *target)
Definition climisc.c:563
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:699
#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:75
void connection_do_buffer(struct connection *pc)
Definition connection.c:324
void connection_do_unbuffer(struct connection *pc)
Definition connection.c:336
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: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 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 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
@ CITY_POPUP
Definition cityrep.c:101
@ CITY_CENTER
Definition cityrep.c:101
@ CITY_BUY
Definition cityrep.c:101
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
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 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:129
void gui_dialog_destroy(struct gui_dialog *dlg)
Definition gui_stuff.c:954
void gui_dialog_present(struct gui_dialog *dlg)
Definition gui_stuff.c:835
void 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:126
static GtkWidget * create_city_report_menu(void)
Definition cityrep.c:1039
static GMenu * wl_set_menu
Definition cityrep.c:121
static void recreate_production_menu(GActionGroup *group)
Definition cityrep.c:1606
static GMenu * unit_b_select_menu
Definition cityrep.c:125
static void city_select_island_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition cityrep.c:1286
static GMenu * display_menu
Definition cityrep.c:139
static GMenu * add_first_menu
Definition cityrep.c:117
static GMenu * add_2ndlast_menu
Definition cityrep.c:120
static GMenu * add_next_menu
Definition cityrep.c:119
static GMenu * impr_a_select_menu
Definition cityrep.c:133
static void select_governor_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition cityrep.c:627
static GMenu * unit_s_select_menu
Definition cityrep.c:128
static GMenu * impr_p_select_menu
Definition cityrep.c:130
static GActionGroup * cityrep_group
Definition cityrep.c:138
static GMenu * wl_append_menu
Definition cityrep.c:122
static void governors_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:607
static GMenu * create_governor_menu(GActionGroup *group, bool change_governor)
Definition cityrep.c:686
static GMenu * create_display_menu(GActionGroup *group)
Definition cityrep.c:1011
static void recreate_select_menu(GActionGroup *group)
Definition cityrep.c:1793
static GMenu * create_production_menu(GActionGroup *group)
Definition cityrep.c:1542
static GMenuItem * create_display_menu_item(int pos)
Definition cityrep.c:979
static GMenu * select_menu
Definition cityrep.c:124
static GMenu * prod_menu
Definition cityrep.c:115
static GMenu * add_last_menu
Definition cityrep.c:118
static GMenu * cityrep_menu
Definition cityrep.c:137
static GMenu * create_wl_menu(GActionGroup *group, const char *act_pfx, GCallback cb)
Definition cityrep.c:912
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:293
static GMenu * unit_a_select_menu
Definition cityrep.c:132
static GMenu * unit_p_select_menu
Definition cityrep.c:129
static void update_governor_menu(void)
Definition cityrep.c:818
static GMenu * governor_select_menu
Definition cityrep.c:135
static GMenu * change_menu
Definition cityrep.c:116
static GMenu * wndr_b_select_menu
Definition cityrep.c:127
static GMenu * wndr_p_select_menu
Definition cityrep.c:131
static GMenu * wndr_a_select_menu
Definition cityrep.c:134
gint blocking_dialog(GtkWidget *dlg)
Definition gui_stuff.c:1138
GtkWidget * aux_menu_new(void)
Definition gui_stuff.c:243
void gui_dialog_add_content_widget(struct gui_dialog *dlg, GtkWidget *wdg)
Definition gui_stuff.c:1107
GtkWidget * gui_dialog_add_action_widget(struct gui_dialog *dlg, GtkWidget *widget)
Definition gui_stuff.c:689
#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:191
#define fc_assert_action(condition, action)
Definition log.h:187
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:72
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:320
bool did_sell
Definition city.h:380
int id
Definition city.h:326
struct worklist worklist
Definition city.h:401
struct universal production
Definition city.h:396
int buy_cost
Definition city.h:466
struct tile * tile
Definition city.h:322
struct city::@17::@20 client
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:279
int gold
Definition cityrep.c:69
int count
Definition cityrep.c:68
const struct impr_type * target
Definition cityrep.c:70
enum universals_n kind
Definition fc_types.h:902
universals_u value
Definition fc_types.h:901
struct civ_map map
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:974
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
bool is_terrain_class_near_tile(const struct civ_map *nmap, const struct tile *ptile, enum terrain_class tclass)
Definition terrain.c:612
#define tile_continent(_tile)
Definition tile.h:92
const struct impr_type * building
Definition fc_types.h:714
void worklist_init(struct worklist *pwl)
Definition worklist.c:38
int worklist_length(const struct worklist *pwl)
Definition worklist.c:57