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/gdkkeysyms.h>
24
25/* utility */
26#include "fcintl.h"
27#include "log.h"
28#include "shared.h"
29#include "support.h"
30
31/* common */
32#include "city.h"
33#include "game.h"
34#include "packets.h"
35#include "unit.h"
36
37/* client/agents */
38#include "cma_fec.h"
39
40/* client */
41#include "citydlg_common.h"
42#include "cityrepdata.h"
43#include "client_main.h"
44#include "climisc.h"
45#include "global_worklist.h"
46#include "mapview_common.h"
47#include "options.h"
48
49/* client/gui-gtk-3.22 */
50#include "chatline.h"
51#include "citydlg.h"
52#include "gui_main.h"
53#include "gui_stuff.h"
54#include "mapview.h"
55#include "mapctrl.h" /* is_city_hilited() */
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
88static void update_total_buy_cost(void);
89
92static void create_last_menu(GtkWidget *item);
93static void create_first_menu(GtkWidget *item);
94static void create_next_menu(GtkWidget *item);
96static void create_sell_menu(GtkWidget *item);
97
99
100enum {
103
107#define CRD_COL_CITY_ID (0 + NUM_CREPORT_COLS)
108
109static void popup_select_menu(GtkMenuShell *menu, gpointer data);
110static void popup_change_menu(GtkMenuShell *menu, gpointer data);
111static void popup_last_menu(GtkMenuShell *menu, gpointer data);
112static void popup_first_menu(GtkMenuShell *menu, gpointer data);
113static void popup_next_menu(GtkMenuShell *menu, gpointer data);
114static void popup_next_to_last_menu(GtkMenuShell *menu, gpointer data);
115
116static void recreate_sell_menu(void);
117
125
129
133
137
141
145
147
151
156
161
163
165
166/************************************************************************/
169static void get_city_table_header(char **text, int n)
170{
171 struct city_report_spec *spec;
172 int i;
173
174 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
175 fc_snprintf(text[i], n, "%*s\n%*s",
176 NEG_VAL(spec->width), spec->title1 ? spec->title1 : "",
177 NEG_VAL(spec->width), spec->title2 ? spec->title2 : "");
178 }
179}
180
181/****************************************************************************
182 CITY REPORT DIALOG
183****************************************************************************/
184
185/************************************************************************/
189{
191 gint i;
192
193 /* City report data. */
194 for (i = 0; i < NUM_CREPORT_COLS; i++) {
196 }
197
198 /* Specific gtk client data. */
199 model_types[i++] = G_TYPE_INT; /* CRD_COL_CITY_ID */
200
202}
203
204/************************************************************************/
208 struct city *pcity)
209{
210 struct city_report_spec *spec;
211 char buf[64];
212 gint i;
213
214 for (i = 0; i < NUM_CREPORT_COLS; i++) {
215 spec = city_report_specs + i;
216 fc_snprintf(buf, sizeof(buf), "%*s", NEG_VAL(spec->width),
217 spec->func(pcity, spec->data));
218 gtk_list_store_set(store, iter, i, buf, -1);
219 }
220 gtk_list_store_set(store, iter, CRD_COL_CITY_ID, pcity->id, -1);
221}
222
223/************************************************************************/
227{
228 struct city *pcity;
229 int id;
230
231 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
232 pcity = game_city_by_number(id);
233 return ((NULL != pcity
235 && city_owner(pcity) != client_player())
236 ? NULL : pcity);
237}
238
239/************************************************************************/
243 const struct city *pcity)
244{
245 const int searched = pcity->id;
246 int id;
247
249 do {
250 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
251 if (searched == id) {
252 return TRUE;
253 }
254 } while (gtk_tree_model_iter_next(model, iter));
255 }
256 return FALSE;
257}
258
259/************************************************************************/
262static void city_model_fill(GtkListStore *store,
263 GtkTreeSelection *selection, GHashTable *select)
264{
266
267 if (client_has_player()) {
270 city_model_set(store, &iter, pcity);
271 if (NULL != select
272 && g_hash_table_remove(select, GINT_TO_POINTER(pcity->id))) {
274 }
276 } else {
277 /* Global observer case. */
278 cities_iterate(pcity) {
280 city_model_set(store, &iter, pcity);
281 if (NULL != select
282 && g_hash_table_remove(select, GINT_TO_POINTER(pcity->id))) {
284 }
286 }
287}
288
289/************************************************************************/
308
309/************************************************************************/
318
319/************************************************************************/
323 bool append_units,
324 bool append_wonders,
329 int size)
330{
331 GtkWidget *menu;
333 struct item items[MAX_NUM_PRODUCTION_TARGETS];
334 int i, item, targets_used;
335 char *row[4];
336 char buf[4][64];
337
338 GtkSizeGroup *group[3];
339 const char *markup[3] = {
340 "weight=\"bold\"",
341 "",
342 ""
343 };
344
345 menu = gtk_menu_new();
347
348 if (city_operation != CO_NONE) {
349 GPtrArray *selected;
350 ITree it;
351 int num_selected = 0;
353 struct city **data;
354
355 selected = g_ptr_array_sized_new(size);
356
357 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
358 struct city *pcity;
359
361 || !(pcity = city_model_get(model, TREE_ITER_PTR(it)))) {
362 continue;
363 }
364
365 g_ptr_array_add(selected, pcity);
366 num_selected++;
367 }
368
369 data = (struct city **)g_ptr_array_free(selected, FALSE);
373 g_free(data);
374 } else {
377 test_func);
378 }
379
380 name_and_sort_items(targets, targets_used, items,
382
383 for (i = 0; i < 4; i++) {
384 row[i] = buf[i];
385 }
386
387 g_object_set_data(G_OBJECT(menu), "freeciv_test_func", test_func);
388 g_object_set_data(G_OBJECT(menu), "freeciv_city_operation",
390
391 for (i = 0; i < 3; i++) {
393 }
394
395 for (item = 0; item < targets_used; item++) {
396 struct universal target = items[item].item;
397 GtkWidget *menu_item, *hbox, *label;
398 char txt[256];
399
400 get_city_dialog_production_row(row, sizeof(buf[0]), &target, NULL);
401
403 hbox = gtk_grid_new();
406
407 for (i = 0; i < 3; i++) {
408 if (row[i][0] == '\0') {
409 continue;
410 }
411
412 if (city_operation == CO_SELL && i != 0) {
413 continue;
414 }
415
416 fc_snprintf(txt, ARRAY_SIZE(txt), "<span %s>%s</span>",
417 markup[i], row[i]);
418
419 label = gtk_label_new(NULL);
421
422 switch (i) {
423 case 0:
426 break;
427 case 2:
430 break;
431 default:
432 break;
433 }
434
436 gtk_size_group_add_widget(group[i], label);
437 }
438
441 GINT_TO_POINTER(cid_encode(target)));
442 }
443
444 for (i = 0; i < 3; i++) {
445 g_object_unref(group[i]);
446 }
447
449
451}
452
453/************************************************************************/
458{
459 struct universal target = cid_decode(GPOINTER_TO_INT(data));
460 struct city *pcity = city_model_get(model, iter);
461
462 if (NULL != pcity) {
463 city_change_production(pcity, &target);
464 }
465}
466
467/************************************************************************/
473 GtkTreePath *path,
475 gpointer data)
476{
477 struct universal target = cid_decode(GPOINTER_TO_INT(data));
478 struct city *pcity = city_model_get(model, iter);
479
480 if (NULL != pcity) {
481 (void) city_queue_insert(pcity, -1, &target);
482 }
483 /* perhaps should warn the user if not successful? */
484}
485
486/************************************************************************/
494 GtkTreePath *path,
496 gpointer data)
497{
498 struct universal target = cid_decode(GPOINTER_TO_INT(data));
499 struct city *pcity = city_model_get(model, iter);
500
501 if (NULL != pcity) {
502 (void) city_queue_insert(pcity, 0, &target);
503 }
504 /* perhaps should warn the user if not successful? */
505}
506
507/************************************************************************/
514 GtkTreePath *path,
516 gpointer data)
517{
518 struct universal target = cid_decode(GPOINTER_TO_INT(data));
519 struct city *pcity = city_model_get(model, iter);
520
521 if (NULL != pcity) {
522 (void) city_queue_insert(pcity, 1, &target);
523 }
524 /* perhaps should warn the user if not successful? */
525}
526
527/************************************************************************/
533 GtkTreePath *path,
535 gpointer data)
536{
537 struct universal target = cid_decode(GPOINTER_TO_INT(data));
538 struct city *pcity = city_model_get(model, iter);
539
540 if (NULL != pcity) {
541 city_queue_insert(pcity, worklist_length(&pcity->worklist), &target);
542 }
543}
544
545/************************************************************************/
550{
551 struct sell_data *sd = (struct sell_data *) data;
552 struct city *pcity = city_model_get(model, iter);
553
554 if (NULL != pcity
555 && !pcity->did_sell
556 && city_has_building(pcity, sd->target)) {
557 sd->count++;
558 sd->gold += impr_sell_gold(sd->target);
560 }
561}
562
563/************************************************************************/
568{
569 struct universal target = cid_decode(GPOINTER_TO_INT(data));
571 TestCityFunc test_func = g_object_get_data(parent, "freeciv_test_func");
573 GPOINTER_TO_INT(g_object_get_data(parent, "freeciv_city_operation"));
574
575 /* if this is not a city operation: */
576 if (city_operation == CO_NONE) {
578 ITree it;
579
581 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
582 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
583
584 if (NULL != pcity && test_func(pcity, &target)) {
586 }
587 }
588 } else {
590
592 switch (city_operation) {
593 case CO_LAST:
596 GINT_TO_POINTER(cid_encode(target)));
597 break;
598 case CO_CHANGE:
601 GINT_TO_POINTER(cid_encode(target)));
602 break;
603 case CO_FIRST:
606 GINT_TO_POINTER(cid_encode(target)));
607 break;
608 case CO_NEXT:
611 GINT_TO_POINTER(cid_encode(target)));
612 break;
613 case CO_NEXT_TO_LAST:
616 GINT_TO_POINTER(cid_encode(target)));
617 break;
618 case CO_SELL:
619 fc_assert_action(target.kind == VUT_IMPROVEMENT, break);
620 {
621 const struct impr_type *building = target.value.building;
622 struct sell_data sd = { 0, 0, building };
623 GtkWidget *w;
624 gint res;
625 gchar *buf;
626 const char *imprname = improvement_name_translation(building);
627
628 /* Ask confirmation */
629 buf = g_strdup_printf(_("Are you sure you want to sell those %s?"), imprname);
632 GTK_BUTTONS_YES_NO, "%s", buf);
633 g_free(buf);
634 res = gtk_dialog_run(GTK_DIALOG(w)); /* Synchron. */
636 if (res == GTK_RESPONSE_NO) {
637 break;
638 }
639
642 if (sd.count > 0) {
643 /* FIXME: plurality of sd.count is ignored! */
644 /* TRANS: "Sold 3 Harbor for 90 gold." (Pluralisation is in gold --
645 * second %d -- not in buildings.) */
648 PL_("Sold %d %s for %d gold.",
649 "Sold %d %s for %d gold.",
650 sd.gold),
651 sd.count, imprname, sd.gold);
652 } else {
655 _("No %s could be sold."),
656 imprname);
657 }
658
659 g_signal_connect(w, "response",
661 gtk_window_present(GTK_WINDOW(w)); /* Asynchron. */
662 }
663 break;
664 case CO_NONE:
665 break;
666 }
668 }
669}
670
671/************************************************************************/
674static void cma_iterate(GtkTreeModel *model, GtkTreePath *path,
676{
677 struct city *pcity = city_model_get(model, iter);
678 int idx = GPOINTER_TO_INT(data);
679
680 if (NULL != pcity) {
681 if (CMA_NONE == idx) {
682 cma_release_city(pcity);
683 } else {
685 }
686 refresh_city_dialog(pcity);
687 }
688}
689
690/************************************************************************/
695{
696 int idx = GPOINTER_TO_INT(data);
698 bool change_cma =
699 GPOINTER_TO_INT(g_object_get_data(parent, "freeciv_change_cma"));
700 struct cm_parameter parameter;
701
702 /* If this is not the change button but the select cities button. */
703 if (!change_cma) {
704 ITree it;
706
708 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
709 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
710 int controlled;
711 bool select;
712
713 if (NULL == pcity) {
714 continue;
715 }
716 controlled = cma_is_city_under_agent(pcity, &parameter);
717 select = FALSE;
718
719 if (idx == CMA_NONE) {
720 /* CMA_NONE selects not-controlled, all others require controlled */
721 if (!controlled) {
722 select = TRUE;
723 }
724 } else if (controlled) {
725 if (idx == CMA_CUSTOM) {
726 if (cmafec_preset_get_index_of_parameter(&parameter) == -1) {
727 select = TRUE;
728 }
729 } else if (cm_are_parameter_equal(&parameter,
731 select = TRUE;
732 }
733 }
734
735 if (select) {
737 }
738 }
739 } else {
742 }
743}
744
745/************************************************************************/
752{
753 GtkWidget *menu;
754 int i;
755 struct cm_parameter parameter;
756 GtkWidget *w;
757
759 if (w != NULL && gtk_widget_get_visible(w)) {
760 return;
761 }
762
765 return;
766 }
767 menu = gtk_menu_new();
769
770 if (change_cma) {
771 w = gtk_menu_item_new_with_label(Q_("?cma:none"));
776
777 for (i = 0; i < cmafec_preset_num(); i++) {
783 }
784 } else {
785 /* Search for a "none" */
786 int found;
787
788 found = 0;
790 if (!cma_is_city_under_agent(pcity, NULL)) {
791 found = 1;
792 break;
793 }
795
796 if (found) {
797 w = gtk_menu_item_new_with_label(Q_("?cma:none"));
801 }
802
803 /*
804 * Search for a city that's under custom (not preset) agent. Might
805 * take a lonnggg time.
806 */
807 found = 0;
809 if (cma_is_city_under_agent(pcity, &parameter)
810 && cmafec_preset_get_index_of_parameter(&parameter) == -1) {
811 found = 1;
812 break;
813 }
815
816 if (found) {
817 /* We found city that's under agent but not a preset */
818 w = gtk_menu_item_new_with_label(Q_("?cma:custom"));
819
821 g_signal_connect(w, "activate",
824 }
825
826 /* Only fill in presets that are being used. */
827 for (i = 0; i < cmafec_preset_num(); i++) {
828 found = 0;
830 if (cma_is_city_under_agent(pcity, &parameter)
831 && cm_are_parameter_equal(&parameter,
833 found = 1;
834 break;
835 }
837 if (found) {
839
841 g_signal_connect(w, "activate",
843 }
844 }
845 }
846
847 g_object_set_data(G_OBJECT(menu), "freeciv_change_cma",
850}
851
852/************************************************************************/
859{
860 const struct worklist *pwl = data;
861 struct city *pcity = city_model_get(model, iter);
862
864
865 if (NULL != pcity) {
867 }
868}
869
870/************************************************************************/
876{
877 struct global_worklist *pgwl =
879
881
882 if (!pgwl) {
883 /* Maybe removed by an other way, not an error. */
884 return;
885 }
886
890}
891
892/************************************************************************/
898{
899 const struct worklist *pwl = data;
900 struct city *pcity = city_model_get(model, iter);
901
903
904 if (NULL != pcity) {
905 city_set_queue(pcity, pwl);
906 }
907}
908
909/************************************************************************/
931
932/************************************************************************/
937{
938 GtkWidget *menu, *item;
941 int count = 0;
942
943 parent_item = data;
946
947 callback = g_object_get_data(G_OBJECT(parent_item), "item_callback");
949
951 if (menu != NULL && gtk_widget_get_visible(menu)) {
953 }
954
955 if (menu == NULL) {
956 menu = gtk_menu_new();
958 }
959
961 return;
962 }
963
966
970 g_signal_connect(item, "activate", callback,
972 count++;
974
975 if (count == 0) {
976 item = gtk_menu_item_new_with_label(_("(no worklists defined)"));
978 }
979
981}
982
983/************************************************************************/
987{
988 struct city_report_spec *spec;
991 GList *columns, *p;
992
995
997
998 for (p = columns; p != NULL; p = p->next) {
999 col = p->data;
1000 spec = g_object_get_data(G_OBJECT(col), "city_report_spec");
1002 }
1003
1005}
1006
1007/************************************************************************/
1011{
1012 struct city_report_spec *spec = data;
1013
1014 spec->show ^= 1;
1016}
1017
1018/************************************************************************/
1022{
1023 GtkWidget *menu, *item;
1024 struct city_report_spec *spec;
1025 int i;
1026
1027 menu = gtk_menu_new();
1028 for (i = 0, spec = city_report_specs + i; i < NUM_CREPORT_COLS; i++, spec++) {
1033 }
1035}
1036
1037/************************************************************************/
1041{
1042 GtkWidget *vbox, *sep, *menubar, *menu, *item;
1043
1044 vbox = gtk_grid_new();
1049
1052
1053 item = gtk_menu_item_new_with_mnemonic(_("_Production"));
1056
1057 menu = gtk_menu_new();
1059
1063
1064 item = gtk_menu_item_new_with_mnemonic(_("Add _First"));
1067
1068 item = gtk_menu_item_new_with_mnemonic(_("Add _Next"));
1071
1072 item = gtk_menu_item_new_with_mnemonic(_("Add _2nd Last"));
1075
1076 item = gtk_menu_item_new_with_mnemonic(_("Add _Last"));
1079
1082
1083 item = gtk_menu_item_new_with_label(_("Set Worklist"));
1085 g_object_set_data(G_OBJECT(item), "item_callback",
1088
1089 item = gtk_menu_item_new_with_label(_("Append Worklist"));
1091 g_object_set_data(G_OBJECT(item), "item_callback",
1094
1095 item = gtk_menu_item_new_with_mnemonic(_("Clear _Worklist"));
1097 g_signal_connect(item, "activate",
1099
1100 item = gtk_menu_item_new_with_mnemonic(_("Gover_nor"));
1104
1109
1113
1114 item = gtk_menu_item_new_with_mnemonic(_("_Display"));
1117 return vbox;
1118}
1119
1120/************************************************************************/
1125{
1127 gchar *str1, *str2;
1128 int i;
1129
1130 gtk_tree_model_get(model, a, col, &str1, -1);
1131 gtk_tree_model_get(model, b, col, &str2, -1);
1132
1134 g_free(str1);
1135 g_free(str2);
1136 return i;
1137}
1138
1139/************************************************************************/
1143{
1144 static char **titles;
1145 static char (*buf)[128];
1146 struct city_report_spec *spec;
1147 GtkWidget *w, *sw, *menubar;
1148 int i;
1149
1152
1154
1157
1158 /* menubar */
1161
1162 /* buttons */
1169
1171 _("_Buy"), CITY_BUY);
1172 city_buy_command = w;
1173
1175 _("_Inspect"), CITY_POPUP);
1177
1179 _("Cen_ter"), CITY_CENTER);
1181
1184
1185 /* tree view */
1186 buf = fc_realloc(buf, NUM_CREPORT_COLS * sizeof(buf[0]));
1188 for (i = 0; i < NUM_CREPORT_COLS; i++) {
1189 titles[i] = buf[i];
1190 }
1191 get_city_table_header(titles, sizeof(buf[0]));
1192
1194
1199 gtk_widget_set_name(city_view, "small_font");
1200 g_signal_connect(city_view, "row_activated",
1206
1207 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
1208 GtkWidget *header;
1209 GtkCellRenderer *renderer;
1211
1212 renderer = gtk_cell_renderer_text_new();
1214 "text", i, NULL);
1215 header = gtk_label_new(titles[i]);
1217 gtk_widget_show(header);
1222 g_object_set_data(G_OBJECT(col), "city_report_spec", spec);
1226 NULL);
1227 }
1228
1235
1237
1240
1242}
1243
1244/************************************************************************/
1251
1252/************************************************************************/
1259
1260/************************************************************************/
1264{
1265 ITree it;
1267
1268 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1271 } else {
1273 }
1274 }
1275}
1276
1277/************************************************************************/
1281{
1282 ITree it;
1284
1286
1287 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1288 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1289
1290 if (pcity != NULL
1293 }
1294 }
1295}
1296
1297/************************************************************************/
1301 GtkTreeIter *iter, gpointer data)
1302{
1303 struct city *selected_pcity = city_model_get(model, iter);
1304 ITree it;
1305
1306 if (NULL == selected_pcity) {
1307 return;
1308 }
1309
1310 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1311 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1312
1313 if (NULL != pcity
1314 && (tile_continent(pcity->tile)
1315 == tile_continent(selected_pcity->tile))) {
1317 }
1318 }
1319}
1320
1321/************************************************************************/
1328
1329/************************************************************************/
1333{
1335 ITree it;
1337
1339
1340 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1341 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1342
1343 if (NULL != pcity
1344 && ((which == PCT_UNIT && VUT_UTYPE == pcity->production.kind)
1346 && VUT_IMPROVEMENT == pcity->production.kind
1347 && !is_wonder(pcity->production.value.building))
1348 || (which == PCT_WONDER
1349 && VUT_IMPROVEMENT == pcity->production.kind
1350 && is_wonder(pcity->production.value.building)))) {
1352 }
1353 }
1354}
1355
1356/************************************************************************/
1359static void buy_iterate(GtkTreeModel *model, GtkTreePath *path,
1360 GtkTreeIter *iter, gpointer data)
1361{
1362 struct city *pcity = city_model_get(model, iter);
1363
1364 if (NULL != pcity) {
1365 cityrep_buy(pcity);
1366 }
1367}
1368
1369/************************************************************************/
1372static void center_iterate(GtkTreeModel *model, GtkTreePath *path,
1373 GtkTreeIter *iter, gpointer data)
1374{
1375 struct city *pcity = city_model_get(model, iter);
1376
1377 if (NULL != pcity) {
1379 }
1380}
1381
1382/************************************************************************/
1385static void popup_iterate(GtkTreeModel *model, GtkTreePath *path,
1386 GtkTreeIter *iter, gpointer data)
1387{
1388 struct city *pcity = city_model_get(model, iter);
1389
1390 if (NULL != pcity) {
1393 }
1394 popup_city_dialog(pcity);
1395 }
1396}
1397
1398/************************************************************************/
1401static void city_command_callback(struct gui_dialog *dlg, int response,
1402 gpointer data)
1403{
1404 switch (response) {
1405 case CITY_CENTER:
1407 /* Center to city doesn't make sense if many city are selected. */
1409 NULL);
1410 }
1411 break;
1412 case CITY_POPUP:
1414 break;
1415 case CITY_BUY:
1417 break;
1418 default:
1419 gui_dialog_destroy(dlg);
1420 break;
1421 }
1422}
1423
1424/************************************************************************/
1429{
1430 GtkTreeModel *model;
1432 GdkWindow *win;
1433 GdkSeat *seat;
1435
1437
1438 if (!gtk_tree_model_get_iter(model, &iter, path)) {
1439 return;
1440 }
1441
1444
1446 NULL, NULL, &mask);
1447
1448 if (!(mask & GDK_CONTROL_MASK)) {
1449 popup_iterate(model, path, &iter, NULL);
1450 } else {
1451 center_iterate(model, path, &iter, NULL);
1452 }
1453}
1454
1455/************************************************************************/
1459{
1460 GHashTable *selected;
1461 ITree iter;
1462 gint city_id;
1463
1464 if (NULL == city_dialog_shell) {
1465 return;
1466 }
1467
1468 /* Save the selection. */
1469 selected = g_hash_table_new(NULL, NULL);
1471 !itree_end(&iter); itree_next(&iter)) {
1473 itree_get(&iter, CRD_COL_CITY_ID, &city_id, -1);
1474 g_hash_table_insert(selected, GINT_TO_POINTER(city_id), NULL);
1475 }
1476 }
1477
1478 /* Update and restore the selection. */
1481 g_hash_table_destroy(selected);
1482
1485 }
1486
1488}
1489
1490/************************************************************************/
1494{
1496
1497 if (NULL == city_dialog_shell) {
1498 return;
1499 }
1500
1503 }
1504 city_model_set(city_model, &iter, pcity);
1505
1507}
1508
1509/************************************************************************/
1527
1528/************************************************************************/
1546
1547/************************************************************************/
1565
1566/************************************************************************/
1584
1585/************************************************************************/
1609
1610/************************************************************************/
1614{
1615 GtkWidget *menu;
1616
1617 menu = gtk_menu_new();
1619}
1620
1621/************************************************************************/
1643
1644/************************************************************************/
1666
1667/************************************************************************/
1689
1690/************************************************************************/
1712
1713/************************************************************************/
1743
1744/************************************************************************/
1770
1771/************************************************************************/
1775{
1776 GtkWidget *menu;
1777
1778 menu = gtk_menu_new();
1781
1782 item = gtk_menu_item_new_with_label(_("All Cities"));
1784 g_signal_connect(item, "activate",
1786
1787 item = gtk_menu_item_new_with_label(_("No Cities"));
1789 g_signal_connect(item, "activate",
1791
1792 item = gtk_menu_item_new_with_label(_("Invert Selection"));
1794 g_signal_connect(item, "activate",
1796
1797
1800
1801
1802 item = gtk_menu_item_new_with_label(_("Building Units"));
1804 g_signal_connect(item, "activate",
1807
1808 item = gtk_menu_item_new_with_label( _("Building Improvements"));
1810 g_signal_connect(item, "activate",
1813
1814 item = gtk_menu_item_new_with_label(_("Building Wonders"));
1816 g_signal_connect(item, "activate",
1819
1820
1823
1824
1826 gtk_menu_item_new_with_label(_("Building Unit"));
1828
1830 gtk_menu_item_new_with_label( _("Building Improvement"));
1832
1834 gtk_menu_item_new_with_label(_("Building Wonder"));
1836
1837
1840
1841
1842 item = gtk_menu_item_new_with_label(_("Coastal Cities"));
1844 g_signal_connect(item, "activate",
1846
1851
1852
1855
1856
1859
1862
1864 gtk_menu_item_new_with_label(_("Improvements in City"));
1866
1868 gtk_menu_item_new_with_label(_("Wonders in City"));
1870
1871
1874
1875
1877 gtk_menu_item_new_with_label(_("Available Units"));
1880 gtk_menu_item_new_with_label(_("Available Improvements"));
1883 gtk_menu_item_new_with_label(_("Available Wonders"));
1886 gtk_menu_item_new_with_label(_("Citizen Governor"));
1888}
1889
1890/************************************************************************/
1893static bool city_building_impr_or_unit(const struct city *pcity,
1894 const struct universal *target)
1895{
1896 return are_universals_equal(&pcity->production, target);
1897}
1898
1899/************************************************************************/
1903{
1904 int n;
1905
1907 return;
1908
1911
1913 TRUE, FALSE, CO_NONE,
1921 FALSE, TRUE, CO_NONE,
1924
1926 TRUE, FALSE, CO_NONE,
1930 TRUE, FALSE, CO_NONE,
1938 FALSE, TRUE, CO_NONE,
1941
1947 TRUE, FALSE, CO_NONE,
1951 FALSE, TRUE, CO_NONE,
1955
1957}
1958
1959/************************************************************************/
1963static void update_total_buy_cost(void)
1964{
1965 GtkWidget *label, *view;
1966 GList *rows, *p;
1967 GtkTreeModel *model;
1969 GtkTreePath *path;
1971 struct city *pcity;
1972 int total = 0;
1973
1974 view = city_view;
1976
1977 if (!view || !label) {
1978 return;
1979 }
1980
1983
1984 for (p = rows; p != NULL; p = p->next) {
1985 path = p->data;
1986 if (gtk_tree_model_get_iter(model, &iter, path)) {
1987 if ((pcity = city_model_get(model, &iter))) {
1988 total += pcity->client.buy_cost;
1989 }
1990 }
1991 gtk_tree_path_free(path);
1992 }
1994
1995 if (total > 0) {
1996 gchar *buf = g_strdup_printf(_("Total Buy Cost: %d"), total);
1997
1999 g_free(buf);
2000 } else {
2002 }
2003}
2004
2005/************************************************************************/
2031
2032/************************************************************************/
2036 GtkTreePath *path,
2038 gpointer data)
2039{
2040 struct city *pcity = city_model_get(model, iter);
2041
2042 if (NULL != pcity) {
2043 struct worklist empty;
2044
2046 city_set_worklist(pcity, &empty);
2047 }
2048}
2049
2050/************************************************************************/
2064
2065/************************************************************************/
2071{
2072 ITree it;
2073 GtkTreeModel *model;
2074
2075 if (!city_dialog_shell) return;
2076
2077 model = GTK_TREE_MODEL(city_model);
2078
2080
2081 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
2082 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
2083
2084 if (NULL != pcity && is_city_hilited(pcity)) {
2086 }
2087 }
2088}
2089
2090/************************************************************************/
2093void toggle_city_hilite(struct city *pcity, bool on_off)
2094{
2096
2097 if (NULL == city_dialog_shell) {
2098 return;
2099 }
2100
2102 if (on_off) {
2104 } else {
2106 }
2107 }
2108}
#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:857
static GtkWidget * select_wonders_item
Definition cityrep.c:159
static void create_city_report_dialog(bool make_modal)
Definition cityrep.c:1142
static GtkWidget * next_to_last_wonders_item
Definition cityrep.c:144
static GtkWidget * city_governor_command
Definition cityrep.c:122
static void city_invert_selection_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1263
static GtkWidget * city_popup_command
Definition cityrep.c:119
static GtkWidget * select_cma_item
Definition cityrep.c:160
static void worklist_next_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:513
static GtkWidget * last_wonders_item
Definition cityrep.c:132
static void create_first_menu(GtkWidget *item)
Definition cityrep.c:1550
static void create_next_to_last_menu(GtkWidget *item)
Definition cityrep.c:1588
static GtkWidget * city_total_buy_cost_label
Definition cityrep.c:124
static GtkWidget * city_buy_command
Definition cityrep.c:120
static void update_total_buy_cost(void)
Definition cityrep.c:1963
static GtkWidget * change_units_item
Definition cityrep.c:127
void real_city_report_dialog_update(void *unused)
Definition cityrep.c:1458
#define CRD_COL_CITY_ID
Definition cityrep.c:107
static GtkWidget * last_units_item
Definition cityrep.c:131
static void popup_next_to_last_menu(GtkMenuShell *menu, gpointer data)
Definition cityrep.c:1716
void real_city_report_update_city(struct city *pcity)
Definition cityrep.c:1493
static void create_next_menu(GtkWidget *item)
Definition cityrep.c:1569
static void city_select_building_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1332
static void popup_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1385
static void create_select_menu(GtkWidget *item)
Definition cityrep.c:1774
static void city_activated_callback(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data)
Definition cityrep.c:1427
static void select_impr_or_unit_callback(GtkWidget *wdg, gpointer data)
Definition cityrep.c:567
static void impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:456
static GtkWidget * select_improvements_item
Definition cityrep.c:157
static void city_model_fill(GtkListStore *store, GtkTreeSelection *selection, GHashTable *select)
Definition cityrep.c:262
static void center_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1372
void toggle_city_hilite(struct city *pcity, bool on_off)
Definition cityrep.c:2093
static bool city_building_impr_or_unit(const struct city *pcity, const struct universal *target)
Definition cityrep.c:1893
static GtkWidget * select_supported_item
Definition cityrep.c:152
static GtkWidget * select_bimprovement_item
Definition cityrep.c:149
#define CMA_NONE
Definition cityrep.c:64
static GtkWidget * select_units_item
Definition cityrep.c:158
static GtkWidget * select_island_item
Definition cityrep.c:146
static gint cityrep_sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer data)
Definition cityrep.c:1123
static GtkWidget * change_improvements_item
Definition cityrep.c:126
static struct city * city_model_get(GtkTreeModel *model, GtkTreeIter *iter)
Definition cityrep.c:226
static void append_impr_or_unit_to_menu_item(GtkMenuItem *parent_item, bool append_units, bool append_wonders, enum city_operation_type city_operation, TestCityFunc test_func, GCallback callback, int size)
Definition cityrep.c:322
static void city_select_coastal_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1280
static void production_menu_shown(GtkWidget *widget, gpointer data)
Definition cityrep.c:936
static void popup_select_menu(GtkMenuShell *menu, gpointer data)
Definition cityrep.c:1902
static void popup_first_menu(GtkMenuShell *menu, gpointer data)
Definition cityrep.c:1670
static void city_command_callback(struct gui_dialog *dlg, int response, gpointer data)
Definition cityrep.c:1401
static void city_model_set(GtkListStore *store, GtkTreeIter *iter, struct city *pcity)
Definition cityrep.c:207
static GtkWidget * last_improvements_item
Definition cityrep.c:130
static void city_clear_worklist_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:2053
static GtkListStore * city_model
Definition cityrep.c:106
static void clear_worklist_foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:2035
static GtkWidget * city_sell_command
Definition cityrep.c:123
static void append_cma_to_menu_item(GtkMenuItem *parent_item, bool change_cma)
Definition cityrep.c:751
static GtkWidget * select_bwonder_item
Definition cityrep.c:150
#define NEG_VAL(x)
Definition cityrep.c:61
static void city_select_all_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1247
#define CMA_CUSTOM
Definition cityrep.c:65
static void popup_last_menu(GtkMenuShell *menu, gpointer data)
Definition cityrep.c:1647
static void sell_impr_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:548
static GtkTreeSelection * city_selection
Definition cityrep.c:105
static void create_last_menu(GtkWidget *item)
Definition cityrep.c:1531
static void same_island_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1300
static GtkWidget * change_wonders_item
Definition cityrep.c:128
static GtkWidget * first_improvements_item
Definition cityrep.c:134
static void city_select_same_island_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1324
static GtkWidget * select_built_wonders_item
Definition cityrep.c:155
static void set_worklist_callback(GtkMenuItem *menuitem, gpointer data)
Definition cityrep.c:913
static void city_selection_changed_callback(GtkTreeSelection *selection)
Definition cityrep.c:2009
static gboolean city_model_find(GtkTreeModel *model, GtkTreeIter *iter, const struct city *pcity)
Definition cityrep.c:242
static void worklist_next_to_last_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:532
static GtkWidget * next_to_last_units_item
Definition cityrep.c:143
static GtkWidget * next_to_last_improvements_item
Definition cityrep.c:142
static GtkWidget * city_production_command
Definition cityrep.c:121
static GtkListStore * city_report_dialog_store_new(void)
Definition cityrep.c:188
static int city_dialog_shell_is_modal
Definition cityrep.c:162
static GtkWidget * create_city_report_menubar(void)
Definition cityrep.c:1040
static void city_report_update_views(void)
Definition cityrep.c:986
static void get_city_table_header(char **text, int n)
Definition cityrep.c:169
static GtkWidget * select_bunit_item
Definition cityrep.c:148
@ 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:2070
void city_report_dialog_popdown(void)
Definition cityrep.c:312
static void create_sell_menu(GtkWidget *item)
Definition cityrep.c:1613
void city_report_dialog_popup(bool raise)
Definition cityrep.c:292
static GtkWidget * city_view
Definition cityrep.c:104
static GtkWidget * select_present_item
Definition cityrep.c:153
static void update_view_menu(GtkWidget *show_item)
Definition cityrep.c:1021
static GtkWidget * select_built_improvements_item
Definition cityrep.c:154
static struct gui_dialog * city_dialog_shell
Definition cityrep.c:98
static void worklist_first_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:493
static GtkWidget * next_improvements_item
Definition cityrep.c:138
static void popup_change_menu(GtkMenuShell *menu, gpointer data)
Definition cityrep.c:1624
static void cma_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:674
static void set_worklist_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:896
static void toggle_view(GtkCheckMenuItem *item, gpointer data)
Definition cityrep.c:1010
static void append_worklist_callback(GtkMenuItem *menuitem, gpointer data)
Definition cityrep.c:875
static void city_unselect_all_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1255
static void popup_next_menu(GtkMenuShell *menu, gpointer data)
Definition cityrep.c:1693
static void worklist_last_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:472
static GtkWidget * next_wonders_item
Definition cityrep.c:140
static GtkWidget * first_units_item
Definition cityrep.c:135
static GtkWidget * next_units_item
Definition cityrep.c:139
static GtkWidget * first_wonders_item
Definition cityrep.c:136
static GtkWidget * city_center_command
Definition cityrep.c:118
static void buy_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1359
bool select_menu_cached
Definition cityrep.c:164
city_operation_type
Definition cityrep.c:73
@ CO_SELL
Definition cityrep.c:74
@ CO_NEXT_TO_LAST
Definition cityrep.c:74
@ CO_NEXT
Definition cityrep.c:74
@ CO_CHANGE
Definition cityrep.c:74
@ CO_FIRST
Definition cityrep.c:74
@ CO_LAST
Definition cityrep.c:74
@ CO_NONE
Definition cityrep.c:74
static void recreate_sell_menu(void)
Definition cityrep.c:1747
static void create_change_menu(GtkWidget *item)
Definition cityrep.c:1512
static void select_cma_callback(GtkWidget *w, gpointer data)
Definition cityrep.c:694
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 gui_dialog_set_default_response(struct gui_dialog *dlg, int response)
Definition gui_stuff.c:734
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
GtkWidget * gui_dialog_add_widget(struct gui_dialog *dlg, GtkWidget *widget)
Definition gui_stuff.c:722
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 * gtk_aux_menu_bar_new(void)
Definition gui_stuff.c:255
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
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(condition)
Definition log.h:176
#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:71
struct city_list * cities
Definition packhand.c:119
bool are_universals_equal(const struct universal *psource1, const struct universal *psource2)
#define ARRAY_SIZE(x)
Definition shared.h:85
size_t size
Definition specvec.h:72
struct sprite int int int int struct sprite * mask
Definition sprite_g.h:32
const char *(* func)(const struct city *pcity, const void *data)
Definition cityrepdata.h:34
const char * title2
Definition cityrepdata.h:31
const char * explanation
Definition cityrepdata.h:32
const char * title1
Definition cityrepdata.h:30
Definition city.h: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
GtkWidget * vbox
Definition gui_stuff.h:72
GtkWidget * action_area
Definition gui_stuff.h:73
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