Freeciv-3.4
Loading...
Searching...
No Matches
cityrep.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18#include <stdio.h>
19#include <stdlib.h>
20#include <string.h>
21
22#include <gtk/gtk.h>
23#include <gdk/gdk.h>
24
25/* utility */
26#include "fcintl.h"
27#include "log.h"
28#include "shared.h"
29#include "support.h"
30
31/* common */
32#include "city.h"
33#include "game.h"
34#include "packets.h"
35#include "unit.h"
36
37/* client/agents */
38#include "cma_fec.h"
39
40/* client */
41#include "citydlg_common.h"
42#include "cityrepdata.h"
43#include "client_main.h"
44#include "climisc.h"
45#include "global_worklist.h"
46#include "mapctrl_common.h" /* is_city_hilited() */
47#include "mapview_common.h"
48#include "options.h"
49
50/* client/gui-gtk-5.0 */
51#include "chatline.h"
52#include "citydlg.h"
53#include "gui_main.h"
54#include "gui_stuff.h"
55#include "mapview.h"
56#include "optiondlg.h"
57#include "repodlgs.h"
58
59#include "cityrep.h"
60
61#define NEG_VAL(x) ((x)<0 ? (x) : (-x))
62
63/* Some versions of gcc have problems with negative values here (PR#39722). */
64#define CMA_NONE (10000)
65#define CMA_CUSTOM (10001)
66
67struct sell_data {
68 int count; /* Number of cities. */
69 int gold; /* Amount of gold. */
70 const struct impr_type *target; /* The target for selling. */
71};
72
76
77/******************************************************************/
79
82
83static void city_command_callback(struct gui_dialog *dlg, int response,
84 gpointer data);
85
88 gpointer data);
89static void update_total_buy_cost(void);
90
93
94static GMenu *create_change_menu(GActionGroup *group, const char *mname,
95 const char *human_mname,
97
99
100enum {
103
110#define CRD_COL_CITY_ID (0 + NUM_CREPORT_COLS)
111
112static void recreate_production_menu(GActionGroup *group);
113static void recreate_select_menu(GActionGroup *group);
114static void recreate_sell_menu(GActionGroup *group);
115
117
126
139
143
144#define FC_TYPE_CITY_ROW (fc_city_row_get_type())
145
147
155
160
162
163/**********************************************************************/
167{
169
170 free(row->columns);
171 row->columns = nullptr;
172
174}
175
176/**********************************************************************/
179static void
186
187/**********************************************************************/
190static void
192{
193 self->columns = fc_malloc(sizeof(char *) * NUM_CREPORT_COLS);
194}
195
196/**********************************************************************/
200{
201 FcCityRow *result;
202
203 result = g_object_new(FC_TYPE_CITY_ROW, nullptr);
204
205 return result;
206}
207
208/************************************************************************/
211static void get_city_table_header(char **text, int n)
212{
213 struct city_report_spec *spec;
214 int i;
215
216 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
217 fc_snprintf(text[i], n, "%*s\n%*s",
218 NEG_VAL(spec->width), spec->title1 ? spec->title1 : "",
219 NEG_VAL(spec->width), spec->title2 ? spec->title2 : "");
220 }
221}
222
223/****************************************************************************
224 CITY REPORT DIALOG
225****************************************************************************/
226
227/**********************************************************************/
241
242/**********************************************************************/
251
252/************************************************************************/
256{
258 gint i;
259
260 /* City report data. */
261 for (i = 0; i < NUM_CREPORT_COLS; i++) {
263 }
264
265 /* Specific gtk client data. */
266 model_types[i++] = G_TYPE_INT; /* CRD_COL_CITY_ID */
267
269}
270
271/************************************************************************/
275 struct city *pcity)
276{
277 struct city_report_spec *spec;
278 char buf[64];
279 gint i;
280
281 for (i = 0; i < NUM_CREPORT_COLS; i++) {
282 spec = city_report_specs + i;
283 fc_snprintf(buf, sizeof(buf), "%*s", NEG_VAL(spec->width),
284 spec->func(pcity, spec->data));
285 gtk_list_store_set(store, iter, i, buf, -1);
286 }
288}
289
290/************************************************************************/
293static void city_store_set(FcCityRow *row, struct city *pcity)
294{
295 struct city_report_spec *spec;
296 char buf[64];
297 gint i;
298
299 row->city_id = pcity->id;
300
301 for (i = 0; i < NUM_CREPORT_COLS; i++) {
302 spec = city_report_specs + i;
303 fc_snprintf(buf, sizeof(buf), "%*s", NEG_VAL(spec->width),
304 spec->func(pcity, spec->data));
305 row->columns[i] = fc_strdup(buf);
306 }
307}
308
309/************************************************************************/
313{
314 struct city *pcity;
315 int id;
316
317 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
319 return ((NULL != pcity
322 ? NULL : pcity);
323}
324
325/************************************************************************/
329 const struct city *pcity)
330{
331 const int searched = pcity->id;
332 int id;
333
335 do {
336 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
337 if (searched == id) {
338 return TRUE;
339 }
340 } while (gtk_tree_model_iter_next(model, iter));
341 }
342 return FALSE;
343}
344
345/************************************************************************/
349 GtkTreeSelection *selection, GHashTable *select)
350{
352
353 if (client_has_player()) {
357 if (NULL != select
360 }
362 } else {
363 /* Global observer case. */
367 if (NULL != select
370 }
372 }
373}
374
375/************************************************************************/
378static void city_store_fill(GListStore *store,
379 GtkMultiSelection *selection, GHashTable *select)
380{
381 if (client_has_player()) {
384
388 if (NULL != select
392 FALSE);
393 }
395 } else {
396 /* Global observer case. */
399
403 if (NULL != select
407 FALSE);
408 }
410 }
411}
412
413/************************************************************************/
428
429/************************************************************************/
438
439/************************************************************************/
444 const char *act_pfx,
445 const char *act_pfx2,
446 bool append_units,
447 bool append_wonders,
452 int size)
453{
455 struct item items[MAX_NUM_PRODUCTION_TARGETS];
456 int i, item, targets_used;
457 char *row[4];
458 char buf[4][64];
459
460 GtkSizeGroup *size_group[3];
461
462 if (city_operation != CO_NONE) {
463 GPtrArray *selected;
464 ITree it;
465 int num_selected = 0;
467 struct city **data;
468
469 selected = g_ptr_array_sized_new(size);
470
471 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
472 struct city *pcity;
473
475 || !(pcity = city_model_get(model, TREE_ITER_PTR(it)))) {
476 continue;
477 }
478
479 g_ptr_array_add(selected, pcity);
480 num_selected++;
481 }
482
483 data = (struct city **)g_ptr_array_free(selected, FALSE);
487 g_free(data);
488 } else {
491 test_func);
492 }
493
494 name_and_sort_items(targets, targets_used, items,
496
497 for (i = 0; i < 4; i++) {
498 row[i] = buf[i];
499 }
500
501
502 for (i = 0; i < 3; i++) {
504 }
505
506 for (item = 0; item < targets_used; item++) {
507 struct universal target = items[item].item;
509 char actbuf[256];
510 GSimpleAction *act;
511
512 get_city_dialog_production_row(row, sizeof(buf[0]), &target, NULL);
513
514 fc_snprintf(actbuf, sizeof(actbuf), "win.%s%s%d", act_pfx, act_pfx2, item);
515
517
518 fc_snprintf(actbuf, sizeof(actbuf), "%s%s%d", act_pfx, act_pfx2, item);
520 g_object_set_data(G_OBJECT(act), "freeciv_test_func", test_func);
521 g_object_set_data(G_OBJECT(act), "freeciv_city_operation",
524 g_signal_connect(act, "activate", callback,
525 GINT_TO_POINTER(cid_encode(target)));
527 }
528
529 for (i = 0; i < 3; i++) {
530 g_object_unref(size_group[i]);
531 }
532}
533
534/************************************************************************/
539{
540 struct universal target = cid_decode(GPOINTER_TO_INT(data));
541 struct city *pcity = city_model_get(model, iter);
542
543 if (NULL != pcity) {
545 }
546}
547
548/************************************************************************/
554 GtkTreePath *path,
556 gpointer data)
557{
558 struct universal target = cid_decode(GPOINTER_TO_INT(data));
559 struct city *pcity = city_model_get(model, iter);
560
561 if (NULL != pcity) {
562 (void) city_queue_insert(pcity, -1, &target);
563 }
564 /* Perhaps should warn the user if not successful? */
565}
566
567/************************************************************************/
575 GtkTreePath *path,
577 gpointer data)
578{
579 struct universal target = cid_decode(GPOINTER_TO_INT(data));
580 struct city *pcity = city_model_get(model, iter);
581
582 if (NULL != pcity) {
583 (void) city_queue_insert(pcity, 0, &target);
584 }
585 /* Perhaps should warn the user if not successful? */
586}
587
588/************************************************************************/
595 GtkTreePath *path,
597 gpointer data)
598{
599 struct universal target = cid_decode(GPOINTER_TO_INT(data));
600 struct city *pcity = city_model_get(model, iter);
601
602 if (NULL != pcity) {
603 (void) city_queue_insert(pcity, 1, &target);
604 }
605 /* Perhaps should warn the user if not successful? */
606}
607
608/************************************************************************/
614 GtkTreePath *path,
616 gpointer data)
617{
618 struct universal target = cid_decode(GPOINTER_TO_INT(data));
619 struct city *pcity = city_model_get(model, iter);
620
621 if (NULL != pcity) {
622 city_queue_insert(pcity, worklist_length(&pcity->worklist), &target);
623 }
624}
625
626/************************************************************************/
631{
632 struct sell_data *sd = (struct sell_data *) data;
633 struct city *pcity = city_model_get(model, iter);
634
635 if (NULL != pcity
636 && !pcity->did_sell
637 && city_has_building(pcity, sd->target)) {
638 sd->count++;
639 sd->gold += impr_sell_gold(sd->target);
641 }
642}
643
644struct scbs_data {
645 const struct impr_type *building;
646 const char *imprname;
647};
648
649/************************************************************************/
652static void sell_callback_response(GObject *dialog, GAsyncResult *result,
653 gpointer data)
654{
656 result, NULL);
657
658 if (button == 0) {
659 struct scbs_data *scbs = (struct scbs_data *)data;
660 struct sell_data sd = { 0, 0, scbs->building };
661 GtkWidget *w;
662
665 if (sd.count > 0) {
666 /* FIXME: plurality of sd.count is ignored! */
667 /* TRANS: "Sold 3 Harbor for 90 gold." (Pluralisation is in gold --
668 * second %d -- not in buildings.) */
671 PL_("Sold %d %s for %d gold.",
672 "Sold %d %s for %d gold.",
673 sd.gold),
674 sd.count, scbs->imprname, sd.gold);
675 } else {
678 _("No %s could be sold."),
679 scbs->imprname);
680 }
681
682 g_signal_connect(w, "response",
684 gtk_window_present(GTK_WINDOW(w)); /* Asynchron. */
685 }
686
687 free(data);
688}
689
690/************************************************************************/
695 GVariant *parameter,
696 gpointer data)
697{
698 struct universal target = cid_decode(GPOINTER_TO_INT(data));
699 TestCityFunc test_func = g_object_get_data(G_OBJECT(action), "freeciv_test_func");
701 GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "freeciv_city_operation"));
702
703 /* If this is not a city operation: */
704 if (city_operation == CO_NONE) {
706 ITree it;
707
709 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
710 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
711
712 if (NULL != pcity && test_func(pcity, &target)) {
714 }
715 }
716 } else {
718
720 switch (city_operation) {
721 case CO_LAST:
724 GINT_TO_POINTER(cid_encode(target)));
725 break;
726 case CO_CHANGE:
729 GINT_TO_POINTER(cid_encode(target)));
730 break;
731 case CO_FIRST:
734 GINT_TO_POINTER(cid_encode(target)));
735 break;
736 case CO_NEXT:
739 GINT_TO_POINTER(cid_encode(target)));
740 break;
741 case CO_NEXT_TO_LAST:
744 GINT_TO_POINTER(cid_encode(target)));
745 break;
746 case CO_SELL:
747 fc_assert_action(target.kind == VUT_IMPROVEMENT, break);
748 {
749 struct scbs_data *scbs = fc_malloc(sizeof(struct scbs_data));
751 gchar *buf;
752 const char *buttons[] = { _("Yes"), _("No"), NULL };
753
754 scbs->building = target.value.building;
755 scbs->imprname = improvement_name_translation(scbs->building);
756
757 /* Ask confirmation */
758 buf = g_strdup_printf(_("Are you sure you want to sell those %s?"), scbs->imprname);
759 w = gtk_alert_dialog_new("%s", buf);
760 g_free(buf);
765 }
766 break;
767 case CO_NONE:
768 break;
769 }
771 }
772}
773
774/************************************************************************/
779{
780 struct city *pcity = city_model_get(model, iter);
781 int idx = GPOINTER_TO_INT(data);
782
783 if (NULL != pcity) {
784 if (CMA_NONE == idx) {
786 } else {
788 }
790 }
791}
792
793/************************************************************************/
798 GVariant *parameter,
799 gpointer data)
800{
801 int idx = GPOINTER_TO_INT(data);
802 bool change_governor =
804 struct cm_parameter cm;
805
806 /* If this is not the change button but the select cities button. */
807 if (!change_governor) {
808 ITree it;
810
812 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
813 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
814 int controlled;
815 bool select;
816
817 if (NULL == pcity) {
818 continue;
819 }
821 select = FALSE;
822
823 if (idx == CMA_NONE) {
824 /* CMA_NONE selects not-controlled, all others require controlled */
825 if (!controlled) {
826 select = TRUE;
827 }
828 } else if (controlled) {
829 if (idx == CMA_CUSTOM) {
831 select = TRUE;
832 }
833 } else if (cm_are_parameter_equal(&cm,
835 select = TRUE;
836 }
837 }
838
839 if (select) {
841 }
842 }
843 } else {
846 GINT_TO_POINTER(idx));
847 }
848}
849
850/************************************************************************/
857 bool change_governor)
858{
859 GMenu *menu;
860 int i;
861 struct cm_parameter cm;
862
863 menu = g_menu_new();
864
866 return menu;
867 }
868
869 if (change_governor) {
870 GSimpleAction *act;
871
872 act = g_simple_action_new("chg_governor_none", NULL);
873 g_object_set_data(G_OBJECT(act), "governor",
879 g_menu_item_new(Q_("?cma:none"),
880 "win.chg_governor_none"));
881
882 for (i = 0; i < cmafec_preset_num(); i++) {
883 char buf[128];
884
885 fc_snprintf(buf, sizeof(buf), "chg_governor_%d", i);
887 g_object_set_data(G_OBJECT(act), "governor",
892 fc_snprintf(buf, sizeof(buf), "win.chg_governor_%d", i);
895 }
896 } else {
897 /* Search for a "none" */
898 bool found;
899
900 found = FALSE;
903 found = TRUE;
904 break;
905 }
907
908 if (found) {
909 GSimpleAction *act;
910
911 act = g_simple_action_new("sel_governor_none", NULL);
912 g_object_set_data(G_OBJECT(act), "governor",
918 g_menu_item_new(Q_("?cma:none"),
919 "win.sel_governor_none"));
920 }
921
922 /*
923 * Search for a city that's under custom (not preset) agent. Might
924 * take a lonnggg time.
925 */
926 found = FALSE;
930 found = TRUE;
931 break;
932 }
934
935 if (found) {
936 /* We found city that's under agent but not a preset */
937 GSimpleAction *act;
938
939 act = g_simple_action_new("sel_governor_custom", NULL);
940 g_object_set_data(G_OBJECT(act), "governor",
946 g_menu_item_new(Q_("?cma:custom"),
947 "win.sel_governor_custom"));
948 }
949
950 /* Only fill in presets that are being used. */
951 for (i = 0; i < cmafec_preset_num(); i++) {
952 found = FALSE;
957 found = TRUE;
958 break;
959 }
961
962 if (found) {
963 GSimpleAction *act;
964 char buf[128];
965
966 fc_snprintf(buf, sizeof(buf), "sel_governor_%d", i);
967
969 g_object_set_data(G_OBJECT(act), "governor",
974 fc_snprintf(buf, sizeof(buf), "win.sel_governor_%d", i);
977 buf));
978 }
979 }
980 }
981
982 return menu;
983}
984
985/************************************************************************/
994
995/************************************************************************/
1001 GtkTreeIter *iter, gpointer data)
1002{
1003 const struct worklist *pwl = data;
1004 struct city *pcity = city_model_get(model, iter);
1005
1007
1008 if (NULL != pcity) {
1010 }
1011}
1012
1013/************************************************************************/
1019 GVariant *parameter,
1020 gpointer data)
1021{
1022 struct global_worklist *pgwl =
1024
1026
1027 if (!pgwl) {
1028 /* Maybe removed by an other way, not an error. */
1029 return;
1030 }
1031
1035}
1036
1037/************************************************************************/
1042 GtkTreeIter *iter, gpointer data)
1043{
1044 const struct worklist *pwl = data;
1045 struct city *pcity = city_model_get(model, iter);
1046
1048
1049 if (NULL != pcity) {
1051 }
1052}
1053
1054/************************************************************************/
1059 GVariant *parameter,
1060 gpointer data)
1061{
1062 struct global_worklist *pgwl =
1064
1068
1069 if (!pgwl) {
1070 /* Maybe removed by an other way, not an error. */
1071 return;
1072 }
1073
1077}
1078
1079/************************************************************************/
1082static GMenu *create_wl_menu(GActionGroup *group, const char *act_pfx,
1083 GCallback cb)
1084{
1085 GMenu *menu;
1086 GSimpleAction *act;
1087 int count = 0;
1088
1089 menu = g_menu_new();
1090
1091 if (!can_client_issue_orders()) {
1092 return NULL;
1093 }
1094
1096 char buf[128];
1097
1098 fc_snprintf(buf, sizeof(buf), "wl%s%d", act_pfx, count);
1101 g_signal_connect(act, "activate", cb,
1103 fc_snprintf(buf, sizeof(buf), "win.wl%s%d", act_pfx, count);
1106 buf));
1107 count++;
1109
1110 if (count == 0) {
1111 char buf[64];
1112
1113 fc_snprintf(buf, sizeof(buf), "win.wl%s_dummy", act_pfx);
1115 g_menu_item_new(_("(no worklists defined)"), buf));
1116 }
1117
1118 return menu;
1119}
1120
1121/************************************************************************/
1125{
1126 struct city_report_spec *spec;
1129 GList *columns, *p;
1130
1133
1135
1136 for (p = columns; p != NULL; p = p->next) {
1137 col = p->data;
1138 spec = g_object_get_data(G_OBJECT(col), "city_report_spec");
1140 }
1141
1142 g_list_free(columns);
1143}
1144
1145/************************************************************************/
1150{
1151 GMenuItem *item;
1152 char act_name[50];
1153 struct city_report_spec *spec = city_report_specs + pos;
1154
1155 fc_snprintf(act_name, sizeof(act_name), "win.display%d(%s)",
1156 pos, spec->show ? "true" : "false");
1159
1160 return item;
1161}
1162
1163/************************************************************************/
1167{
1168 struct city_report_spec *spec = data;
1169 int idx = spec - city_report_specs;
1170
1171 spec->show ^= 1;
1173
1176}
1177
1178/************************************************************************/
1182{
1183 struct city_report_spec *spec;
1184 int i;
1186
1188 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
1189 GSimpleAction *act;
1190 char act_name[50];
1191 GVariant *var = g_variant_new("b", TRUE);
1192
1193 fc_snprintf(act_name, sizeof(act_name), "display%d", i);
1196 g_signal_connect(act, "change-state", G_CALLBACK(toggle_view), (gpointer)spec);
1197
1199 }
1200
1202
1203 return display_menu;
1204}
1205
1206/************************************************************************/
1244
1245/************************************************************************/
1250{
1252 gchar *str1, *str2;
1253 int i;
1254
1255 gtk_tree_model_get(model, a, col, &str1, -1);
1256 gtk_tree_model_get(model, b, col, &str2, -1);
1257
1259 g_free(str1);
1260 g_free(str2);
1261 return i;
1262}
1263
1264/************************************************************************/
1268{
1269 static char **titles;
1270 static char (*buf)[128];
1271 struct city_report_spec *spec;
1272
1273 GtkWidget *sw, *aux_menu;
1274 int i;
1275
1278
1280
1283
1284 /* Menu */
1287
1288 /* Buttons */
1295
1297 _("_Buy"), CITY_BUY);
1298
1300 _("_Inspect"), CITY_POPUP);
1301
1303 _("Cen_ter"), CITY_CENTER);
1304
1306
1311
1312 /* Tree view */
1313 buf = fc_realloc(buf, NUM_CREPORT_COLS * sizeof(buf[0]));
1315 for (i = 0; i < NUM_CREPORT_COLS; i++) {
1316 titles[i] = buf[i];
1317 }
1318 get_city_table_header(titles, sizeof(buf[0]));
1319
1320 for (i = 0; i < NUM_CREPORT_COLS; i++) {
1323
1329
1332 }
1333
1338 gtk_widget_set_name(city_view_depr, "small_font");
1339 g_signal_connect(city_view_depr, "row_activated",
1345
1346 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
1347 GtkWidget *header;
1348 GtkCellRenderer *renderer;
1350
1351 renderer = gtk_cell_renderer_text_new();
1353 "text", i, NULL);
1354 header = gtk_label_new(titles[i]);
1361 g_object_set_data(G_OBJECT(col), "city_report_spec", spec);
1365 NULL);
1366 }
1367
1373
1375
1377 city_store_fill(city_store, nullptr, nullptr);
1379
1380 /* Real menus */
1384
1386}
1387
1388/************************************************************************/
1397
1398/************************************************************************/
1407
1408/************************************************************************/
1412 GVariant *parameter,
1413 gpointer data)
1414{
1415 ITree it;
1417
1418 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1421 } else {
1423 }
1424 }
1425}
1426
1427/************************************************************************/
1431 GVariant *parameter,
1432 gpointer data)
1433{
1434 ITree it;
1436
1438
1439 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1440 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1441
1442 if (pcity != NULL
1445 }
1446 }
1447}
1448
1449/************************************************************************/
1453 GtkTreeIter *iter, gpointer data)
1454{
1455 struct city *selected_pcity = city_model_get(model, iter);
1456 ITree it;
1457
1458 if (NULL == selected_pcity) {
1459 return;
1460 }
1461
1462 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1463 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1464
1465 if (NULL != pcity
1467 == tile_continent(selected_pcity->tile))) {
1469 }
1470 }
1471}
1472
1473/************************************************************************/
1483
1484/************************************************************************/
1488 GVariant *parameter,
1489 gpointer data)
1490{
1492 ITree it;
1494
1496
1497 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1498 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1499
1500 if (NULL != pcity
1501 && ((which == PCT_UNIT && VUT_UTYPE == pcity->production.kind)
1502 || (which == PCT_IMPROVEMENT
1503 && VUT_IMPROVEMENT == pcity->production.kind
1504 && !is_wonder(pcity->production.value.building))
1505 || (which == PCT_WONDER
1506 && VUT_IMPROVEMENT == pcity->production.kind
1507 && is_wonder(pcity->production.value.building)))) {
1509 }
1510 }
1511}
1512
1513/************************************************************************/
1516static void buy_iterate(GtkTreeModel *model, GtkTreePath *path,
1517 GtkTreeIter *iter, gpointer data)
1518{
1519 struct city *pcity = city_model_get(model, iter);
1520
1521 if (NULL != pcity) {
1523 }
1524}
1525
1526/************************************************************************/
1529static void center_iterate(GtkTreeModel *model, GtkTreePath *path,
1530 GtkTreeIter *iter, gpointer data)
1531{
1532 struct city *pcity = city_model_get(model, iter);
1533
1534 if (NULL != pcity) {
1536 }
1537}
1538
1539/************************************************************************/
1542static void popup_iterate(GtkTreeModel *model, GtkTreePath *path,
1543 GtkTreeIter *iter, gpointer data)
1544{
1545 struct city *pcity = city_model_get(model, iter);
1546
1547 if (NULL != pcity) {
1550 }
1552 }
1553}
1554
1555/************************************************************************/
1558static void city_command_callback(struct gui_dialog *dlg, int response,
1559 gpointer data)
1560{
1561 switch (response) {
1562 case CITY_CENTER:
1564 /* Center to city doesn't make sense if many city are selected. */
1566 NULL);
1567 }
1568 break;
1569 case CITY_POPUP:
1571 break;
1572 case CITY_BUY:
1574 break;
1575 default:
1576 gui_dialog_destroy(dlg);
1577 break;
1578 }
1579}
1580
1581/************************************************************************/
1586{
1587 GtkTreeModel *model;
1589 GdkSurface *win;
1590 GdkSeat *seat;
1592
1594
1595 if (!gtk_tree_model_get_iter(model, &iter, path)) {
1596 return;
1597 }
1598
1601
1603 NULL, NULL, &mask);
1604
1605 if (!(mask & GDK_CONTROL_MASK)) {
1606 popup_iterate(model, path, &iter, NULL);
1607 } else {
1608 center_iterate(model, path, &iter, NULL);
1609 }
1610}
1611
1612/************************************************************************/
1616{
1617 GHashTable *selected;
1618 ITree iter;
1619 gint city_id;
1620
1621 if (NULL == city_dialog_shell) {
1622 return;
1623 }
1624
1625 /* Save the selection. */
1626 selected = g_hash_table_new(NULL, NULL);
1628 !itree_end(&iter); itree_next(&iter)) {
1630 itree_get(&iter, CRD_COL_CITY_ID, &city_id, -1);
1631 g_hash_table_insert(selected, GINT_TO_POINTER(city_id), NULL);
1632 }
1633 }
1634
1635 /* Update and restore the selection. */
1638
1641 g_hash_table_destroy(selected);
1642
1644}
1645
1646/************************************************************************/
1664
1665/************************************************************************/
1674static GMenu *create_change_menu(GActionGroup *group, const char *mname,
1675 const char *human_mname,
1677{
1678 GMenu *menu = g_menu_new();
1679 GMenu *submenu;
1680 int n;
1681 char buf[128];
1682
1684
1685 submenu = g_menu_new();
1687 TRUE, FALSE, oper,
1690 fc_snprintf(buf, sizeof(buf), human_mname, _("Unit"));
1692
1693 submenu = g_menu_new();
1695 FALSE, FALSE, oper,
1698 fc_snprintf(buf, sizeof(buf), human_mname, _("Improvement"));
1700
1701 submenu = g_menu_new();
1703 FALSE, TRUE, oper,
1706 fc_snprintf(buf, sizeof(buf), human_mname, _("Wonder"));
1708
1709 return menu;
1710}
1711
1712/************************************************************************/
1716{
1717 int n;
1718 GMenu *menu = g_menu_new();
1719
1721
1722 append_impr_or_unit_to_menu(menu, group, "sell", "",
1726 n);
1727
1729 submenu_insert_unref(cityrep_menu, 2, _("S_ell"), G_MENU_MODEL(menu));
1730}
1731
1732/************************************************************************/
1736{
1737 GSimpleAction *act;
1738
1740
1741 /* TRANS: Menu name part to be used like "Change to Improvement"
1742 * This is about changing current production. */
1743 change_menu = create_change_menu(group, "change", _("Change to %s"), CO_CHANGE);
1745
1747
1748 /* TRANS: Menu name to be used like "Set Improvement first"
1749 * This is about adding item to the beginning of the worklist. */
1750 add_first_menu = create_change_menu(group, "first", _("Set %s first"), CO_FIRST);
1751 submenu_append_unref(prod_menu, _("Add _First"),
1753
1755
1756 /* TRANS: Menu name to be used like "Set Improvement last"
1757 * This is about adding item to the end of the worklist. */
1758 add_last_menu = create_change_menu(group, "last", _("Set %s last"), CO_LAST);
1759 submenu_append_unref(prod_menu, _("Add _Last"),
1761
1763
1764 /* TRANS: Menu name to be used like "Set Improvement next"
1765 * This is about adding item after current one on the worklist. */
1766 add_next_menu = create_change_menu(group, "next", _("Set %s next"), CO_NEXT);
1767 submenu_append_unref(prod_menu, _("Add _Next"),
1769
1771
1772 /* TRANS: Menu name to be used like "Set Improvement 2nd last"
1773 * This is about adding item as second last on the worklist. */
1774 add_2ndlast_menu = create_change_menu(group, "2ndlast", _("Set %s 2nd last"), CO_NEXT_TO_LAST);
1775 submenu_append_unref(prod_menu, _("Add _2nd Last"),
1777
1779 submenu_append_unref(prod_menu, _("Set Worklist"),
1781
1783 submenu_append_unref(prod_menu, _("Append Worklist"),
1785
1786 act = g_simple_action_new("clear_worklist", NULL);
1789 NULL);
1791 "win.clear_worklist"));
1792
1793 return prod_menu;
1794}
1795
1796/************************************************************************/
1815
1816/************************************************************************/
1819static bool city_building_impr_or_unit(const struct city *pcity,
1820 const struct universal *target)
1821{
1822 return are_universals_equal(&pcity->production, target);
1823}
1824
1825/************************************************************************/
1829{
1830 GSimpleAction *act;
1831 char buf[128];
1832
1834
1835#if 0
1838#endif
1839
1840 act = g_simple_action_new("select_all", NULL);
1843 NULL);
1845 "win.select_all"));
1846
1847 act = g_simple_action_new("select_none", NULL);
1850 NULL);
1852 "win.select_none"));
1853
1854 act = g_simple_action_new("select_invert", NULL);
1857 NULL);
1859 "win.select_invert"));
1860
1861 act = g_simple_action_new("select_build_unit", NULL);
1866 "win.select_build_unit"));
1867
1868 act = g_simple_action_new("select_build_impr", NULL);
1872 menu_item_append_unref(select_menu, g_menu_item_new(_("Building Improvements"),
1873 "win.select_build_impr"));
1874
1875 act = g_simple_action_new("select_build_wonder", NULL);
1880 "win.select_build_wonder"));
1881
1883 append_impr_or_unit_to_menu(unit_b_select_menu, group, "sel", "_b_u",
1884 TRUE, FALSE, CO_NONE,
1887 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Unit"));
1889
1891 append_impr_or_unit_to_menu(impr_b_select_menu, group, "sel", "_b_b",
1895 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Improvement"));
1897
1899 append_impr_or_unit_to_menu(wndr_b_select_menu, group, "sel", "_b_w",
1900 FALSE, TRUE, CO_NONE,
1903 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Wonder"));
1905
1906 act = g_simple_action_new("select_coastal", NULL);
1909 NULL);
1911 "win.select_coastal"));
1912
1913 act = g_simple_action_new("select_island", NULL);
1916 NULL);
1918 "win.select_island"));
1919
1921 append_impr_or_unit_to_menu(unit_s_select_menu, group, "sel", "_s_u",
1922 TRUE, FALSE, CO_NONE,
1925 fc_snprintf(buf, sizeof(buf), _("Supported %s"), _("Unit"));
1927
1929 append_impr_or_unit_to_menu(unit_p_select_menu, group, "sel", "_p_u",
1930 TRUE, FALSE, CO_NONE,
1933 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Unit"));
1935
1937 append_impr_or_unit_to_menu(impr_p_select_menu, group, "sel", "_p_b",
1941 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Improvement"));
1943
1945 append_impr_or_unit_to_menu(wndr_p_select_menu, group, "sel", "_p_w",
1946 FALSE, TRUE, CO_NONE,
1949 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Wonder"));
1951
1953 append_impr_or_unit_to_menu(unit_a_select_menu, group, "sel", "_a_u",
1954 TRUE, FALSE, CO_NONE,
1957 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Unit"));
1959
1961 append_impr_or_unit_to_menu(impr_a_select_menu, group, "sel", "_a_b",
1965 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Improvement"));
1967
1969 append_impr_or_unit_to_menu(wndr_a_select_menu, group, "sel", "_a_w",
1970 FALSE, TRUE, CO_NONE,
1973 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Wonder"));
1975
1977 submenu_append_unref(select_menu, _("Citizen Governor"),
1979
1980 return select_menu;
1981}
1982
1983/************************************************************************/
2006
2007/************************************************************************/
2011static void update_total_buy_cost(void)
2012{
2013 GtkWidget *label, *view;
2014 GList *rows, *p;
2015 GtkTreeModel *model;
2017 GtkTreePath *path;
2019 struct city *pcity;
2020 int total = 0;
2021
2024
2025 if (!view || !label) {
2026 return;
2027 }
2028
2031
2032 for (p = rows; p != NULL; p = p->next) {
2033 path = p->data;
2034 if (gtk_tree_model_get_iter(model, &iter, path)) {
2035 if ((pcity = city_model_get(model, &iter))) {
2036 total += pcity->client.buy_cost;
2037 }
2038 }
2039 gtk_tree_path_free(path);
2040 }
2042
2043 if (total > 0) {
2044 gchar *buf = g_strdup_printf(_("Total Buy Cost: %d"), total);
2045
2047 g_free(buf);
2048 } else {
2050 }
2051}
2052
2053/************************************************************************/
2067
2068/************************************************************************/
2072 GtkTreePath *path,
2074 gpointer data)
2075{
2076 struct city *pcity = city_model_get(model, iter);
2077
2078 if (NULL != pcity) {
2079 struct worklist empty;
2080
2083 }
2084}
2085
2086/************************************************************************/
2101
2102/************************************************************************/
2108{
2109 ITree it;
2110 GtkTreeModel *model;
2111
2112 if (!city_dialog_shell) {
2113 return;
2114 }
2115
2117
2119
2120 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
2121 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
2122
2123 if (NULL != pcity && is_city_hilited(pcity)) {
2125 }
2126 }
2127}
2128
2129/************************************************************************/
2133{
2135
2136 if (NULL == city_dialog_shell) {
2137 return;
2138 }
2139
2141 if (on_off) {
2143 } else {
2145 }
2146 }
2147}
#define n
Definition astring.c:77
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
Definition city.c:1292
#define cities_iterate_end
Definition city.h:517
#define city_list_iterate(citylist, pcity)
Definition city.h:508
#define cities_iterate(pcity)
Definition city.h:512
#define city_owner(_pcity_)
Definition city.h:564
#define city_list_iterate_end
Definition city.h:510
void get_city_dialog_production_row(char *buf[], size_t column_size, struct universal *target, struct city *pcity)
int city_set_worklist(struct city *pcity, const struct worklist *pworklist)
bool city_queue_insert(struct city *pcity, int position, struct universal *item)
bool city_queue_insert_worklist(struct city *pcity, int position, const struct worklist *worklist)
bool city_set_queue(struct city *pcity, const struct worklist *pqueue)
int city_change_production(struct city *pcity, struct universal *target)
int city_sell_improvement(struct city *pcity, Impr_type_id sell_id)
void popup_city_dialog(struct city *pcity)
void refresh_city_dialog(struct city *pcity)
bool can_city_sell_universal(const struct city *pcity, const struct universal *target)
struct city_report_spec * city_report_specs
int cityrepfield_compare(const char *str1, const char *str2)
#define NUM_CREPORT_COLS
Definition cityrepdata.h:25
static struct ai_type * self
Definition classicai.c:47
struct civclient client
bool can_client_issue_orders(void)
bool client_has_player(void)
#define client_player()
bool city_unit_supported(const struct city *pcity, const struct universal *target)
Definition climisc.c:545
void cityrep_buy(struct city *pcity)
Definition climisc.c:1160
void name_and_sort_items(struct universal *targets, int num_targets, struct item *items, bool show_cost, struct city *pcity)
Definition climisc.c:650
cid cid_encode(struct universal target)
Definition climisc.c:483
bool city_building_present(const struct city *pcity, const struct universal *target)
Definition climisc.c:583
struct universal cid_decode(cid id)
Definition climisc.c:526
bool can_city_build_now_client(const struct city *pcity, const struct universal *target)
Definition climisc.c:593
bool city_unit_present(const struct city *pcity, const struct universal *target)
Definition climisc.c:564
int collect_production_targets(struct universal *targets, struct city **selected_cities, int num_selected_cities, bool append_units, bool append_wonders, bool change_prod, TestCityFunc test_func)
Definition climisc.c:700
#define MAX_NUM_PRODUCTION_TARGETS
Definition climisc.h:89
bool(* TestCityFunc)(const struct city *, const struct universal *)
Definition climisc.h:87
bool cm_are_parameter_equal(const struct cm_parameter *const p1, const struct cm_parameter *const p2)
Definition cm.c:2143
bool cma_is_city_under_agent(const struct city *pcity, struct cm_parameter *parameter)
Definition cma_core.c:552
void cma_put_city_under_agent(struct city *pcity, const struct cm_parameter *const parameter)
Definition cma_core.c:524
void cma_release_city(struct city *pcity)
Definition cma_core.c:542
char * cmafec_preset_get_descr(int idx)
Definition cma_fec.c:169
const struct cm_parameter * cmafec_preset_get_parameter(int idx)
Definition cma_fec.c:182
int cmafec_preset_get_index_of_parameter(const struct cm_parameter *const parameter)
Definition cma_fec.c:196
int cmafec_preset_num(void)
Definition cma_fec.c:213
char * incite_cost
Definition comments.c:77
void connection_do_buffer(struct connection *pc)
Definition connection.c:325
void connection_do_unbuffer(struct connection *pc)
Definition connection.c:337
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:77
int int id
Definition editgui_g.h:28
#define Q_(String)
Definition fcintl.h:70
#define PL_(String1, String2, n)
Definition fcintl.h:71
#define _(String)
Definition fcintl.h:67
struct world wld
Definition game.c:63
struct city * game_city_by_number(int id)
Definition game.c:106
struct global_worklist * global_worklist_by_id(int id)
const char * global_worklist_name(const struct global_worklist *pgwl)
int global_worklist_id(const struct global_worklist *pgwl)
const struct worklist * global_worklist_get(const struct global_worklist *pgwl)
#define global_worklists_iterate(pgwl)
#define global_worklists_iterate_end
static void append_worklist_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:853
static void create_city_report_dialog(bool make_modal)
Definition cityrep.c:1138
static void city_invert_selection_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1259
static void worklist_next_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:509
static GtkWidget * city_total_buy_cost_label
Definition cityrep.c:124
static void update_total_buy_cost(void)
Definition cityrep.c:1959
void real_city_report_dialog_update(void *unused)
Definition cityrep.c:1454
#define CRD_COL_CITY_ID
Definition cityrep.c:107
void real_city_report_update_city(struct city *pcity)
Definition cityrep.c:1489
static void city_select_building_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1328
static void popup_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1381
static void create_select_menu(GtkWidget *item)
Definition cityrep.c:1770
static void city_activated_callback(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data)
Definition cityrep.c:1423
static void select_impr_or_unit_callback(GtkWidget *wdg, gpointer data)
Definition cityrep.c:563
static void impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:452
static void center_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1368
void toggle_city_hilite(struct city *pcity, bool on_off)
Definition cityrep.c:2089
static bool city_building_impr_or_unit(const struct city *pcity, const struct universal *target)
Definition cityrep.c:1889
#define CMA_NONE
Definition cityrep.c:64
static gint cityrep_sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer data)
Definition cityrep.c:1119
static struct city * city_model_get(GtkTreeModel *model, GtkTreeIter *iter)
Definition cityrep.c:224
static void city_select_coastal_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1276
static void popup_select_menu(GtkMenuShell *menu, gpointer data)
Definition cityrep.c:1898
static void city_command_callback(struct gui_dialog *dlg, int response, gpointer data)
Definition cityrep.c:1397
static void city_clear_worklist_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:2049
static void clear_worklist_foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:2031
#define NEG_VAL(x)
Definition cityrep.c:61
static void city_select_all_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1243
#define CMA_CUSTOM
Definition cityrep.c:65
static void sell_impr_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:544
static GtkTreeSelection * city_selection
Definition cityrep.c:105
static void same_island_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1296
static void set_worklist_callback(GtkMenuItem *menuitem, gpointer data)
Definition cityrep.c:909
static void city_selection_changed_callback(GtkTreeSelection *selection)
Definition cityrep.c:2005
static gboolean city_model_find(GtkTreeModel *model, GtkTreeIter *iter, const struct city *pcity)
Definition cityrep.c:240
static void worklist_next_to_last_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:528
static void city_report_update_views(void)
Definition cityrep.c:982
static void get_city_table_header(char **text, int n)
Definition cityrep.c:167
void hilite_cities_from_canvas(void)
Definition cityrep.c:2066
void city_report_dialog_popdown(void)
Definition cityrep.c:308
void city_report_dialog_popup(bool raise)
Definition cityrep.c:290
static GtkWidget * city_view
Definition cityrep.c:104
@ CITY_POPUP
Definition cityrep.c:101
@ CITY_CENTER
Definition cityrep.c:101
@ CITY_BUY
Definition cityrep.c:101
static struct gui_dialog * city_dialog_shell
Definition cityrep.c:98
static void worklist_first_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:489
static void set_worklist_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:892
static void toggle_view(GtkCheckMenuItem *item, gpointer data)
Definition cityrep.c:1006
static void append_worklist_callback(GtkMenuItem *menuitem, gpointer data)
Definition cityrep.c:871
static void city_unselect_all_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1251
static void worklist_last_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:468
static void buy_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1355
city_operation_type
Definition cityrep.c:73
@ CO_SELL
Definition cityrep.c:74
@ CO_NEXT_TO_LAST
Definition cityrep.c:74
@ CO_NEXT
Definition cityrep.c:74
@ CO_CHANGE
Definition cityrep.c:74
@ CO_FIRST
Definition cityrep.c:74
@ CO_LAST
Definition cityrep.c:74
@ CO_NONE
Definition cityrep.c:74
static void recreate_sell_menu(void)
Definition cityrep.c:1743
static void create_change_menu(GtkWidget *item)
Definition cityrep.c:1508
static struct tile * pos
Definition finddlg.c:53
GtkWidget * top_notebook
Definition gui_main.c:130
GtkWidget * toplevel
Definition gui_main.c:126
void gui_dialog_destroy(struct gui_dialog *dlg)
Definition gui_stuff.c:954
void gui_dialog_present(struct gui_dialog *dlg)
Definition gui_stuff.c:835
void itree_get(ITree *it,...)
Definition gui_stuff.c:164
void gui_dialog_raise(struct gui_dialog *dlg)
Definition gui_stuff.c:865
void gui_dialog_new(struct gui_dialog **pdlg, GtkNotebook *notebook, gpointer user_data, bool check_top)
Definition gui_stuff.c:517
void gui_dialog_response_set_callback(struct gui_dialog *dlg, GUI_DIALOG_RESPONSE_FUN fun)
Definition gui_stuff.c:988
void itree_begin(GtkTreeModel *model, ITree *it)
Definition gui_stuff.c:127
void itree_unselect(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:206
void gui_dialog_show_all(struct gui_dialog *dlg)
Definition gui_stuff.c:795
void itree_select(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:198
void gui_dialog_set_title(struct gui_dialog *dlg, const char *title)
Definition gui_stuff.c:935
void gui_dialog_set_default_size(struct gui_dialog *dlg, int width, int height)
Definition gui_stuff.c:919
void itree_next(ITree *it)
Definition gui_stuff.c:144
gboolean itree_is_selected(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:190
GtkWidget * gui_dialog_add_button(struct gui_dialog *dlg, const char *icon_name, const char *text, int response)
Definition gui_stuff.c:706
gboolean itree_end(ITree *it)
Definition gui_stuff.c:136
#define TREE_ITER_PTR(x)
Definition gui_stuff.h:38
static GMenu * impr_b_select_menu
Definition cityrep.c:126
static GtkWidget * create_city_report_menu(void)
Definition cityrep.c:1039
static GMenu * wl_set_menu
Definition cityrep.c:121
static void recreate_production_menu(GActionGroup *group)
Definition cityrep.c:1606
static GMenu * unit_b_select_menu
Definition cityrep.c:125
static void city_select_island_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition cityrep.c:1286
static GMenu * display_menu
Definition cityrep.c:139
static GMenu * add_first_menu
Definition cityrep.c:117
static GMenu * add_2ndlast_menu
Definition cityrep.c:120
static GMenu * add_next_menu
Definition cityrep.c:119
static GMenu * impr_a_select_menu
Definition cityrep.c:133
static void select_governor_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition cityrep.c:627
static GMenu * unit_s_select_menu
Definition cityrep.c:128
static GMenu * impr_p_select_menu
Definition cityrep.c:130
static GActionGroup * cityrep_group
Definition cityrep.c:138
static GMenu * wl_append_menu
Definition cityrep.c:122
static void governors_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:607
static GMenu * create_governor_menu(GActionGroup *group, bool change_governor)
Definition cityrep.c:686
static GMenu * create_display_menu(GActionGroup *group)
Definition cityrep.c:1011
static void recreate_select_menu(GActionGroup *group)
Definition cityrep.c:1793
static GMenu * create_production_menu(GActionGroup *group)
Definition cityrep.c:1542
static GMenuItem * create_display_menu_item(int pos)
Definition cityrep.c:979
static GMenu * select_menu
Definition cityrep.c:124
static GMenu * prod_menu
Definition cityrep.c:115
static GMenu * add_last_menu
Definition cityrep.c:118
static GMenu * cityrep_menu
Definition cityrep.c:137
static GMenu * create_wl_menu(GActionGroup *group, const char *act_pfx, GCallback cb)
Definition cityrep.c:912
static void append_impr_or_unit_to_menu(GMenu *menu, GActionGroup *act_group, const char *act_pfx, const char *act_pfx2, bool append_units, bool append_wonders, enum city_operation_type city_operation, TestCityFunc test_func, GCallback callback, int size)
Definition cityrep.c:293
static GMenu * unit_a_select_menu
Definition cityrep.c:132
static GMenu * unit_p_select_menu
Definition cityrep.c:129
static void update_governor_menu(void)
Definition cityrep.c:818
static GMenu * governor_select_menu
Definition cityrep.c:135
static GMenu * change_menu
Definition cityrep.c:116
static GMenu * wndr_b_select_menu
Definition cityrep.c:127
static GMenu * wndr_p_select_menu
Definition cityrep.c:131
static GMenu * wndr_a_select_menu
Definition cityrep.c:134
GtkWidget * aux_menu_new(void)
Definition gui_stuff.c:244
void gui_dialog_add_content_widget(struct gui_dialog *dlg, GtkWidget *wdg)
Definition gui_stuff.c:1108
GtkWidget * gui_dialog_add_action_widget(struct gui_dialog *dlg, GtkWidget *widget)
Definition gui_stuff.c:690
#define submenu_append_unref(menu, name, submenu)
Definition gui_stuff.h:165
#define menu_item_insert_unref(menu, index, item)
Definition gui_stuff.h:142
#define submenu_insert_unref(menu, index, name, submenu)
Definition gui_stuff.h:156
#define menu_item_append_unref(menu, item)
Definition gui_stuff.h:149
static void sell_callback_response(GObject *dialog, GAsyncResult *result, gpointer data)
Definition cityrep.c:652
static void fc_city_row_finalize(GObject *gobject)
Definition cityrep.c:166
static void city_factory_bind(GtkSignalListItemFactory *self, GtkListItem *list_item, gpointer user_data)
Definition cityrep.c:230
#define FC_TYPE_CITY_ROW
Definition cityrep.c:144
static GtkTreeSelection * city_selection_depr
Definition cityrep.c:105
static void fc_city_row_init(FcCityRow *self)
Definition cityrep.c:191
static void city_model_fill_depr(GtkListStore *store, GtkTreeSelection *selection, GHashTable *select)
Definition cityrep.c:348
static void city_model_set_depr(GtkListStore *store, GtkTreeIter *iter, struct city *pcity)
Definition cityrep.c:274
static void fc_city_row_class_init(FcCityRowClass *klass)
Definition cityrep.c:180
static GtkListStore * city_model_depr
Definition cityrep.c:106
static void city_store_set(FcCityRow *row, struct city *pcity)
Definition cityrep.c:293
static GtkWidget * city_view_depr
Definition cityrep.c:104
static void city_store_fill(GListStore *store, GtkMultiSelection *selection, GHashTable *select)
Definition cityrep.c:378
static GtkListStore * city_report_dialog_store_new_depr(void)
Definition cityrep.c:255
static FcCityRow * fc_city_row_new(void)
Definition cityrep.c:199
static GListStore * city_store
Definition cityrep.c:109
static void city_factory_setup(GtkSignalListItemFactory *self, GtkListItem *list_item, gpointer user_data)
Definition cityrep.c:245
int impr_sell_gold(const struct impr_type *pimprove)
Impr_type_id improvement_number(const struct impr_type *pimprove)
bool is_wonder(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
#define fc_assert_ret(condition)
Definition log.h:192
#define fc_assert_action(condition, action)
Definition log.h:188
bool is_city_hilited(struct city *pcity)
void center_tile_mapcanvas(const struct tile *ptile)
#define fc_strdup(str)
Definition mem.h:43
#define fc_realloc(ptr, sz)
Definition mem.h:36
#define fc_malloc(sz)
Definition mem.h:34
struct client_options gui_options
Definition options.c:71
struct city_list * cities
Definition packhand.c:121
bool are_universals_equal(const struct universal *psource1, const struct universal *psource2)
size_t size
Definition specvec.h:72
struct sprite int int int int struct sprite * mask
Definition sprite_g.h:32
GObjectClass parent_class
Definition cityrep.c:158
GObject parent_instance
Definition cityrep.c:150
int city_id
Definition cityrep.c:153
char ** columns
Definition cityrep.c:152
const char *(* func)(const struct city *pcity, const void *data)
Definition cityrepdata.h:34
const char * title2
Definition cityrepdata.h:31
const char * explanation
Definition cityrepdata.h:32
const char * title1
Definition cityrepdata.h:30
Definition city.h:318
struct connection conn
Definition client_main.h:96
bool center_when_popup_city
Definition options.h:162
struct player * playing
Definition connection.h:151
Definition climisc.h:82
struct universal item
Definition climisc.h:83
struct city_list * cities
Definition player.h:281
const char * imprname
Definition cityrep.c:646
const struct impr_type * building
Definition cityrep.c:645
int gold
Definition cityrep.c:69
int count
Definition cityrep.c:68
const struct impr_type * target
Definition cityrep.c:70
int id
Definition unit.h:146
struct tile * tile
Definition unit.h:141
struct unit::@84::@86 client
enum universals_n kind
Definition fc_types.h:595
universals_u value
Definition fc_types.h:594
struct civ_map map
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:925
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
bool is_terrain_class_near_tile(const struct civ_map *nmap, const struct tile *ptile, enum terrain_class tclass)
Definition terrain.c:615
#define tile_continent(_tile)
Definition tile.h:93
const struct impr_type * building
Definition fc_types.h:529
void worklist_init(struct worklist *pwl)
Definition worklist.c:38
int worklist_length(const struct worklist *pwl)
Definition worklist.c:57