Freeciv-3.3
Loading...
Searching...
No Matches
cityrep.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18#include <stdio.h>
19#include <stdlib.h>
20#include <string.h>
21
22#include <gtk/gtk.h>
23#include <gdk/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 "mapctrl_common.h" /* is_city_hilited() */
47#include "mapview_common.h"
48#include "options.h"
49
50/* client/gui-gtk-4.0 */
51#include "chatline.h"
52#include "citydlg.h"
53#include "gui_main.h"
54#include "gui_stuff.h"
55#include "mapview.h"
56#include "optiondlg.h"
57#include "repodlgs.h"
58
59#include "cityrep.h"
60
61#define NEG_VAL(x) ((x)<0 ? (x) : (-x))
62
63/* Some versions of gcc have problems with negative values here (PR#39722). */
64#define CMA_NONE (10000)
65#define CMA_CUSTOM (10001)
66
67struct sell_data {
68 int count; /* Number of cities. */
69 int gold; /* Amount of gold. */
70 const struct impr_type *target; /* The target for selling. */
71};
72
76
77/******************************************************************/
79
82
83static void city_command_callback(struct gui_dialog *dlg, int response,
84 gpointer data);
85
88 gpointer data);
89static void update_total_buy_cost(void);
90
93
94static GMenu *create_change_menu(GActionGroup *group, const char *mname,
95 const char *human_mname,
97
99
100enum {
103
107#define CRD_COL_CITY_ID (0 + NUM_CREPORT_COLS)
108
109static void recreate_production_menu(GActionGroup *group);
110static void recreate_select_menu(GActionGroup *group);
111static void recreate_sell_menu(GActionGroup *group);
112
117
126
139
141
145
146/************************************************************************/
149static void get_city_table_header(char **text, int n)
150{
151 struct city_report_spec *spec;
152 int i;
153
154 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
155 fc_snprintf(text[i], n, "%*s\n%*s",
156 NEG_VAL(spec->width), spec->title1 ? spec->title1 : "",
157 NEG_VAL(spec->width), spec->title2 ? spec->title2 : "");
158 }
159}
160
161/****************************************************************************
162 CITY REPORT DIALOG
163****************************************************************************/
164
165/************************************************************************/
169{
171 gint i;
172
173 /* City report data. */
174 for (i = 0; i < NUM_CREPORT_COLS; i++) {
176 }
177
178 /* Specific gtk client data. */
179 model_types[i++] = G_TYPE_INT; /* CRD_COL_CITY_ID */
180
182}
183
184/************************************************************************/
188 struct city *pcity)
189{
190 struct city_report_spec *spec;
191 char buf[64];
192 gint i;
193
194 for (i = 0; i < NUM_CREPORT_COLS; i++) {
195 spec = city_report_specs + i;
196 fc_snprintf(buf, sizeof(buf), "%*s", NEG_VAL(spec->width),
197 spec->func(pcity, spec->data));
198 gtk_list_store_set(store, iter, i, buf, -1);
199 }
201}
202
203/************************************************************************/
207{
208 struct city *pcity;
209 int id;
210
211 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
213 return ((NULL != pcity
216 ? NULL : pcity);
217}
218
219/************************************************************************/
223 const struct city *pcity)
224{
225 const int searched = pcity->id;
226 int id;
227
229 do {
230 gtk_tree_model_get(model, iter, CRD_COL_CITY_ID, &id, -1);
231 if (searched == id) {
232 return TRUE;
233 }
234 } while (gtk_tree_model_iter_next(model, iter));
235 }
236 return FALSE;
237}
238
239/************************************************************************/
242static void city_model_fill(GtkListStore *store,
243 GtkTreeSelection *selection, GHashTable *select)
244{
246
247 if (client_has_player()) {
250 city_model_set(store, &iter, pcity);
251 if (NULL != select
254 }
256 } else {
257 /* Global observer case. */
260 city_model_set(store, &iter, pcity);
261 if (NULL != select
264 }
266 }
267}
268
269/************************************************************************/
286
287/************************************************************************/
296
297/************************************************************************/
302 const char *act_pfx,
303 const char *act_pfx2,
304 bool append_units,
305 bool append_wonders,
310 int size)
311{
313 struct item items[MAX_NUM_PRODUCTION_TARGETS];
314 int i, item, targets_used;
315 char *row[4];
316 char buf[4][64];
317
318 GtkSizeGroup *size_group[3];
319
320 if (city_operation != CO_NONE) {
321 GPtrArray *selected;
322 ITree it;
323 int num_selected = 0;
325 struct city **data;
326
327 selected = g_ptr_array_sized_new(size);
328
329 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
330 struct city *pcity;
331
333 || !(pcity = city_model_get(model, TREE_ITER_PTR(it)))) {
334 continue;
335 }
336
337 g_ptr_array_add(selected, pcity);
338 num_selected++;
339 }
340
341 data = (struct city **)g_ptr_array_free(selected, FALSE);
345 g_free(data);
346 } else {
349 test_func);
350 }
351
352 name_and_sort_items(targets, targets_used, items,
354
355 for (i = 0; i < 4; i++) {
356 row[i] = buf[i];
357 }
358
359
360 for (i = 0; i < 3; i++) {
362 }
363
364 for (item = 0; item < targets_used; item++) {
365 struct universal target = items[item].item;
367 char actbuf[256];
368 GSimpleAction *act;
369
370 get_city_dialog_production_row(row, sizeof(buf[0]), &target, NULL);
371
372 fc_snprintf(actbuf, sizeof(actbuf), "win.%s%s%d", act_pfx, act_pfx2, item);
373
375
376 fc_snprintf(actbuf, sizeof(actbuf), "%s%s%d", act_pfx, act_pfx2, item);
378 g_object_set_data(G_OBJECT(act), "freeciv_test_func", test_func);
379 g_object_set_data(G_OBJECT(act), "freeciv_city_operation",
382 g_signal_connect(act, "activate", callback,
383 GINT_TO_POINTER(cid_encode(target)));
385 }
386
387 for (i = 0; i < 3; i++) {
388 g_object_unref(size_group[i]);
389 }
390}
391
392/************************************************************************/
397{
398 struct universal target = cid_decode(GPOINTER_TO_INT(data));
399 struct city *pcity = city_model_get(model, iter);
400
401 if (NULL != pcity) {
403 }
404}
405
406/************************************************************************/
412 GtkTreePath *path,
414 gpointer data)
415{
416 struct universal target = cid_decode(GPOINTER_TO_INT(data));
417 struct city *pcity = city_model_get(model, iter);
418
419 if (NULL != pcity) {
420 (void) city_queue_insert(pcity, -1, &target);
421 }
422 /* Perhaps should warn the user if not successful? */
423}
424
425/************************************************************************/
433 GtkTreePath *path,
435 gpointer data)
436{
437 struct universal target = cid_decode(GPOINTER_TO_INT(data));
438 struct city *pcity = city_model_get(model, iter);
439
440 if (NULL != pcity) {
441 (void) city_queue_insert(pcity, 0, &target);
442 }
443 /* Perhaps should warn the user if not successful? */
444}
445
446/************************************************************************/
453 GtkTreePath *path,
455 gpointer data)
456{
457 struct universal target = cid_decode(GPOINTER_TO_INT(data));
458 struct city *pcity = city_model_get(model, iter);
459
460 if (NULL != pcity) {
461 (void) city_queue_insert(pcity, 1, &target);
462 }
463 /* Perhaps should warn the user if not successful? */
464}
465
466/************************************************************************/
472 GtkTreePath *path,
474 gpointer data)
475{
476 struct universal target = cid_decode(GPOINTER_TO_INT(data));
477 struct city *pcity = city_model_get(model, iter);
478
479 if (NULL != pcity) {
480 city_queue_insert(pcity, worklist_length(&pcity->worklist), &target);
481 }
482}
483
484/************************************************************************/
489{
490 struct sell_data *sd = (struct sell_data *) data;
491 struct city *pcity = city_model_get(model, iter);
492
493 if (NULL != pcity
494 && !pcity->did_sell
495 && city_has_building(pcity, sd->target)) {
496 sd->count++;
497 sd->gold += impr_sell_gold(sd->target);
499 }
500}
501
502/************************************************************************/
507 GVariant *parameter,
508 gpointer data)
509{
510 struct universal target = cid_decode(GPOINTER_TO_INT(data));
511 TestCityFunc test_func = g_object_get_data(G_OBJECT(action), "freeciv_test_func");
513 GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), "freeciv_city_operation"));
514
515 /* If this is not a city operation: */
516 if (city_operation == CO_NONE) {
518 ITree it;
519
521 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
522 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
523
524 if (NULL != pcity && test_func(pcity, &target)) {
526 }
527 }
528 } else {
530
532 switch (city_operation) {
533 case CO_LAST:
536 GINT_TO_POINTER(cid_encode(target)));
537 break;
538 case CO_CHANGE:
541 GINT_TO_POINTER(cid_encode(target)));
542 break;
543 case CO_FIRST:
546 GINT_TO_POINTER(cid_encode(target)));
547 break;
548 case CO_NEXT:
551 GINT_TO_POINTER(cid_encode(target)));
552 break;
553 case CO_NEXT_TO_LAST:
556 GINT_TO_POINTER(cid_encode(target)));
557 break;
558 case CO_SELL:
559 fc_assert_action(target.kind == VUT_IMPROVEMENT, break);
560 {
561 const struct impr_type *building = target.value.building;
562 struct sell_data sd = { 0, 0, building };
563 GtkWidget *w;
564 gint res;
565 gchar *buf;
566 const char *imprname = improvement_name_translation(building);
567
568 /* Ask confirmation */
569 buf = g_strdup_printf(_("Are you sure you want to sell those %s?"), imprname);
572 GTK_BUTTONS_YES_NO, "%s", buf);
573 g_free(buf);
574 res = blocking_dialog(w); /* Synchron. */
576 if (res == GTK_RESPONSE_NO) {
577 break;
578 }
579
582 if (sd.count > 0) {
583 /* FIXME: plurality of sd.count is ignored! */
584 /* TRANS: "Sold 3 Harbor for 90 gold." (Pluralisation is in gold --
585 * second %d -- not in buildings.) */
588 PL_("Sold %d %s for %d gold.",
589 "Sold %d %s for %d gold.",
590 sd.gold),
591 sd.count, imprname, sd.gold);
592 } else {
595 _("No %s could be sold."),
596 imprname);
597 }
598
599 g_signal_connect(w, "response",
601 gtk_window_present(GTK_WINDOW(w)); /* Asynchron. */
602 }
603 break;
604 case CO_NONE:
605 break;
606 }
608 }
609}
610
611/************************************************************************/
616{
617 struct city *pcity = city_model_get(model, iter);
618 int idx = GPOINTER_TO_INT(data);
619
620 if (NULL != pcity) {
621 if (CMA_NONE == idx) {
623 } else {
625 }
627 }
628}
629
630/************************************************************************/
635 GVariant *parameter,
636 gpointer data)
637{
638 int idx = GPOINTER_TO_INT(data);
639 bool change_governor =
641 struct cm_parameter cm;
642
643 /* If this is not the change button but the select cities button. */
644 if (!change_governor) {
645 ITree it;
647
649 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
650 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
651 int controlled;
652 bool select;
653
654 if (NULL == pcity) {
655 continue;
656 }
658 select = FALSE;
659
660 if (idx == CMA_NONE) {
661 /* CMA_NONE selects not-controlled, all others require controlled */
662 if (!controlled) {
663 select = TRUE;
664 }
665 } else if (controlled) {
666 if (idx == CMA_CUSTOM) {
668 select = TRUE;
669 }
670 } else if (cm_are_parameter_equal(&cm,
672 select = TRUE;
673 }
674 }
675
676 if (select) {
678 }
679 }
680 } else {
683 GINT_TO_POINTER(idx));
684 }
685}
686
687/************************************************************************/
694 bool change_governor)
695{
696 GMenu *menu;
697 int i;
698 struct cm_parameter cm;
699
700 menu = g_menu_new();
701
703 return menu;
704 }
705
706 if (change_governor) {
707 GSimpleAction *act;
708
709 act = g_simple_action_new("chg_governor_none", NULL);
710 g_object_set_data(G_OBJECT(act), "governor",
716 g_menu_item_new(Q_("?cma:none"),
717 "win.chg_governor_none"));
718
719 for (i = 0; i < cmafec_preset_num(); i++) {
720 char buf[128];
721
722 fc_snprintf(buf, sizeof(buf), "chg_governor_%d", i);
724 g_object_set_data(G_OBJECT(act), "governor",
729 fc_snprintf(buf, sizeof(buf), "win.chg_governor_%d", i);
732 }
733 } else {
734 /* Search for a "none" */
735 bool found;
736
737 found = FALSE;
740 found = TRUE;
741 break;
742 }
744
745 if (found) {
746 GSimpleAction *act;
747
748 act = g_simple_action_new("sel_governor_none", NULL);
749 g_object_set_data(G_OBJECT(act), "governor",
755 g_menu_item_new(Q_("?cma:none"),
756 "win.sel_governor_none"));
757 }
758
759 /*
760 * Search for a city that's under custom (not preset) agent. Might
761 * take a lonnggg time.
762 */
763 found = FALSE;
767 found = TRUE;
768 break;
769 }
771
772 if (found) {
773 /* We found city that's under agent but not a preset */
774 GSimpleAction *act;
775
776 act = g_simple_action_new("sel_governor_custom", NULL);
777 g_object_set_data(G_OBJECT(act), "governor",
783 g_menu_item_new(Q_("?cma:custom"),
784 "win.sel_governor_custom"));
785 }
786
787 /* Only fill in presets that are being used. */
788 for (i = 0; i < cmafec_preset_num(); i++) {
789 found = FALSE;
794 found = TRUE;
795 break;
796 }
798
799 if (found) {
800 GSimpleAction *act;
801 char buf[128];
802
803 fc_snprintf(buf, sizeof(buf), "sel_governor_%d", i);
804
806 g_object_set_data(G_OBJECT(act), "governor",
811 fc_snprintf(buf, sizeof(buf), "win.sel_governor_%d", i);
814 buf));
815 }
816 }
817 }
818
819 return menu;
820}
821
822/************************************************************************/
831
832/************************************************************************/
839{
840 const struct worklist *pwl = data;
841 struct city *pcity = city_model_get(model, iter);
842
844
845 if (NULL != pcity) {
847 }
848}
849
850/************************************************************************/
856 GVariant *parameter,
857 gpointer data)
858{
859 struct global_worklist *pgwl =
861
863
864 if (!pgwl) {
865 /* Maybe removed by an other way, not an error. */
866 return;
867 }
868
872}
873
874/************************************************************************/
880{
881 const struct worklist *pwl = data;
882 struct city *pcity = city_model_get(model, iter);
883
885
886 if (NULL != pcity) {
888 }
889}
890
891/************************************************************************/
896 GVariant *parameter,
897 gpointer data)
898{
899 struct global_worklist *pgwl =
901
905
906 if (!pgwl) {
907 /* Maybe removed by an other way, not an error. */
908 return;
909 }
910
914}
915
916/************************************************************************/
919static GMenu *create_wl_menu(GActionGroup *group, const char *act_pfx,
920 GCallback cb)
921{
922 GMenu *menu;
923 GSimpleAction *act;
924 int count = 0;
925
926 menu = g_menu_new();
927
929 return NULL;
930 }
931
933 char buf[128];
934
935 fc_snprintf(buf, sizeof(buf), "wl%s%d", act_pfx, count);
938 g_signal_connect(act, "activate", cb,
940 fc_snprintf(buf, sizeof(buf), "win.wl%s%d", act_pfx, count);
943 buf));
944 count++;
946
947 if (count == 0) {
948 char buf[64];
949
950 fc_snprintf(buf, sizeof(buf), "win.wl%s_dummy", act_pfx);
952 g_menu_item_new(_("(no worklists defined)"), buf));
953 }
954
955 return menu;
956}
957
958/************************************************************************/
962{
963 struct city_report_spec *spec;
966 GList *columns, *p;
967
970
972
973 for (p = columns; p != NULL; p = p->next) {
974 col = p->data;
975 spec = g_object_get_data(G_OBJECT(col), "city_report_spec");
977 }
978
980}
981
982/************************************************************************/
987{
989 char act_name[50];
990 struct city_report_spec *spec = city_report_specs + pos;
991
992 fc_snprintf(act_name, sizeof(act_name), "win.display%d(%s)",
993 pos, spec->show ? "true" : "false");
996
997 return item;
998}
999
1000/************************************************************************/
1004{
1005 struct city_report_spec *spec = data;
1006 int idx = spec - city_report_specs;
1007
1008 spec->show ^= 1;
1010
1013}
1014
1015/************************************************************************/
1019{
1020 struct city_report_spec *spec;
1021 int i;
1023
1025 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
1026 GSimpleAction *act;
1027 char act_name[50];
1028 GVariant *var = g_variant_new("b", TRUE);
1029
1030 fc_snprintf(act_name, sizeof(act_name), "display%d", i);
1033 g_signal_connect(act, "change-state", G_CALLBACK(toggle_view), (gpointer)spec);
1034
1036 }
1037
1039
1040 return display_menu;
1041}
1042
1043/************************************************************************/
1081
1082/************************************************************************/
1087{
1089 gchar *str1, *str2;
1090 int i;
1091
1092 gtk_tree_model_get(model, a, col, &str1, -1);
1093 gtk_tree_model_get(model, b, col, &str2, -1);
1094
1096 g_free(str1);
1097 g_free(str2);
1098 return i;
1099}
1100
1101/************************************************************************/
1105{
1106 static char **titles;
1107 static char (*buf)[128];
1108 struct city_report_spec *spec;
1109
1110 GtkWidget *w, *sw, *aux_menu;
1111 int i;
1112
1115
1117
1120
1121 /* Menu */
1124
1125 /* Buttons */
1132
1134 _("_Buy"), CITY_BUY);
1135 city_buy_command = w;
1136
1138 _("_Inspect"), CITY_POPUP);
1140
1142 _("Cen_ter"), CITY_CENTER);
1144
1145 /* Tree view */
1146 buf = fc_realloc(buf, NUM_CREPORT_COLS * sizeof(buf[0]));
1148 for (i = 0; i < NUM_CREPORT_COLS; i++) {
1149 titles[i] = buf[i];
1150 }
1151 get_city_table_header(titles, sizeof(buf[0]));
1152
1154
1159 gtk_widget_set_name(city_view, "small_font");
1160 g_signal_connect(city_view, "row_activated",
1166
1167 for (i = 0, spec = city_report_specs; i < NUM_CREPORT_COLS; i++, spec++) {
1168 GtkWidget *header;
1169 GtkCellRenderer *renderer;
1171
1172 renderer = gtk_cell_renderer_text_new();
1174 "text", i, NULL);
1175 header = gtk_label_new(titles[i]);
1182 g_object_set_data(G_OBJECT(col), "city_report_spec", spec);
1186 NULL);
1187 }
1188
1194
1196
1199
1200 /* Real menus */
1204
1206}
1207
1208/************************************************************************/
1217
1218/************************************************************************/
1227
1228/************************************************************************/
1232 GVariant *parameter,
1233 gpointer data)
1234{
1235 ITree it;
1237
1238 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1241 } else {
1243 }
1244 }
1245}
1246
1247/************************************************************************/
1251 GVariant *parameter,
1252 gpointer data)
1253{
1254 ITree it;
1256
1258
1259 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1260 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1261
1262 if (pcity != NULL
1265 }
1266 }
1267}
1268
1269/************************************************************************/
1273 GtkTreeIter *iter, gpointer data)
1274{
1275 struct city *selected_pcity = city_model_get(model, iter);
1276 ITree it;
1277
1278 if (NULL == selected_pcity) {
1279 return;
1280 }
1281
1282 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1283 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1284
1285 if (NULL != pcity
1287 == tile_continent(selected_pcity->tile))) {
1289 }
1290 }
1291}
1292
1293/************************************************************************/
1303
1304/************************************************************************/
1308 GVariant *parameter,
1309 gpointer data)
1310{
1312 ITree it;
1314
1316
1317 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1318 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1319
1320 if (NULL != pcity
1321 && ((which == PCT_UNIT && VUT_UTYPE == pcity->production.kind)
1322 || (which == PCT_IMPROVEMENT
1323 && VUT_IMPROVEMENT == pcity->production.kind
1324 && !is_wonder(pcity->production.value.building))
1325 || (which == PCT_WONDER
1326 && VUT_IMPROVEMENT == pcity->production.kind
1327 && is_wonder(pcity->production.value.building)))) {
1329 }
1330 }
1331}
1332
1333/************************************************************************/
1336static void buy_iterate(GtkTreeModel *model, GtkTreePath *path,
1337 GtkTreeIter *iter, gpointer data)
1338{
1339 struct city *pcity = city_model_get(model, iter);
1340
1341 if (NULL != pcity) {
1343 }
1344}
1345
1346/************************************************************************/
1349static void center_iterate(GtkTreeModel *model, GtkTreePath *path,
1350 GtkTreeIter *iter, gpointer data)
1351{
1352 struct city *pcity = city_model_get(model, iter);
1353
1354 if (NULL != pcity) {
1356 }
1357}
1358
1359/************************************************************************/
1362static void popup_iterate(GtkTreeModel *model, GtkTreePath *path,
1363 GtkTreeIter *iter, gpointer data)
1364{
1365 struct city *pcity = city_model_get(model, iter);
1366
1367 if (NULL != pcity) {
1370 }
1372 }
1373}
1374
1375/************************************************************************/
1378static void city_command_callback(struct gui_dialog *dlg, int response,
1379 gpointer data)
1380{
1381 switch (response) {
1382 case CITY_CENTER:
1384 /* Center to city doesn't make sense if many city are selected. */
1386 NULL);
1387 }
1388 break;
1389 case CITY_POPUP:
1391 break;
1392 case CITY_BUY:
1394 break;
1395 default:
1396 gui_dialog_destroy(dlg);
1397 break;
1398 }
1399}
1400
1401/************************************************************************/
1406{
1407 GtkTreeModel *model;
1409 GdkSurface *win;
1410 GdkSeat *seat;
1412
1414
1415 if (!gtk_tree_model_get_iter(model, &iter, path)) {
1416 return;
1417 }
1418
1421
1423 NULL, NULL, &mask);
1424
1425 if (!(mask & GDK_CONTROL_MASK)) {
1426 popup_iterate(model, path, &iter, NULL);
1427 } else {
1428 center_iterate(model, path, &iter, NULL);
1429 }
1430}
1431
1432/************************************************************************/
1436{
1437 GHashTable *selected;
1438 ITree iter;
1439 gint city_id;
1440
1441 if (NULL == city_dialog_shell) {
1442 return;
1443 }
1444
1445 /* Save the selection. */
1446 selected = g_hash_table_new(NULL, NULL);
1448 !itree_end(&iter); itree_next(&iter)) {
1450 itree_get(&iter, CRD_COL_CITY_ID, &city_id, -1);
1451 g_hash_table_insert(selected, GINT_TO_POINTER(city_id), NULL);
1452 }
1453 }
1454
1455 /* Update and restore the selection. */
1458 g_hash_table_destroy(selected);
1459
1461}
1462
1463/************************************************************************/
1467{
1469
1470 if (NULL == city_dialog_shell) {
1471 return;
1472 }
1473
1476 }
1478
1480}
1481
1482/************************************************************************/
1491static GMenu *create_change_menu(GActionGroup *group, const char *mname,
1492 const char *human_mname,
1494{
1495 GMenu *menu = g_menu_new();
1496 GMenu *submenu;
1497 int n;
1498 char buf[128];
1499
1501
1502 submenu = g_menu_new();
1504 TRUE, FALSE, oper,
1507 fc_snprintf(buf, sizeof(buf), human_mname, _("Unit"));
1509
1510 submenu = g_menu_new();
1512 FALSE, FALSE, oper,
1515 fc_snprintf(buf, sizeof(buf), human_mname, _("Improvement"));
1517
1518 submenu = g_menu_new();
1520 FALSE, TRUE, oper,
1523 fc_snprintf(buf, sizeof(buf), human_mname, _("Wonder"));
1525
1526 return menu;
1527}
1528
1529/************************************************************************/
1533{
1534 int n;
1535 GMenu *menu = g_menu_new();
1536
1538
1539 append_impr_or_unit_to_menu(menu, group, "sell", "",
1543 n);
1544
1546 submenu_insert_unref(cityrep_menu, 2, _("S_ell"), G_MENU_MODEL(menu));
1547}
1548
1549/************************************************************************/
1553{
1554 GSimpleAction *act;
1555
1557
1558 /* TRANS: Menu name part to be used like "Change to Improvement"
1559 * This is about changing current production. */
1560 change_menu = create_change_menu(group, "change", _("Change to %s"), CO_CHANGE);
1562
1564
1565 /* TRANS: Menu name to be used like "Set Improvement first"
1566 * This is about adding item to the beginning of the worklist. */
1567 add_first_menu = create_change_menu(group, "first", _("Set %s first"), CO_FIRST);
1568 submenu_append_unref(prod_menu, _("Add _First"),
1570
1572
1573 /* TRANS: Menu name to be used like "Set Improvement last"
1574 * This is about adding item to the end of the worklist. */
1575 add_last_menu = create_change_menu(group, "last", _("Set %s last"), CO_LAST);
1576 submenu_append_unref(prod_menu, _("Add _Last"),
1578
1580
1581 /* TRANS: Menu name to be used like "Set Improvement next"
1582 * This is about adding item after current one on the worklist. */
1583 add_next_menu = create_change_menu(group, "next", _("Set %s next"), CO_NEXT);
1584 submenu_append_unref(prod_menu, _("Add _Next"),
1586
1588
1589 /* TRANS: Menu name to be used like "Set Improvement 2nd last"
1590 * This is about adding item as second last on the worklist. */
1591 add_2ndlast_menu = create_change_menu(group, "2ndlast", _("Set %s 2nd last"), CO_NEXT_TO_LAST);
1592 submenu_append_unref(prod_menu, _("Add _2nd Last"),
1594
1596 submenu_append_unref(prod_menu, _("Set Worklist"),
1598
1600 submenu_append_unref(prod_menu, _("Append Worklist"),
1602
1603 act = g_simple_action_new("clear_worklist", NULL);
1606 NULL);
1608 "win.clear_worklist"));
1609
1610 return prod_menu;
1611}
1612
1613/************************************************************************/
1632
1633/************************************************************************/
1636static bool city_building_impr_or_unit(const struct city *pcity,
1637 const struct universal *target)
1638{
1639 return are_universals_equal(&pcity->production, target);
1640}
1641
1642/************************************************************************/
1646{
1647 GSimpleAction *act;
1648 char buf[128];
1649
1651
1652#if 0
1655#endif
1656
1657 act = g_simple_action_new("select_all", NULL);
1660 NULL);
1662 "win.select_all"));
1663
1664 act = g_simple_action_new("select_none", NULL);
1667 NULL);
1669 "win.select_none"));
1670
1671 act = g_simple_action_new("select_invert", NULL);
1674 NULL);
1676 "win.select_invert"));
1677
1678 act = g_simple_action_new("select_build_unit", NULL);
1683 "win.select_build_unit"));
1684
1685 act = g_simple_action_new("select_build_impr", NULL);
1689 menu_item_append_unref(select_menu, g_menu_item_new(_("Building Improvements"),
1690 "win.select_build_impr"));
1691
1692 act = g_simple_action_new("select_build_wonder", NULL);
1697 "win.select_build_wonder"));
1698
1700 append_impr_or_unit_to_menu(unit_b_select_menu, group, "sel", "_b_u",
1701 TRUE, FALSE, CO_NONE,
1704 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Unit"));
1706
1708 append_impr_or_unit_to_menu(impr_b_select_menu, group, "sel", "_b_b",
1712 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Improvement"));
1714
1716 append_impr_or_unit_to_menu(wndr_b_select_menu, group, "sel", "_b_w",
1717 FALSE, TRUE, CO_NONE,
1720 fc_snprintf(buf, sizeof(buf), _("Building %s"), _("Wonder"));
1722
1723 act = g_simple_action_new("select_coastal", NULL);
1726 NULL);
1728 "win.select_coastal"));
1729
1730 act = g_simple_action_new("select_island", NULL);
1733 NULL);
1735 "win.select_island"));
1736
1738 append_impr_or_unit_to_menu(unit_s_select_menu, group, "sel", "_s_u",
1739 TRUE, FALSE, CO_NONE,
1742 fc_snprintf(buf, sizeof(buf), _("Supported %s"), _("Unit"));
1744
1746 append_impr_or_unit_to_menu(unit_p_select_menu, group, "sel", "_p_u",
1747 TRUE, FALSE, CO_NONE,
1750 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Unit"));
1752
1754 append_impr_or_unit_to_menu(impr_p_select_menu, group, "sel", "_p_b",
1758 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Improvement"));
1760
1762 append_impr_or_unit_to_menu(wndr_p_select_menu, group, "sel", "_p_w",
1763 FALSE, TRUE, CO_NONE,
1766 fc_snprintf(buf, sizeof(buf), _("Present %s"), _("Wonder"));
1768
1770 append_impr_or_unit_to_menu(unit_a_select_menu, group, "sel", "_a_u",
1771 TRUE, FALSE, CO_NONE,
1774 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Unit"));
1776
1778 append_impr_or_unit_to_menu(impr_a_select_menu, group, "sel", "_a_b",
1782 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Improvement"));
1784
1786 append_impr_or_unit_to_menu(wndr_a_select_menu, group, "sel", "_a_w",
1787 FALSE, TRUE, CO_NONE,
1790 fc_snprintf(buf, sizeof(buf), _("Available %s"), _("Wonder"));
1792
1794 submenu_append_unref(select_menu, _("Citizen Governor"),
1796
1797 return select_menu;
1798}
1799
1800/************************************************************************/
1823
1824/************************************************************************/
1828static void update_total_buy_cost(void)
1829{
1830 GtkWidget *label, *view;
1831 GList *rows, *p;
1832 GtkTreeModel *model;
1834 GtkTreePath *path;
1836 struct city *pcity;
1837 int total = 0;
1838
1839 view = city_view;
1841
1842 if (!view || !label) {
1843 return;
1844 }
1845
1848
1849 for (p = rows; p != NULL; p = p->next) {
1850 path = p->data;
1851 if (gtk_tree_model_get_iter(model, &iter, path)) {
1852 if ((pcity = city_model_get(model, &iter))) {
1853 total += pcity->client.buy_cost;
1854 }
1855 }
1856 gtk_tree_path_free(path);
1857 }
1859
1860 if (total > 0) {
1861 gchar *buf = g_strdup_printf(_("Total Buy Cost: %d"), total);
1862
1864 g_free(buf);
1865 } else {
1867 }
1868}
1869
1870/************************************************************************/
1884
1885/************************************************************************/
1889 GtkTreePath *path,
1891 gpointer data)
1892{
1893 struct city *pcity = city_model_get(model, iter);
1894
1895 if (NULL != pcity) {
1896 struct worklist empty;
1897
1900 }
1901}
1902
1903/************************************************************************/
1918
1919/************************************************************************/
1925{
1926 ITree it;
1927 GtkTreeModel *model;
1928
1929 if (!city_dialog_shell) {
1930 return;
1931 }
1932
1933 model = GTK_TREE_MODEL(city_model);
1934
1936
1937 for (itree_begin(model, &it); !itree_end(&it); itree_next(&it)) {
1938 struct city *pcity = city_model_get(model, TREE_ITER_PTR(it));
1939
1940 if (NULL != pcity && is_city_hilited(pcity)) {
1942 }
1943 }
1944}
1945
1946/************************************************************************/
1950{
1952
1953 if (NULL == city_dialog_shell) {
1954 return;
1955 }
1956
1958 if (on_off) {
1960 } else {
1962 }
1963 }
1964}
#define n
Definition astring.c:77
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
Definition city.c:1240
#define cities_iterate_end
Definition city.h:514
#define city_list_iterate(citylist, pcity)
Definition city.h:505
#define cities_iterate(pcity)
Definition city.h:509
#define city_owner(_pcity_)
Definition city.h:560
#define city_list_iterate_end
Definition city.h:507
void get_city_dialog_production_row(char *buf[], size_t column_size, struct universal *target, struct city *pcity)
int city_set_worklist(struct city *pcity, const struct worklist *pworklist)
bool city_queue_insert(struct city *pcity, int position, struct universal *item)
bool city_queue_insert_worklist(struct city *pcity, int position, const struct worklist *worklist)
bool city_set_queue(struct city *pcity, const struct worklist *pqueue)
int city_change_production(struct city *pcity, struct universal *target)
int city_sell_improvement(struct city *pcity, Impr_type_id sell_id)
void popup_city_dialog(struct city *pcity)
void refresh_city_dialog(struct city *pcity)
bool can_city_sell_universal(const struct city *pcity, const struct universal *target)
struct city_report_spec * city_report_specs
int cityrepfield_compare(const char *str1, const char *str2)
#define NUM_CREPORT_COLS
Definition cityrepdata.h:25
struct civclient client
bool can_client_issue_orders(void)
bool client_has_player(void)
#define client_player()
bool city_unit_supported(const struct city *pcity, const struct universal *target)
Definition climisc.c:545
void cityrep_buy(struct city *pcity)
Definition climisc.c:1155
void name_and_sort_items(struct universal *targets, int num_targets, struct item *items, bool show_cost, struct city *pcity)
Definition climisc.c:650
cid cid_encode(struct universal target)
Definition climisc.c:483
bool city_building_present(const struct city *pcity, const struct universal *target)
Definition climisc.c:583
struct universal cid_decode(cid id)
Definition climisc.c:526
bool can_city_build_now_client(const struct city *pcity, const struct universal *target)
Definition climisc.c:593
bool city_unit_present(const struct city *pcity, const struct universal *target)
Definition climisc.c:564
int collect_production_targets(struct universal *targets, struct city **selected_cities, int num_selected_cities, bool append_units, bool append_wonders, bool change_prod, TestCityFunc test_func)
Definition climisc.c:700
#define MAX_NUM_PRODUCTION_TARGETS
Definition climisc.h:89
bool(* TestCityFunc)(const struct city *, const struct universal *)
Definition climisc.h:87
bool cm_are_parameter_equal(const struct cm_parameter *const p1, const struct cm_parameter *const p2)
Definition cm.c:2141
bool cma_is_city_under_agent(const struct city *pcity, struct cm_parameter *parameter)
Definition cma_core.c:552
void cma_put_city_under_agent(struct city *pcity, const struct cm_parameter *const parameter)
Definition cma_core.c:524
void cma_release_city(struct city *pcity)
Definition cma_core.c:542
char * cmafec_preset_get_descr(int idx)
Definition cma_fec.c:169
const struct cm_parameter * cmafec_preset_get_parameter(int idx)
Definition cma_fec.c:182
int cmafec_preset_get_index_of_parameter(const struct cm_parameter *const parameter)
Definition cma_fec.c:196
int cmafec_preset_num(void)
Definition cma_fec.c:213
char * incite_cost
Definition comments.c:76
void connection_do_buffer(struct connection *pc)
Definition connection.c:324
void connection_do_unbuffer(struct connection *pc)
Definition connection.c:336
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:78
int int id
Definition editgui_g.h:28
#define Q_(String)
Definition fcintl.h:70
#define PL_(String1, String2, n)
Definition fcintl.h:71
#define _(String)
Definition fcintl.h:67
struct world wld
Definition game.c:62
struct city * game_city_by_number(int id)
Definition game.c:106
struct global_worklist * global_worklist_by_id(int id)
const char * global_worklist_name(const struct global_worklist *pgwl)
int global_worklist_id(const struct global_worklist *pgwl)
const struct worklist * global_worklist_get(const struct global_worklist *pgwl)
#define global_worklists_iterate(pgwl)
#define global_worklists_iterate_end
static void append_worklist_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:857
static void create_city_report_dialog(bool make_modal)
Definition cityrep.c:1142
static void city_invert_selection_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1263
static GtkWidget * city_popup_command
Definition cityrep.c:119
static void worklist_next_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:513
static GtkWidget * city_total_buy_cost_label
Definition cityrep.c:124
static GtkWidget * city_buy_command
Definition cityrep.c:120
static void update_total_buy_cost(void)
Definition cityrep.c:1963
void real_city_report_dialog_update(void *unused)
Definition cityrep.c:1458
#define CRD_COL_CITY_ID
Definition cityrep.c:107
void real_city_report_update_city(struct city *pcity)
Definition cityrep.c:1493
static void city_select_building_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1332
static void popup_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1385
static void create_select_menu(GtkWidget *item)
Definition cityrep.c:1774
static void city_activated_callback(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data)
Definition cityrep.c:1427
static void select_impr_or_unit_callback(GtkWidget *wdg, gpointer data)
Definition cityrep.c:567
static void impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:456
static void city_model_fill(GtkListStore *store, GtkTreeSelection *selection, GHashTable *select)
Definition cityrep.c:262
static void center_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1372
void toggle_city_hilite(struct city *pcity, bool on_off)
Definition cityrep.c:2093
static bool city_building_impr_or_unit(const struct city *pcity, const struct universal *target)
Definition cityrep.c:1893
#define CMA_NONE
Definition cityrep.c:64
static gint cityrep_sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer data)
Definition cityrep.c:1123
static struct city * city_model_get(GtkTreeModel *model, GtkTreeIter *iter)
Definition cityrep.c:226
static void city_select_coastal_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1280
static void popup_select_menu(GtkMenuShell *menu, gpointer data)
Definition cityrep.c:1902
static void city_command_callback(struct gui_dialog *dlg, int response, gpointer data)
Definition cityrep.c:1401
static void city_model_set(GtkListStore *store, GtkTreeIter *iter, struct city *pcity)
Definition cityrep.c:207
static void city_clear_worklist_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:2053
static GtkListStore * city_model
Definition cityrep.c:106
static void clear_worklist_foreach_func(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:2035
#define NEG_VAL(x)
Definition cityrep.c:61
static void city_select_all_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1247
#define CMA_CUSTOM
Definition cityrep.c:65
static void sell_impr_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:548
static GtkTreeSelection * city_selection
Definition cityrep.c:105
static void same_island_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1300
static void set_worklist_callback(GtkMenuItem *menuitem, gpointer data)
Definition cityrep.c:913
static void city_selection_changed_callback(GtkTreeSelection *selection)
Definition cityrep.c:2009
static gboolean city_model_find(GtkTreeModel *model, GtkTreeIter *iter, const struct city *pcity)
Definition cityrep.c:242
static void worklist_next_to_last_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:532
static GtkListStore * city_report_dialog_store_new(void)
Definition cityrep.c:188
static int city_dialog_shell_is_modal
Definition cityrep.c:162
static void city_report_update_views(void)
Definition cityrep.c:986
static void get_city_table_header(char **text, int n)
Definition cityrep.c:169
void hilite_cities_from_canvas(void)
Definition cityrep.c:2070
void city_report_dialog_popdown(void)
Definition cityrep.c:312
void city_report_dialog_popup(bool raise)
Definition cityrep.c:292
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:493
static void set_worklist_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:896
static void toggle_view(GtkCheckMenuItem *item, gpointer data)
Definition cityrep.c:1010
static void append_worklist_callback(GtkMenuItem *menuitem, gpointer data)
Definition cityrep.c:875
static void city_unselect_all_callback(GtkMenuItem *item, gpointer data)
Definition cityrep.c:1255
static void worklist_last_impr_or_unit_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:472
static GtkWidget * city_center_command
Definition cityrep.c:118
static void buy_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:1359
city_operation_type
Definition cityrep.c:73
@ CO_SELL
Definition cityrep.c:74
@ CO_NEXT_TO_LAST
Definition cityrep.c:74
@ CO_NEXT
Definition cityrep.c:74
@ CO_CHANGE
Definition cityrep.c:74
@ CO_FIRST
Definition cityrep.c:74
@ CO_LAST
Definition cityrep.c:74
@ CO_NONE
Definition cityrep.c:74
static void recreate_sell_menu(void)
Definition cityrep.c:1747
static void create_change_menu(GtkWidget *item)
Definition cityrep.c:1512
static struct tile * pos
Definition finddlg.c:53
GtkWidget * top_notebook
Definition gui_main.c:130
void gui_dialog_destroy(struct gui_dialog *dlg)
Definition gui_stuff.c:954
void gui_dialog_present(struct gui_dialog *dlg)
Definition gui_stuff.c:835
void itree_get(ITree *it,...)
Definition gui_stuff.c:164
void gui_dialog_raise(struct gui_dialog *dlg)
Definition gui_stuff.c:865
void gui_dialog_new(struct gui_dialog **pdlg, GtkNotebook *notebook, gpointer user_data, bool check_top)
Definition gui_stuff.c:517
void gui_dialog_response_set_callback(struct gui_dialog *dlg, GUI_DIALOG_RESPONSE_FUN fun)
Definition gui_stuff.c:988
void itree_begin(GtkTreeModel *model, ITree *it)
Definition gui_stuff.c:127
void itree_unselect(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:206
void gui_dialog_show_all(struct gui_dialog *dlg)
Definition gui_stuff.c:795
void itree_select(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:198
void gui_dialog_set_title(struct gui_dialog *dlg, const char *title)
Definition gui_stuff.c:935
void gui_dialog_set_default_size(struct gui_dialog *dlg, int width, int height)
Definition gui_stuff.c:919
void itree_next(ITree *it)
Definition gui_stuff.c:144
gboolean itree_is_selected(GtkTreeSelection *selection, ITree *it)
Definition gui_stuff.c:190
GtkWidget * gui_dialog_add_button(struct gui_dialog *dlg, const char *icon_name, const char *text, int response)
Definition gui_stuff.c:706
gboolean itree_end(ITree *it)
Definition gui_stuff.c:136
#define TREE_ITER_PTR(x)
Definition gui_stuff.h:38
static GMenu * impr_b_select_menu
Definition cityrep.c:129
static GtkWidget * create_city_report_menu(void)
Definition cityrep.c:1046
static GMenu * wl_set_menu
Definition cityrep.c:124
static void recreate_production_menu(GActionGroup *group)
Definition cityrep.c:1616
static GMenu * unit_b_select_menu
Definition cityrep.c:128
static void city_select_island_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition cityrep.c:1296
static GMenu * display_menu
Definition cityrep.c:144
static GMenu * add_first_menu
Definition cityrep.c:120
static GMenu * add_2ndlast_menu
Definition cityrep.c:123
static GMenu * add_next_menu
Definition cityrep.c:122
static GMenu * impr_a_select_menu
Definition cityrep.c:136
static void select_governor_callback(GSimpleAction *action, GVariant *parameter, gpointer data)
Definition cityrep.c:634
static GMenu * unit_s_select_menu
Definition cityrep.c:131
static GMenu * impr_p_select_menu
Definition cityrep.c:133
static GActionGroup * cityrep_group
Definition cityrep.c:143
static GMenu * wl_append_menu
Definition cityrep.c:125
static void governors_iterate(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Definition cityrep.c:614
static GMenu * create_governor_menu(GActionGroup *group, bool change_governor)
Definition cityrep.c:693
static GMenu * create_display_menu(GActionGroup *group)
Definition cityrep.c:1018
static void recreate_select_menu(GActionGroup *group)
Definition cityrep.c:1803
static GMenu * create_production_menu(GActionGroup *group)
Definition cityrep.c:1552
static GMenuItem * create_display_menu_item(int pos)
Definition cityrep.c:986
static GMenu * select_menu
Definition cityrep.c:127
static GMenu * prod_menu
Definition cityrep.c:118
static GMenu * add_last_menu
Definition cityrep.c:121
static GMenu * cityrep_menu
Definition cityrep.c:142
static GMenu * create_wl_menu(GActionGroup *group, const char *act_pfx, GCallback cb)
Definition cityrep.c:919
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:300
static GMenu * unit_a_select_menu
Definition cityrep.c:135
static GMenu * unit_p_select_menu
Definition cityrep.c:132
static void update_governor_menu(void)
Definition cityrep.c:825
static GMenu * governor_select_menu
Definition cityrep.c:138
static GMenu * change_menu
Definition cityrep.c:119
static GMenu * wndr_b_select_menu
Definition cityrep.c:130
static GMenu * wndr_p_select_menu
Definition cityrep.c:134
static GMenu * wndr_a_select_menu
Definition cityrep.c:137
gint blocking_dialog(GtkWidget *dlg)
Definition gui_stuff.c:1136
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:1105
GtkWidget * gui_dialog_add_action_widget(struct gui_dialog *dlg, GtkWidget *widget)
Definition gui_stuff.c:690
#define submenu_append_unref(menu, name, submenu)
Definition gui_stuff.h:165
#define menu_item_insert_unref(menu, index, item)
Definition gui_stuff.h:142
#define submenu_insert_unref(menu, index, name, submenu)
Definition gui_stuff.h:156
#define menu_item_append_unref(menu, item)
Definition gui_stuff.h:149
int impr_sell_gold(const struct impr_type *pimprove)
Impr_type_id improvement_number(const struct impr_type *pimprove)
bool is_wonder(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
#define fc_assert_ret(condition)
Definition log.h:192
#define fc_assert_action(condition, action)
Definition log.h:188
bool is_city_hilited(struct city *pcity)
void center_tile_mapcanvas(const struct tile *ptile)
#define fc_realloc(ptr, sz)
Definition mem.h:36
struct client_options gui_options
Definition options.c:71
struct city_list * cities
Definition packhand.c:119
bool are_universals_equal(const struct universal *psource1, const struct universal *psource2)
size_t size
Definition specvec.h:72
struct sprite int int int int struct sprite * mask
Definition sprite_g.h:32
const char *(* func)(const struct city *pcity, const void *data)
Definition cityrepdata.h:34
const char * title2
Definition cityrepdata.h:31
const char * explanation
Definition cityrepdata.h:32
const char * title1
Definition cityrepdata.h:30
Definition city.h:317
struct connection conn
Definition client_main.h:96
bool center_when_popup_city
Definition options.h:161
struct player * playing
Definition connection.h:151
Definition climisc.h:82
struct universal item
Definition climisc.h:83
struct city_list * cities
Definition player.h:281
int gold
Definition cityrep.c:69
int count
Definition cityrep.c:68
const struct impr_type * target
Definition cityrep.c:70
int id
Definition unit.h:147
struct tile * tile
Definition unit.h:142
struct unit::@84::@86 client
enum universals_n kind
Definition fc_types.h:609
universals_u value
Definition fc_types.h:608
struct civ_map map
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:960
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
bool is_terrain_class_near_tile(const struct civ_map *nmap, const struct tile *ptile, enum terrain_class tclass)
Definition terrain.c:611
#define tile_continent(_tile)
Definition tile.h:93
const struct impr_type * building
Definition fc_types.h:547
void worklist_init(struct worklist *pwl)
Definition worklist.c:38
int worklist_length(const struct worklist *pwl)
Definition worklist.c:57