23#include <gdk/gdkkeysyms.h>
74#define CITYMAP_WIDTH MIN(512, canvas_width)
75#define CITYMAP_HEIGHT (CITYMAP_WIDTH * canvas_height / canvas_width)
76#define CITYMAP_SCALE ((double)CITYMAP_WIDTH / (double)canvas_width)
78#define TINYSCREEN_MAX_HEIGHT (500 - 1)
87#define SPECLIST_TAG dialog
88#define SPECLIST_TYPE struct city_dialog
91#define dialog_list_iterate(dialoglist, pdialog) \
92 TYPED_LIST_ITERATE(struct city_dialog, dialoglist, pdialog)
93#define dialog_list_iterate_end LIST_ITERATE_END
105#define SPECVEC_TAG unit_node
106#define SPECVEC_TYPE struct unit_node
109#define unit_node_vector_iterate(list, elt) \
110 TYPED_VECTOR_ITERATE(struct unit_node, list, elt)
111#define unit_node_vector_iterate_end VECTOR_ITERATE_END
113#define NUM_CITIZENS_SHOWN 30
131#define CITY_MAP_MIN_SIZE_X 200
132#define CITY_MAP_MIN_SIZE_Y 150
409 if (pdialog->pcity ==
pcity) {
845 " color: rgba(255, 0.0, 0.0, 255);\n"
910 "strikethrough", 4,
NULL);
915 "strikethrough", 4,
NULL);
985 "xalign", 0.0,
"yalign", 0.5,
NULL);
1021 rend,
"text", 1,
"strikethrough", 3,
NULL);
1030 "mnemonic-widget",
view,
1031 "label",
_(
"I_mprovements:"),
1032 "xalign", 0.0,
"yalign", 0.5,
NULL);
1256 "label",
_(
"Production:"),
1257 "xalign", 0.0,
"yalign", 0.5,
NULL);
1420 =
N_(
"Allow unit production to disband city");
1423 N_(
"Overview page"),
1424 N_(
"Production page"),
1425 N_(
"Happiness page"),
1426 N_(
"Counters Page"),
1427 N_(
"Governor page"),
1428 N_(
"This Settings page"),
1429 N_(
"Last active page")
1573 pdialog->
pcity = pcity;
1600#ifndef FREECIV_MSWINDOWS
2084 PL_(
"Production (up to %d unit per turn):",
2085 "Production (up to %d units per turn):",
build_slots),
2124 if (store !=
NULL) {
2191 "sell an improvement.");
2241 struct unit_list *units;
2271 for (
i =
m;
i <
n;
i++) {
2367 struct unit_list *units;
2395 for (
i =
m;
i <
n;
i++) {
2611 "win.activate_close"));
2877 struct city *pcity =
2881 if (
NULL != pcity) {
2884 if (
NULL != pdialog) {
2908 if (
NULL != pcity) {
2911 if (
NULL != pdialog) {
2990 struct unit_list *
punits;
3029 struct unit_list *
punits;
3148 .value = { .terrain =
pterr }};
3156 _(
"What Action to Request"),
3157 _(
"Select autosettler activity:"));
3319 "Treasury contains %d gold.",
3328 PL_(
"Buy %s for %d gold?\n%s",
3329 "Buy %s for %d gold?\n%s", value),
3342 PL_(
"%s costs %d gold.\n%s",
3343 "%s costs %d gold.\n%s", value),
3396 PL_(
"Sell %s for %d gold?",
3397 "Sell %s for %d gold?",
price),
3473 _(
"What should we rename the city to?"),
3639 int i, j, dir,
size;
3676 for (j = 1; j <
size; j++) {
const char * action_id_name_translation(action_id act_id)
bool action_ever_possible(action_id action)
#define action_id_univs_not_blocking(act_id, act_uni, tgt_uni)
struct canvas int int struct sprite int int int int height
struct canvas int int canvas_y
struct canvas int canvas_x
struct canvas int int struct sprite int int int width
void output_window_append(const struct ft_color color, const char *featured_text)
const char * city_improvement_name_translation(const struct city *pcity, const struct impr_type *pimprove)
int city_production_build_shield_cost(const struct city *pcity)
int city_granary_size(int city_size)
int city_build_slots(const struct city *pcity)
struct tile * city_map_to_tile(const struct civ_map *nmap, const struct tile *city_center, int city_radius_sq, int city_map_x, int city_map_y)
const char * city_name_get(const struct city *pcity)
int city_improvement_upkeep(const struct city *pcity, const struct impr_type *b)
bool is_city_option_set(const struct city *pcity, enum city_options option)
int city_population(const struct city *pcity)
int city_unit_unhappiness(const struct civ_map *nmap, struct unit *punit, int *free_unhappy)
bool city_unhappy(const struct city *pcity)
bool city_celebrating(const struct city *pcity)
int city_illness_calc(const struct city *pcity, int *ill_base, int *ill_size, int *ill_trade, int *ill_pollution)
bool city_happy(const struct city *pcity)
int city_map_radius_sq_get(const struct city *pcity)
citizens city_specialists(const struct city *pcity)
bool can_city_build_now(const struct civ_map *nmap, const struct city *pcity, const struct universal *target)
int city_turns_to_grow(const struct city *pcity)
const char * city_production_name_translation(const struct city *pcity)
static citizens city_size_get(const struct city *pcity)
#define city_owner(_pcity_)
void get_city_dialog_output_text(const struct city *pcity, Output_type_id otype, char *buf, size_t bufsz)
void get_city_dialog_production(struct city *pcity, char *buffer, size_t buffer_len)
int city_rename(struct city *pcity, const char *name)
int get_city_citizen_types(struct city *pcity, enum citizen_feeling idx, enum citizen_category *categories)
int city_buy_production(struct city *pcity)
int city_toggle_worker(struct city *pcity, int city_x, int city_y)
void get_city_dialog_airlift_text(const struct city *pcity, char *buf, size_t bufsz)
int city_change_production(struct city *pcity, struct universal *target)
void city_rotate_specialist(struct city *pcity, int citizen_index)
int get_citydlg_canvas_width(void)
bool canvas_to_city_pos(int *city_x, int *city_y, int city_radius_sq, int canvas_x, int canvas_y)
void get_city_dialog_airlift_value(const struct city *pcity, char *buf, size_t bufsz)
void city_dialog_redraw_map(struct city *pcity, struct canvas *pcanvas)
int city_sell_improvement(struct city *pcity, Impr_type_id sell_id)
void get_city_dialog_pollution_text(const struct city *pcity, char *buf, size_t bufsz)
void get_city_dialog_culture_text(const struct city *pcity, char *buf, size_t bufsz)
bool city_can_buy(const struct city *pcity)
int get_citydlg_canvas_height(void)
void get_city_dialog_illness_text(const struct city *pcity, char *buf, size_t bufsz)
void city_report_dialog_update_city(struct city *pcity)
bool client_is_global_observer(void)
bool client_is_observer(void)
bool can_client_issue_orders(void)
bool client_has_player(void)
int collect_eventually_buildable_targets(struct universal *targets, struct city *pcity, bool advanced_tech)
void name_and_sort_items(struct universal *targets, int num_targets, struct item *items, bool show_cost, struct city *pcity)
cid cid_encode(struct universal target)
int collect_already_built_targets(struct universal *targets, struct city *pcity)
#define MAX_NUM_PRODUCTION_TARGETS
bool cma_is_city_under_agent(const struct city *pcity, struct cm_parameter *parameter)
void request_unit_fortify(struct unit *punit)
void unit_focus_set(struct unit *punit)
void request_unit_change_homecity(struct unit *punit)
void request_unit_unload(struct unit *pcargo)
void request_unit_sentry(struct unit *punit)
#define can_unit_do_activity_client(_punit_, _act_)
int counter_index(const struct counter *pcount)
#define city_counters_iterate_end
#define city_counters_iterate(pcount)
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 * punit
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 cost
static struct editor_state * editor
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
#define PL_(String1, String2, n)
const struct ft_color ftc_client
const char * population_to_text(int thousand_citizen)
struct city * game_city_by_number(int id)
#define FC_STATIC_CANVAS_INIT
GtkWidget * choice_dialog_start(GtkWindow *parent, const gchar *name, const gchar *text)
void choice_dialog_end(GtkWidget *dshell)
void choice_dialog_add(GtkWidget *dshell, const gchar *label, GCallback handler, gpointer data, bool meta, const gchar *tool_tip)
GtkWidget * citizens_dialog_display(const struct city *pcity)
void citizens_dialog_refresh(const struct city *pcity)
void citizens_dialog_close(const struct city *pcity)
static void unit_sentry_callback(GtkWidget *w, gpointer data)
static int new_dialog_def_page
static void create_and_append_buildings_page(struct city_dialog *pdialog)
static void unit_upgrade_callback(GtkWidget *w, gpointer data)
static void popup_workertask_dlg(struct city *pcity, struct tile *ptile)
static void city_dialog_update_citizens(struct city_dialog *pdialog)
static void city_destroy_callback(GtkWidget *w, gpointer data)
static void city_dialog_update_title(struct city_dialog *pdialog)
static void init_citydlg_dimensions(void)
static void create_and_append_worklist_page(struct city_dialog *pdialog)
#define CITY_MAP_MIN_SIZE_X
void real_city_dialog_popup(struct city *pcity)
static void misc_whichtab_callback(GtkWidget *w, gpointer data)
static struct @141 workertask_req
bool city_dialog_is_open(struct city *pcity)
static void city_dialog_update_building(struct city_dialog *pdialog)
static void citydlg_response_callback(GtkDialog *dlg, gint response, void *data)
static void buy_callback_response(GtkWidget *w, gint response, gpointer data)
void real_city_dialog_refresh(struct city *pcity)
static void unit_center_callback(GtkWidget *w, gpointer data)
static struct city_dialog * get_city_dialog(struct city *pcity)
#define CITY_MAP_MIN_SIZE_Y
static void city_dialog_update_information(GtkWidget **info_ebox, GtkWidget **info_label, struct city_dialog *pdialog)
static GtkWidget * create_citydlg_improvement_list(struct city_dialog *pdialog, GtkWidget *vbox)
static void create_production_header(struct city_dialog *pdialog, GtkContainer *contain)
static void workertask_dlg_destroy(GtkWidget *w, gpointer data)
static void city_dialog_update_present_units(struct city_dialog *pdialog)
static gboolean citizens_callback(GtkWidget *w, GdkEventButton *ev, gpointer data)
static void change_production_callback(GtkComboBox *combo, struct city_dialog *pdialog)
static void unit_load_callback(GtkWidget *w, gpointer data)
static void set_cityopt_values(struct city_dialog *pdialog)
static void close_city_dialog(struct city_dialog *pdialog)
static gboolean show_info_popup(GtkWidget *w, GdkEventButton *ev, gpointer data)
static void create_and_append_overview_page(struct city_dialog *pdialog)
static void create_and_append_happiness_page(struct city_dialog *pdialog)
void popdown_all_city_dialogs(void)
static void buy_callback(GtkWidget *w, gpointer data)
#define dialog_list_iterate_end
static void impr_callback(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data)
static void create_and_append_map_page(struct city_dialog *pdialog)
static void city_dialog_map_create(struct city_dialog *pdialog, struct city_map_canvas *cmap_canvas)
void refresh_unit_city_dialogs(struct unit *punit)
void reset_city_dialogs(void)
static void cityopt_callback(GtkWidget *w, gpointer data)
static void city_dialog_map_recenter(GtkWidget *map_canvas_sw)
static void draw_map_canvas(struct city_dialog *pdialog)
static bool is_showing_workertask_dialog
#define unit_node_vector_iterate_end
static void sell_callback(struct impr_type *pimprove, gpointer data)
#define dialog_list_iterate(dialoglist, pdialog)
static void supported_unit_activate_close_callback(GtkWidget *w, gpointer data)
static void city_dialog_update_prev_next(void)
static void create_and_append_settings_page(struct city_dialog *pdialog)
static bool city_dialogs_have_been_initialised
static void close_callback(GtkWidget *w, gpointer data)
static struct dialog_list * dialog_list
static void sell_callback_response(GtkWidget *w, gint response, gpointer data)
static void create_citydlg_main_map(struct city_dialog *pdialog, GtkWidget *container)
#define NUM_CITIZENS_SHOWN
static void unit_homecity_callback(GtkWidget *w, gpointer data)
static void unit_fortify_callback(GtkWidget *w, gpointer data)
static void city_dialog_update_counters(struct city_dialog *pdialog)
static gboolean present_unit_callback(GtkWidget *w, GdkEventButton *ev, gpointer data)
static GtkWidget * create_city_info_table(struct city_dialog *pdialog, GtkWidget **info_ebox, GtkWidget **info_label)
static struct city_dialog * create_city_dialog(struct city *pcity)
static void target_drag_data_received(GtkWidget *w, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint info, guint time, gpointer user_data)
static void unit_disband_callback(GtkWidget *w, gpointer data)
#define unit_node_vector_iterate(list, elt)
static void rename_callback(GtkWidget *w, gpointer data)
static void switch_city_callback(GtkWidget *w, gpointer data)
static void city_dialog_update_map(struct city_dialog *pdialog)
static void create_and_append_counters_page(struct city_dialog *pdialog)
static void unit_unload_callback(GtkWidget *w, gpointer data)
static void show_units_response(void *data)
static void initialize_city_dialogs(void)
#define TINYSCREEN_MAX_HEIGHT
static void city_dialog_update_supported_units(struct city_dialog *pdialog)
static void unit_activate_callback(GtkWidget *w, gpointer data)
static void present_unit_activate_close_callback(GtkWidget *w, gpointer data)
static void set_city_workertask(GtkWidget *w, gpointer data)
static void rename_popup_callback(gpointer data, gint response, const char *input)
static void city_dialog_update_improvement_list(struct city_dialog *pdialog)
static void create_and_append_cma_page(struct city_dialog *pdialog)
void popdown_city_dialog(struct city *pcity)
static gboolean supported_unit_callback(GtkWidget *w, GdkEventButton *ev, gpointer data)
void close_cma_dialog(struct city *pcity)
struct cma_dialog * create_cma_dialog(struct city *pcity, bool tiny)
void refresh_cma_dialog(struct city *pcity, enum cma_refresh refresh)
void unit_select_dialog_popup(struct tile *ptile)
void popup_upgrade_dialog(struct unit_list *punits)
void popup_disband_dialog(struct unit_list *punits)
#define GUI_GTK_OPTION(optname)
GtkWidget * icon_label_button_new(const gchar *icon_name, const gchar *label_text)
void setup_dialog(GtkWidget *shell, GtkWidget *parent)
void intl_slist(int n, const char **s, bool *done)
void close_happiness_dialog(struct city *pcity)
void refresh_happiness_dialog(struct city *pcity)
GtkWidget * get_top_happiness_display(struct city *pcity, bool low_dlg, GtkWidget *win)
void popup_help_dialog_typed(const char *item, enum help_page_type htype)
static struct gui_dialog * shell
GdkPixbuf * sprite_get_pixbuf(struct sprite *sprite)
bool request_transport(struct unit *cargo, struct tile *ptile)
void refresh_worklist(GtkWidget *editor)
void add_worklist_dnd_target(GtkWidget *w)
void reset_city_worklist(GtkWidget *editor, struct city *pcity)
GtkWidget * create_worklist(void)
void refresh_all_city_worklists(void)
static void canvas_draw_cb(GtkDrawingArea *w, cairo_t *cr, int width, int height, gpointer data)
static gboolean right_button_down_citymap(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data)
static gboolean middle_present_unit_release(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data)
static bool create_unit_menu(struct city_dialog *pdialog, struct unit *punit, GtkWidget *wdg, bool supported)
static gboolean right_unit_release(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data)
static gboolean left_button_down_citymap(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data)
static void close_citydlg_unit_popover(struct city_dialog *pdialog)
static gboolean middle_supported_unit_release(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data)
static gboolean citydlg_keyboard_handler(GtkEventControllerKey *controller, guint keyval, guint keycode, GdkModifierType state, gpointer data)
#define menu_item_append_unref(menu, item)
void put_unit_picture_city_overlays(struct unit *punit, GtkPicture *p, int height, int *upkeep_cost, int happy_cost)
void put_unit_picture(struct unit *punit, GtkPicture *p, int height)
void picture_set_from_surface(GtkPicture *pic, cairo_surface_t *surf)
int impr_sell_gold(const struct impr_type *pimprove)
enum test_result test_player_sell_building_now(struct player *pplayer, struct city *pcity, const struct impr_type *pimprove)
bool is_improvement_redundant(const struct city *pcity, const struct impr_type *pimprove)
Impr_type_id improvement_number(const struct impr_type *pimprove)
bool is_great_wonder(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
bool is_small_wonder(const struct impr_type *pimprove)
#define fc_assert_ret(condition)
#define fc_assert(condition)
#define fc_assert_action(condition, action)
#define log_debug(message,...)
void center_tile_mapcanvas(const struct tile *ptile)
bool can_unit_exist_at_tile(const struct civ_map *nmap, const struct unit *punit, const struct tile *ptile)
bool unit_can_load(const struct unit *punit)
static const char * name_translation_get(const struct name_translation *ptrans)
#define GUI_GTK4_CITYDLG_MAX_XSIZE
#define GUI_GTK4_CITYDLG_MIN_XSIZE
int send_packet_worker_task(struct connection *pc, const struct packet_worker_task *packet)
int dsend_packet_city_options_req(struct connection *pc, int city_id, bv_city_options options, enum city_wl_cancel_behavior wl_cb)
struct unit * player_unit_by_number(const struct player *pplayer, int unit_id)
struct city * player_city_by_number(const struct player *pplayer, int city_id)
void economy_report_dialog_update(void)
bool are_universals_equal(const struct universal *psource1, const struct universal *psource2)
#define CLIP(lower, current, upper)
struct sprite int int int int struct sprite * mask
#define strvec_iterate(psv, str)
#define strvec_iterate_end
cairo_surface_t * surface
struct city_dialog::@144 happiness
struct city_dialog::@142 overview
GtkWidget * rename_command
GtkWidget * production_bar
GtkWidget * supported_units_frame
GtkWidget * production_label
GtkWidget * supported_unit_table
GtkWidget * disband_on_settler
struct city_map_canvas map_canvas
GtkWidget * improvement_list
GtkWidget * whichtab_radio[NUM_PAGES]
struct unit_node_vector supported_units
cairo_surface_t * map_canvas_store_unscaled
struct unit_node_vector present_units
struct city_dialog::@146 misc
GtkWidget * show_units_command
GtkWidget * production_combo
struct cma_dialog * cma_editor
enum city_dialog::@191 page
cairo_surface_t * citizen_surface
struct city_dialog::@145 counters
struct city_dialog::@143 production
GtkWidget * present_units_frame
GtkWidget * info_label[NUM_INFO_FIELDS]
GtkWidget * new_citizens_radio[3]
GtkListStore * change_production_store
GtkWidget * present_unit_table
GtkTreeSelection * change_selection
struct worker_task_list * task_reqs
enum city_wl_cancel_behavior wlcb
struct unit_list * info_units_present
struct unit_list * info_units_supported
struct universal production
struct unit_list * units_supported
struct city::@17::@20 client
struct packet_game_info info
char descr[MAX_LEN_NAME+40]
enum unit_activity activity
struct city_list * cities
GtkEventController * middle
GtkEventController * left
GtkEventController * right
enum unit_activity activity
int fc_snprintf(char *str, size_t n, const char *format,...)
const char * unit_description(struct unit *punit)
struct city * tile_city(const struct tile *ptile)
#define tile_terrain(_tile)
struct sprite * get_building_sprite(const struct tileset *t, const struct impr_type *pimprove)
int tileset_small_sprite_width(const struct tileset *t)
int tileset_full_tile_height(const struct tileset *t)
int tileset_small_sprite_height(const struct tileset *t)
int tileset_unit_with_upkeep_height(const struct tileset *t)
struct sprite * get_citizen_sprite(const struct tileset *t, enum citizen_category type, int citizen_index, const struct city *pcity)
struct sprite * get_unittype_sprite(const struct tileset *t, const struct unit_type *punittype, enum unit_activity activity, enum direction8 facing)
const struct unit_type * utype
const struct impr_type * building
bool can_unit_change_homecity_to(const struct civ_map *nmap, const struct unit *punit, const struct city *pcity)
struct unit * unit_transport_get(const struct unit *pcargo)
bool unit_can_do_action(const struct unit *punit, const action_id act_id)
bool can_unit_unload(const struct unit *pcargo, const struct unit *ptrans)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
const struct unit_type * unit_type_get(const struct unit *punit)
const struct unit_type * can_upgrade_unittype(const struct player *pplayer, const struct unit_type *punittype)
const char * utype_name_translation(const struct unit_type *punittype)
bool worklist_is_empty(const struct worklist *pwl)