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
102#define SPECVEC_TAG unit_node
103#define SPECVEC_TYPE struct unit_node
106#define unit_node_vector_iterate(list, elt) \
107 TYPED_VECTOR_ITERATE(struct unit_node, list, elt)
108#define unit_node_vector_iterate_end VECTOR_ITERATE_END
110#define NUM_CITIZENS_SHOWN 30
128#define CITY_MAP_MIN_SIZE_X 200
129#define CITY_MAP_MIN_SIZE_Y 150
394 if (pdialog->pcity ==
pcity)
628 switch (
event->keyval) {
666 if (
ev->button == 1) {
849 " color: rgba(255, 0.0, 0.0, 255);\n"
925 "strikethrough", 4,
NULL);
930 "strikethrough", 4,
NULL);
995 "xalign", 0.0,
"yalign", 0.5,
NULL);
1025 rend,
"text", 1,
"strikethrough", 3,
NULL);
1042 "mnemonic-widget",
view,
1043 "label",
_(
"I_mprovements:"),
1044 "xalign", 0.0,
"yalign", 0.5,
NULL);
1287 "label",
_(
"Production:"),
1288 "xalign", 0.0,
"yalign", 0.5,
NULL);
1515 =
N_(
"Allow unit production to disband city");
1518 N_(
"Overview page"),
1519 N_(
"Production page"),
1520 N_(
"Happiness page"),
1521 N_(
"Governor page"),
1522 N_(
"This Settings page"),
1523 N_(
"Last active page")
1684#ifndef FREECIV_MSWINDOWS
2030 if (
pcity->pollution >= 10) {
2099 PL_(
"Production (up to %d unit per turn):",
2100 "Production (up to %d units per turn):",
build_slots),
2144 if (store !=
NULL) {
2173 1,
name, 3, useless,
2201 "sell an improvement.");
2251 struct unit_list *units;
2280 for (
i =
m;
i <
n;
i++) {
2358 struct unit_list *units;
2385 for (
i =
m;
i <
n;
i++) {
2733 if (
ev->button == 3) {
2735 }
else if (
ev->button == 2) {
2761 if (
ev->button == 3) {
2763 }
else if (
ev->button == 2) {
2816 if (
NULL != pdialog) {
2840 if (
NULL != pdialog) {
2904 struct unit_list *
punits;
2937 struct unit_list *
punits;
3052 .value = { .terrain =
pterr }};
3060 _(
"What Action to Request"),
3061 _(
"Select autoworker activity:"));
3144 if (
ev->button == 1) {
3146 }
else if (
ev->button == 3) {
3200 "Treasury contains %d gold.",
3209 PL_(
"Buy %s for %d gold?\n%s",
3210 "Buy %s for %d gold?\n%s", value),
3223 PL_(
"%s costs %d gold.\n%s",
3224 "%s costs %d gold.\n%s", value),
3277 PL_(
"Sell %s for %d gold?",
3278 "Sell %s for %d gold?",
price),
3358 _(
"What should we rename the city to?"),
3526 int i, j, dir,
size;
3563 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 const struct action *paction struct unit struct city * pcity
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)
static gboolean canvas_exposed_cb(GtkWidget *w, cairo_t *cr, gpointer data)
#define CITY_MAP_MIN_SIZE_X
void real_city_dialog_popup(struct city *pcity)
static void misc_whichtab_callback(GtkWidget *w, gpointer data)
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)
static gboolean present_unit_middle_callback(GtkWidget *w, GdkEventButton *ev, 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 keyboard_handler(GtkWidget *widget, GdkEventKey *event, 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 gboolean show_info_button_release(GtkWidget *w, GdkEventButton *ev, gpointer data)
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 struct @145 workertask_req
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 destroy_func(GtkWidget *w, gpointer data)
static void unit_homecity_callback(GtkWidget *w, gpointer data)
static void unit_fortify_callback(GtkWidget *w, gpointer data)
static gboolean supported_unit_middle_callback(GtkWidget *w, GdkEventButton *ev, 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 gboolean button_down_citymap(GtkWidget *w, GdkEventButton *ev, 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)
void put_unit_image_city_overlays(struct unit *punit, GtkImage *p, int height, int *upkeep_cost, int happy_cost)
void put_unit_image(struct unit *punit, GtkImage *p, int height)
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)
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_GTK3_22_CITYDLG_MAX_XSIZE
#define GUI_GTK3_22_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)
#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
GtkWidget * citizen_images
GtkWidget * info_ebox[NUM_INFO_FIELDS]
enum city_dialog::@220 page
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 city_dialog::@148 happiness
struct unit_node_vector present_units
GtkWidget * show_units_command
GtkWidget * production_combo
struct city_dialog::@150 misc
struct cma_dialog * cma_editor
cairo_surface_t * citizen_surface
GtkWidget * present_units_frame
GtkWidget * info_label[NUM_INFO_FIELDS]
GtkWidget * new_citizens_radio[3]
GtkListStore * change_production_store
GtkWidget * present_unit_table
struct city_dialog::@149 counters
struct city_dialog::@146 overview
GtkTreeSelection * change_selection
struct city_dialog::@147 production
struct unit_list * info_units_present
struct unit_list * info_units_supported
struct city::@18::@21 client
struct unit_list * units_supported
struct packet_game_info info
char descr[MAX_LEN_NAME+40]
enum unit_activity activity
struct city_list * cities
enum unit_activity activity
struct unit::@84::@86 client
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)
struct sprite * get_icon_sprite(const struct tileset *t, enum icon_type icon)
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)
void economy_report_dialog_update(void)
bool worklist_is_empty(const struct worklist *pwl)