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
164/************************************************************************/
167static void get_city_table_header(char **text, int n)
168{
169 struct city_report_spec *spec;
170 int i;
171
172 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
173 fc_snprintf(text[i], n, "%*s\n%*s",
174 NEG_VAL(spec->width), spec->title1 ? spec->title1 : "",
175 NEG_VAL(spec->width), spec->title2 ? spec->title2 : "");
176 }
177}
178
179/****************************************************************************
180 CITY REPORT DIALOG
181****************************************************************************/
182
183/************************************************************************/
187{
189 gint i;
190
191 /* City report data. */
192 for (i = 0; i < NUM_CREPORT_COLS; i++) {
194 }
195
196 /* Specific gtk client data. */
197 model_types[i++] = G_TYPE_INT; /* CRD_COL_CITY_ID */
198
200}
201
202/************************************************************************/
206 struct city *pcity)
207{
208 struct city_report_spec *spec;
209 char buf[64];
210 gint i;
211
212 for (i = 0; i < NUM_CREPORT_COLS; i++) {
213 spec = city_report_specs + i;
214 fc_snprintf(buf, sizeof(buf), "%*s", NEG_VAL(spec->width),
215 spec->func(pcity, spec->data));
216 gtk_list_store_set(store, iter, i, buf, -1);
217 }
218 gtk_list_store_set(store, iter, CRD_COL_CITY_ID, pcity->id, -1);
219}
220
221/************************************************************************/
225{
226 struct city *pcity;
227 int id;
228
229 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
230 pcity = game_city_by_number(id);
231 return ((NULL != pcity
233 && city_owner(pcity) != client_player())
234 ? NULL : pcity);
235}
236
237/************************************************************************/
241 const struct city *pcity)
242{
243 const int searched = pcity->id;
244 int id;
245
247 do {
248 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
249 if (searched == id) {
250 return TRUE;
251 }
252 } while (gtk_tree_model_iter_next(model, iter));
253 }
254 return FALSE;
255}
256
257/************************************************************************/
260static void city_model_fill(GtkListStore *store,
261 GtkTreeSelection *selection, GHashTable *select)
262{
264
265 if (client_has_player()) {
268 city_model_set(store, &iter, pcity);
269 if (NULL != select
270 && g_hash_table_remove(select, GINT_TO_POINTER(pcity->id))) {
272 }
274 } else {
275 /* Global observer case. */
276 cities_iterate(pcity) {
278 city_model_set(store, &iter, pcity);
279 if (NULL != select
280 && g_hash_table_remove(select, GINT_TO_POINTER(pcity->id))) {
282 }
284 }
285}
286
287/************************************************************************/
304
305/************************************************************************/
314
315/************************************************************************/
319 bool append_units,
320 bool append_wonders,
325 int size)
326{
327 GtkWidget *menu;
329 struct item items[MAX_NUM_PRODUCTION_TARGETS];
330 int i, item, targets_used;
331 char *row[4];
332 char buf[4][64];
333
334 GtkSizeGroup *group[3];
335 const char *markup[3] = {
336 "weight=\"bold\"",
337 "",
338 ""
339 };
340
341 menu = gtk_menu_new();
343
344 if (city_operation != CO_NONE) {
345 GPtrArray *selected;
346 ITree it;
347 int num_selected = 0;
349 struct city **data;
350
351 selected = g_ptr_array_sized_new(size);
352
353 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
354 struct city *pcity;
355
357 || !(pcity = city_model_get(model, TREE_ITER_PTR(it)))) {
358 continue;
359 }
360
361 g_ptr_array_add(selected, pcity);
362 num_selected++;
363 }
364
365 data = (struct city **)g_ptr_array_free(selected, FALSE);
369 g_free(data);
370 } else {
373 test_func);
374 }
375
376 name_and_sort_items(targets, targets_used, items,
378
379 for (i = 0; i < 4; i++) {
380 row[i] = buf[i];
381 }
382
383 g_object_set_data(G_OBJECT(menu), "freeciv_test_func", test_func);
384 g_object_set_data(G_OBJECT(menu), "freeciv_city_operation",
386
387 for (i = 0; i < 3; i++) {
389 }
390
391 for (item = 0; item < targets_used; item++) {
392 struct universal target = items[item].item;
393 GtkWidget *menu_item, *hbox, *label;
394 char txt[256];
395
396 get_city_dialog_production_row(row, sizeof(buf[0]), &target, NULL);
397
399 hbox = gtk_grid_new();
402
403 for (i = 0; i < 3; i++) {
404 if (row[i][0] == '\0') {
405 continue;
406 }
407
408 if (city_operation == CO_SELL && i != 0) {
409 continue;
410 }
411
412 fc_snprintf(txt, ARRAY_SIZE(txt), "<span %s>%s</span>",
413 markup[i], row[i]);
414
415 label = gtk_label_new(NULL);
417
418 switch (i) {
419 case 0:
422 break;
423 case 2:
426 break;
427 default:
428 break;
429 }
430
432 gtk_size_group_add_widget(group[i], label);
433 }
434
437 GINT_TO_POINTER(cid_encode(target)));
438 }
439
440 for (i = 0; i < 3; i++) {
441 g_object_unref(group[i]);
442 }
443
445
447}
448
449/************************************************************************/
454{
455 struct universal target = cid_decode(GPOINTER_TO_INT(data));
456 struct city *pcity = city_model_get(model, iter);
457
458 if (NULL != pcity) {
459 city_change_production(pcity, &target);
460 }
461}
462
463/************************************************************************/
469 GtkTreePath *path,
471 gpointer data)
472{
473 struct universal target = cid_decode(GPOINTER_TO_INT(data));
474 struct city *pcity = city_model_get(model, iter);
475
476 if (NULL != pcity) {
477 (void) city_queue_insert(pcity, -1, &target);
478 }
479 /* perhaps should warn the user if not successful? */
480}
481
482/************************************************************************/
490 GtkTreePath *path,
492 gpointer data)
493{
494 struct universal target = cid_decode(GPOINTER_TO_INT(data));
495 struct city *pcity = city_model_get(model, iter);
496
497 if (NULL != pcity) {
498 (void) city_queue_insert(pcity, 0, &target);
499 }
500 /* perhaps should warn the user if not successful? */
501}
502
503/************************************************************************/
510 GtkTreePath *path,
512 gpointer data)
513{
514 struct universal target = cid_decode(GPOINTER_TO_INT(data));
515 struct city *pcity = city_model_get(model, iter);
516
517 if (NULL != pcity) {
518 (void) city_queue_insert(pcity, 1, &target);
519 }
520 /* perhaps should warn the user if not successful? */
521}
522
523/************************************************************************/
529 GtkTreePath *path,
531 gpointer data)
532{
533 struct universal target = cid_decode(GPOINTER_TO_INT(data));
534 struct city *pcity = city_model_get(model, iter);
535
536 if (NULL != pcity) {
537 city_queue_insert(pcity, worklist_length(&pcity->worklist), &target);
538 }
539}
540
541/************************************************************************/
546{
547 struct sell_data *sd = (struct sell_data *) data;
548 struct city *pcity = city_model_get(model, iter);
549
550 if (NULL != pcity
551 && !pcity->did_sell
552 && city_has_building(pcity, sd->target)) {
553 sd->count++;
554 sd->gold += impr_sell_gold(sd->target);
556 }
557}
558
559/************************************************************************/
564{
565 struct universal target = cid_decode(GPOINTER_TO_INT(data));
567 TestCityFunc test_func = g_object_get_data(parent, "freeciv_test_func");
569 GPOINTER_TO_INT(g_object_get_data(parent, "freeciv_city_operation"));
570
571 /* if this is not a city operation: */
572 if (city_operation == CO_NONE) {
574 ITree it;
575
577 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
578 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
579
580 if (NULL != pcity && test_func(pcity, &target)) {
582 }
583 }
584 } else {
586
588 switch (city_operation) {
589 case CO_LAST:
592 GINT_TO_POINTER(cid_encode(target)));
593 break;
594 case CO_CHANGE:
597 GINT_TO_POINTER(cid_encode(target)));
598 break;
599 case CO_FIRST:
602 GINT_TO_POINTER(cid_encode(target)));
603 break;
604 case CO_NEXT:
607 GINT_TO_POINTER(cid_encode(target)));
608 break;
609 case CO_NEXT_TO_LAST:
612 GINT_TO_POINTER(cid_encode(target)));
613 break;
614 case CO_SELL:
615 fc_assert_action(target.kind == VUT_IMPROVEMENT, break);
616 {
617 const struct impr_type *building = target.value.building;
618 struct sell_data sd = { 0, 0, building };
619 GtkWidget *w;
620 gint res;
621 gchar *buf;
622 const char *imprname = improvement_name_translation(building);
623
624 /* Ask confirmation */
625 buf = g_strdup_printf(_("Are you sure you want to sell those %s?"), imprname);
628 GTK_BUTTONS_YES_NO, "%s", buf);
629 g_free(buf);
630 res = gtk_dialog_run(GTK_DIALOG(w)); /* Synchron. */
632 if (res == GTK_RESPONSE_NO) {
633 break;
634 }
635
638 if (sd.count > 0) {
639 /* FIXME: plurality of sd.count is ignored! */
640 /* TRANS: "Sold 3 Harbor for 90 gold." (Pluralisation is in gold --
641 * second %d -- not in buildings.) */
644 PL_("Sold %d %s for %d gold.",
645 "Sold %d %s for %d gold.",
646 sd.gold),
647 sd.count, imprname, sd.gold);
648 } else {
651 _("No %s could be sold."),
652 imprname);
653 }
654
655 g_signal_connect(w, "response",
657 gtk_window_present(GTK_WINDOW(w)); /* Asynchron. */
658 }
659 break;
660 case CO_NONE:
661 break;
662 }
664 }
665}
666
667/************************************************************************/
670static void cma_iterate(GtkTreeModel *model, GtkTreePath *path,
672{
673 struct city *pcity = city_model_get(model, iter);
674 int idx = GPOINTER_TO_INT(data);
675
676 if (NULL != pcity) {
677 if (CMA_NONE == idx) {
678 cma_release_city(pcity);
679 } else {
681 }
682 refresh_city_dialog(pcity);
683 }
684}
685
686/************************************************************************/
691{
692 int idx = GPOINTER_TO_INT(data);
694 bool change_cma =
695 GPOINTER_TO_INT(g_object_get_data(parent, "freeciv_change_cma"));
696 struct cm_parameter parameter;
697
698 /* If this is not the change button but the select cities button. */
699 if (!change_cma) {
700 ITree it;
702
704 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
705 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
706 int controlled;
707 bool select;
708
709 if (NULL == pcity) {
710 continue;
711 }
712 controlled = cma_is_city_under_agent(pcity, &parameter);
713 select = FALSE;
714
715 if (idx == CMA_NONE) {
716 /* CMA_NONE selects not-controlled, all others require controlled */
717 if (!controlled) {
718 select = TRUE;
719 }
720 } else if (controlled) {
721 if (idx == CMA_CUSTOM) {
722 if (cmafec_preset_get_index_of_parameter(&parameter) == -1) {
723 select = TRUE;
724 }
725 } else if (cm_are_parameter_equal(&parameter,
727 select = TRUE;
728 }
729 }
730
731 if (select) {
733 }
734 }
735 } else {
738 }
739}
740
741/************************************************************************/
748{
749 GtkWidget *menu;
750 int i;
751 struct cm_parameter parameter;
752 GtkWidget *w;
753
755 if (w != NULL && gtk_widget_get_visible(w)) {
756 return;
757 }
758
761 return;
762 }
763 menu = gtk_menu_new();
765
766 if (change_cma) {
767 w = gtk_menu_item_new_with_label(Q_("?cma:none"));
772
773 for (i = 0; i < cmafec_preset_num(); i++) {
779 }
780 } else {
781 /* Search for a "none" */
782 int found;
783
784 found = 0;
786 if (!cma_is_city_under_agent(pcity, NULL)) {
787 found = 1;
788 break;
789 }
791
792 if (found) {
793 w = gtk_menu_item_new_with_label(Q_("?cma:none"));
797 }
798
799 /*
800 * Search for a city that's under custom (not preset) agent. Might
801 * take a lonnggg time.
802 */
803 found = 0;
805 if (cma_is_city_under_agent(pcity, &parameter)
806 && cmafec_preset_get_index_of_parameter(&parameter) == -1) {
807 found = 1;
808 break;
809 }
811
812 if (found) {
813 /* We found city that's under agent but not a preset */
814 w = gtk_menu_item_new_with_label(Q_("?cma:custom"));
815
817 g_signal_connect(w, "activate",
820 }
821
822 /* Only fill in presets that are being used. */
823 for (i = 0; i < cmafec_preset_num(); i++) {
824 found = 0;
826 if (cma_is_city_under_agent(pcity, &parameter)
827 && cm_are_parameter_equal(&parameter,
829 found = 1;
830 break;
831 }
833 if (found) {
835
837 g_signal_connect(w, "activate",
839 }
840 }
841 }
842
843 g_object_set_data(G_OBJECT(menu), "freeciv_change_cma",
846}
847
848/************************************************************************/
855{
856 const struct worklist *pwl = data;
857 struct city *pcity = city_model_get(model, iter);
858
860
861 if (NULL != pcity) {
863 }
864}
865
866/************************************************************************/
872{
873 struct global_worklist *pgwl =
875
877
878 if (!pgwl) {
879 /* Maybe removed by an other way, not an error. */
880 return;
881 }
882
886}
887
888/************************************************************************/
894{
895 const struct worklist *pwl = data;
896 struct city *pcity = city_model_get(model, iter);
897
899
900 if (NULL != pcity) {
901 city_set_queue(pcity, pwl);
902 }
903}
904
905/************************************************************************/
927
928/************************************************************************/
933{
934 GtkWidget *menu, *item;
937 int count = 0;
938
939 parent_item = data;
942
943 callback = g_object_get_data(G_OBJECT(parent_item), "item_callback");
945
947 if (menu != NULL && gtk_widget_get_visible(menu)) {
949 }
950
951 if (menu == NULL) {
952 menu = gtk_menu_new();
954 }
955
957 return;
958 }
959
962
966 g_signal_connect(item, "activate", callback,
968 count++;
970
971 if (count == 0) {
972 item = gtk_menu_item_new_with_label(_("(no worklists defined)"));
974 }
975
977}
978
979/************************************************************************/
983{
984 struct city_report_spec *spec;
987 GList *columns, *p;
988
991
993
994 for (p = columns; p != NULL; p = p->next) {
995 col = p->data;
996 spec = g_object_get_data(G_OBJECT(col), "city_report_spec");
998 }
999
1001}
1002
1003/************************************************************************/
1007{
1008 struct city_report_spec *spec = data;
1009
1010 spec->show ^= 1;
1012}
1013
1014/************************************************************************/
1018{
1019 GtkWidget *menu, *item;
1020 struct city_report_spec *spec;
1021 int i;
1022
1023 menu = gtk_menu_new();
1024 for (i = 0, spec = city_report_specs + i; i < NUM_CREPORT_COLS; i++, spec++) {
1029 }
1031}
1032
1033/************************************************************************/
1037{
1038 GtkWidget *vbox, *sep, *menubar, *menu, *item;
1039
1040 vbox = gtk_grid_new();
1045
1048
1049 item = gtk_menu_item_new_with_mnemonic(_("_Production"));
1052
1053 menu = gtk_menu_new();
1055
1059
1060 item = gtk_menu_item_new_with_mnemonic(_("Add _First"));
1063
1064 item = gtk_menu_item_new_with_mnemonic(_("Add _Next"));
1067
1068 item = gtk_menu_item_new_with_mnemonic(_("Add _2nd Last"));
1071
1072 item = gtk_menu_item_new_with_mnemonic(_("Add _Last"));
1075
1078
1079 item = gtk_menu_item_new_with_label(_("Set Worklist"));
1081 g_object_set_data(G_OBJECT(item), "item_callback",
1084
1085 item = gtk_menu_item_new_with_label(_("Append Worklist"));
1087 g_object_set_data(G_OBJECT(item), "item_callback",
1090
1091 item = gtk_menu_item_new_with_mnemonic(_("Clear _Worklist"));
1093 g_signal_connect(item, "activate",
1095
1096 item = gtk_menu_item_new_with_mnemonic(_("Gover_nor"));
1100
1105
1109
1110 item = gtk_menu_item_new_with_mnemonic(_("_Display"));
1113 return vbox;
1114}
1115
1116/************************************************************************/
1121{
1123 gchar *str1, *str2;
1124 int i;
1125
1126 gtk_tree_model_get(model, a, col, &str1, -1);
1127 gtk_tree_model_get(model, b, col, &str2, -1);
1128
1130 g_free(str1);
1131 g_free(str2);
1132 return i;
1133}
1134
1135/************************************************************************/
1139{
1140 static char **titles;
1141 static char (*buf)[128];
1142 struct city_report_spec *spec;
1143 GtkWidget *w, *sw, *menubar;
1144 int i;
1145
1148
1150
1153
1154 /* menubar */
1157
1158 /* buttons */
1165
1167 _("_Buy"), CITY_BUY);
1168 city_buy_command = w;
1169
1171 _("_Inspect"), CITY_POPUP);
1173
1175 _("Cen_ter"), CITY_CENTER);
1177
1180
1181 /* tree view */
1182 buf = fc_realloc(buf, NUM_CREPORT_COLS * sizeof(buf[0]));
1184 for (i = 0; i < NUM_CREPORT_COLS; i++) {
1185 titles[i] = buf[i];
1186 }
1187 get_city_table_header(titles, sizeof(buf[0]));
1188
1190
1195 gtk_widget_set_name(city_view, "small_font");
1196 g_signal_connect(city_view, "row_activated",
1202
1203 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
1204 GtkWidget *header;
1205 GtkCellRenderer *renderer;
1207
1208 renderer = gtk_cell_renderer_text_new();
1210 "text", i, NULL);
1211 header = gtk_label_new(titles[i]);
1213 gtk_widget_show(header);
1218 g_object_set_data(G_OBJECT(col), "city_report_spec", spec);
1222 NULL);
1223 }
1224
1231
1233
1236
1238}
1239
1240/************************************************************************/
1247
1248/************************************************************************/
1255
1256/************************************************************************/
1260{
1261 ITree it;
1263
1264 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1267 } else {
1269 }
1270 }
1271}
1272
1273/************************************************************************/
1277{
1278 ITree it;
1280
1282
1283 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1284 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1285
1286 if (pcity != NULL
1289 }
1290 }
1291}
1292
1293/************************************************************************/
1297 GtkTreeIter *iter, gpointer data)
1298{
1299 struct city *selected_pcity = city_model_get(model, iter);
1300 ITree it;
1301
1302 if (NULL == selected_pcity) {
1303 return;
1304 }
1305
1306 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1307 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1308
1309 if (NULL != pcity
1310 && (tile_continent(pcity->tile)
1311 == tile_continent(selected_pcity->tile))) {
1313 }
1314 }
1315}
1316
1317/************************************************************************/
1324
1325/************************************************************************/
1329{
1331 ITree it;
1333
1335
1336 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1337 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1338
1339 if (NULL != pcity
1340 && ((which == PCT_UNIT && VUT_UTYPE == pcity->production.kind)
1342 && VUT_IMPROVEMENT == pcity->production.kind
1343 && !is_wonder(pcity->production.value.building))
1344 || (which == PCT_WONDER
1345 && VUT_IMPROVEMENT == pcity->production.kind
1346 && is_wonder(pcity->production.value.building)))) {
1348 }
1349 }
1350}
1351
1352/************************************************************************/
1355static void buy_iterate(GtkTreeModel *model, GtkTreePath *path,
1356 GtkTreeIter *iter, gpointer data)
1357{
1358 struct city *pcity = city_model_get(model, iter);
1359
1360 if (NULL != pcity) {
1361 cityrep_buy(pcity);
1362 }
1363}
1364
1365/************************************************************************/
1368static void center_iterate(GtkTreeModel *model, GtkTreePath *path,
1369 GtkTreeIter *iter, gpointer data)
1370{
1371 struct city *pcity = city_model_get(model, iter);
1372
1373 if (NULL != pcity) {
1375 }
1376}
1377
1378/************************************************************************/
1381static void popup_iterate(GtkTreeModel *model, GtkTreePath *path,
1382 GtkTreeIter *iter, gpointer data)
1383{
1384 struct city *pcity = city_model_get(model, iter);
1385
1386 if (NULL != pcity) {
1389 }
1390 popup_city_dialog(pcity);
1391 }
1392}
1393
1394/************************************************************************/
1397static void city_command_callback(struct gui_dialog *dlg, int response,
1398 gpointer data)
1399{
1400 switch (response) {
1401 case CITY_CENTER:
1403 /* Center to city doesn't make sense if many city are selected. */
1405 NULL);
1406 }
1407 break;
1408 case CITY_POPUP:
1410 break;
1411 case CITY_BUY:
1413 break;
1414 default:
1415 gui_dialog_destroy(dlg);
1416 break;
1417 }
1418}
1419
1420/************************************************************************/
1425{
1426 GtkTreeModel *model;
1428 GdkWindow *win;
1429 GdkSeat *seat;
1431
1433
1434 if (!gtk_tree_model_get_iter(model, &iter, path)) {
1435 return;
1436 }
1437
1440
1442 NULL, NULL, &mask);
1443
1444 if (!(mask & GDK_CONTROL_MASK)) {
1445 popup_iterate(model, path, &iter, NULL);
1446 } else {
1447 center_iterate(model, path, &iter, NULL);
1448 }
1449}
1450
1451/************************************************************************/
1455{
1456 GHashTable *selected;
1457 ITree iter;
1458 gint city_id;
1459
1460 if (NULL == city_dialog_shell) {
1461 return;
1462 }
1463
1464 /* Save the selection. */
1465 selected = g_hash_table_new(NULL, NULL);
1467 !itree_end(&iter); itree_next(&iter)) {
1469 itree_get(&iter, CRD_COL_CITY_ID, &city_id, -1);
1470 g_hash_table_insert(selected, GINT_TO_POINTER(city_id), NULL);
1471 }
1472 }
1473
1474 /* Update and restore the selection. */
1477 g_hash_table_destroy(selected);
1478
1481 }
1482
1484}
1485
1486/************************************************************************/
1490{
1492
1493 if (NULL == city_dialog_shell) {
1494 return;
1495 }
1496
1499 }
1500 city_model_set(city_model, &iter, pcity);
1501
1503}
1504
1505/************************************************************************/
1523
1524/************************************************************************/
1542
1543/************************************************************************/
1561
1562/************************************************************************/
1580
1581/************************************************************************/
1605
1606/************************************************************************/
1610{
1611 GtkWidget *menu;
1612
1613 menu = gtk_menu_new();
1615}
1616
1617/************************************************************************/
1639
1640/************************************************************************/
1662
1663/************************************************************************/
1685
1686/************************************************************************/
1708
1709/************************************************************************/
1739
1740/************************************************************************/
1766
1767/************************************************************************/
1771{
1772 GtkWidget *menu;
1773
1774 menu = gtk_menu_new();
1777
1778 item = gtk_menu_item_new_with_label(_("All Cities"));
1780 g_signal_connect(item, "activate",
1782
1783 item = gtk_menu_item_new_with_label(_("No Cities"));
1785 g_signal_connect(item, "activate",
1787
1788 item = gtk_menu_item_new_with_label(_("Invert Selection"));
1790 g_signal_connect(item, "activate",
1792
1793
1796
1797
1798 item = gtk_menu_item_new_with_label(_("Building Units"));
1800 g_signal_connect(item, "activate",
1803
1804 item = gtk_menu_item_new_with_label( _("Building Improvements"));
1806 g_signal_connect(item, "activate",
1809
1810 item = gtk_menu_item_new_with_label(_("Building Wonders"));
1812 g_signal_connect(item, "activate",
1815
1816
1819
1820
1822 gtk_menu_item_new_with_label(_("Building Unit"));
1824
1826 gtk_menu_item_new_with_label( _("Building Improvement"));
1828
1830 gtk_menu_item_new_with_label(_("Building Wonder"));
1832
1833
1836
1837
1838 item = gtk_menu_item_new_with_label(_("Coastal Cities"));
1840 g_signal_connect(item, "activate",
1842
1847
1848
1851
1852
1855
1858
1860 gtk_menu_item_new_with_label(_("Improvements in City"));
1862
1864 gtk_menu_item_new_with_label(_("Wonders in City"));
1866
1867
1870
1871
1873 gtk_menu_item_new_with_label(_("Available Units"));
1876 gtk_menu_item_new_with_label(_("Available Improvements"));
1879 gtk_menu_item_new_with_label(_("Available Wonders"));
1882 gtk_menu_item_new_with_label(_("Citizen Governor"));
1884}
1885
1886/************************************************************************/
1889static bool city_building_impr_or_unit(const struct city *pcity,
1890 const struct universal *target)
1891{
1892 return are_universals_equal(&pcity->production, target);
1893}
1894
1895/************************************************************************/
1899{
1900 int n;
1901
1903 return;
1904
1907
1909 TRUE, FALSE, CO_NONE,
1917 FALSE, TRUE, CO_NONE,
1920
1922 TRUE, FALSE, CO_NONE,
1926 TRUE, FALSE, CO_NONE,
1934 FALSE, TRUE, CO_NONE,
1937
1943 TRUE, FALSE, CO_NONE,
1947 FALSE, TRUE, CO_NONE,
1951
1953}
1954
1955/************************************************************************/
1959static void update_total_buy_cost(void)
1960{
1961 GtkWidget *label, *view;
1962 GList *rows, *p;
1963 GtkTreeModel *model;
1965 GtkTreePath *path;
1967 struct city *pcity;
1968 int total = 0;
1969
1970 view = city_view;
1972
1973 if (!view || !label) {
1974 return;
1975 }
1976
1979
1980 for (p = rows; p != NULL; p = p->next) {
1981 path = p->data;
1982 if (gtk_tree_model_get_iter(model, &iter, path)) {
1983 if ((pcity = city_model_get(model, &iter))) {
1984 total += pcity->client.buy_cost;
1985 }
1986 }
1987 gtk_tree_path_free(path);
1988 }
1990
1991 if (total > 0) {
1992 gchar *buf = g_strdup_printf(_("Total Buy Cost: %d"), total);
1993
1995 g_free(buf);
1996 } else {
1998 }
1999}
2000
2001/************************************************************************/
2027
2028/************************************************************************/
2032 GtkTreePath *path,
2034 gpointer data)
2035{
2036 struct city *pcity = city_model_get(model, iter);
2037
2038 if (NULL != pcity) {
2039 struct worklist empty;
2040
2042 city_set_worklist(pcity, &empty);
2043 }
2044}
2045
2046/************************************************************************/
2060
2061/************************************************************************/
2067{
2068 ITree it;
2069 GtkTreeModel *model;
2070
2071 if (!city_dialog_shell) return;
2072
2073 model = GTK_TREE_MODEL(city_model);
2074
2076
2077 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
2078 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
2079
2080 if (NULL != pcity && is_city_hilited(pcity)) {
2082 }
2083 }
2084}
2085
2086/************************************************************************/
2089void toggle_city_hilite(struct city *pcity, bool on_off)
2090{
2092
2093 if (NULL == city_dialog_shell) {
2094 return;
2095 }
2096
2098 if (on_off) {
2100 } else {
2102 }
2103 }
2104}
#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 GtkWidget * select_wonders_item
Definition cityrep.c:159
static void create_city_report_dialog(bool make_modal)
Definition cityrep.c:1138
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:1259
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:509
static GtkWidget * last_wonders_item
Definition cityrep.c:132
static void create_first_menu(GtkWidget *item)
Definition cityrep.c:1546
static void create_next_to_last_menu(GtkWidget *item)
Definition cityrep.c:1584
static GtkWidget * city_total_buy_cost_label
Definition cityrep.c:124
static GtkWidget * city_buy_command
Definition cityrep.c:120
static void update_total_buy_cost(void)
Definition cityrep.c:1959
static GtkWidget * change_units_item
Definition cityrep.c:127
void real_city_report_dialog_update(void *unused)
Definition cityrep.c:1454
#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:1712
void real_city_report_update_city(struct city *pcity)
Definition cityrep.c:1489
static void create_next_menu(GtkWidget *item)
Definition cityrep.c:1565
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 GtkWidget * select_improvements_item
Definition cityrep.c:157
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
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:1119
static GtkWidget * change_improvements_item
Definition cityrep.c:126
static struct city * city_model_get(GtkTreeModel *model, GtkTreeIter *iter)
Definition cityrep.c:224
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:318
static void city_select_coastal_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1276
static void production_menu_shown(GtkWidget *widget, gpointer data)
Definition cityrep.c:932
static void popup_select_menu(GtkMenuShell *menu, gpointer data)
Definition cityrep.c:1898
static void popup_first_menu(GtkMenuShell *menu, gpointer data)
Definition cityrep.c:1666
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 GtkWidget * last_improvements_item
Definition cityrep.c:130
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
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:747
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:1243
#define CMA_CUSTOM
Definition cityrep.c:65
static void popup_last_menu(GtkMenuShell *menu, gpointer data)
Definition cityrep.c:1643
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 create_last_menu(GtkWidget *item)
Definition cityrep.c:1527
static void same_island_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1296
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:1320
static GtkWidget * select_built_wonders_item
Definition cityrep.c:155
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 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:186
static GtkWidget * create_city_report_menubar(void)
Definition cityrep.c:1036
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
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:2066
void city_report_dialog_popdown(void)
Definition cityrep.c:308
static void create_sell_menu(GtkWidget *item)
Definition cityrep.c:1609
void city_report_dialog_popup(bool raise)
Definition cityrep.c:290
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:1017
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:489
static GtkWidget * next_improvements_item
Definition cityrep.c:138
static void popup_change_menu(GtkMenuShell *menu, gpointer data)
Definition cityrep.c:1620
static void cma_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:670
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 popup_next_menu(GtkMenuShell *menu, gpointer data)
Definition cityrep.c:1689
static void worklist_last_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:468
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:1355
bool select_menu_cached
Definition cityrep.c:162
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 void select_cma_callback(GtkWidget *w, gpointer data)
Definition cityrep.c:690
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:72
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