55#define BUTTON_NEW_UNIT_TGT (ACTION_COUNT + 1)
56#define BUTTON_NEW_EXTRA_TGT (BUTTON_NEW_UNIT_TGT + 1)
57#define BUTTON_LOCATION (BUTTON_NEW_EXTRA_TGT + 1)
58#define BUTTON_WAIT (BUTTON_LOCATION + 1)
59#define BUTTON_CANCEL (BUTTON_WAIT + 1)
60#define BUTTON_COUNT (BUTTON_CANCEL + 1)
62#define BUTTON_NOT_THERE -1
200 switch ((
enum gen_action)tgt_action_id) {
201 case ACTION_SPY_TARGETED_SABOTAGE_CITY:
202 return ACTION_SPY_SABOTAGE_CITY;
203 case ACTION_SPY_TARGETED_SABOTAGE_CITY_ESC:
204 return ACTION_SPY_SABOTAGE_CITY_ESC;
205 case ACTION_SPY_TARGETED_STEAL_TECH:
206 return ACTION_SPY_STEAL_TECH;
207 case ACTION_SPY_TARGETED_STEAL_TECH_ESC:
208 return ACTION_SPY_STEAL_TECH_ESC;
223 switch ((
enum gen_action)tgt_action_id) {
224 case ACTION_SPY_TARGETED_SABOTAGE_CITY:
225 return ACTION_SPY_SABOTAGE_CITY_PRODUCTION;
226 case ACTION_SPY_TARGETED_SABOTAGE_CITY_ESC:
227 return ACTION_SPY_SABOTAGE_CITY_PRODUCTION_ESC;
228 case ACTION_STRIKE_BUILDING:
229 return ACTION_STRIKE_PRODUCTION;
242 int actor_id, target_id, sub_target;
250 args->
act_id = GPOINTER_TO_INT(data);
314 case ASTK_EXTRA_NOT_THERE:
349 int actor_id, target_id;
357 args->
act_id = GPOINTER_TO_INT(data);
444 struct unit_list *as_list;
446 as_list = unit_list_new();
447 unit_list_append(as_list,
punit);
449 unit_list_destroy(as_list);
463 if (response == GTK_RESPONSE_YES) {
468 gtk_widget_destroy(w);
479 const struct action *paction)
485 "Treasury contains %d gold.",
490 shell = gtk_message_dialog_new(NULL, 0,
491 GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
493 PL_(
"Bribe unit for %d gold?\n%s",
494 "Bribe unit for %d gold?\n%s",
cost),
cost, buf);
495 gtk_window_set_title(GTK_WINDOW(
shell),
_(
"Bribe Enemy Unit"));
498 shell = gtk_message_dialog_new(NULL, 0,
499 GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
501 PL_(
"Bribing the unit costs %d gold.\n%s",
502 "Bribing the unit costs %d gold.\n%s",
cost),
cost, buf);
503 gtk_window_set_title(GTK_WINDOW(
shell),
_(
"Traitors Demand Too Much!"));
506 gtk_window_present(GTK_WINDOW(
shell));
522 if (response == GTK_RESPONSE_ACCEPT && args->
target_tech_id > 0) {
558 if (gtk_tree_selection_get_selected(select, &model, &it)) {
562 GTK_RESPONSE_ACCEPT,
TRUE);
567 GTK_RESPONSE_ACCEPT,
FALSE);
578 GtkWidget *sw, *label, *vbox, *
view;
580 GtkCellRenderer *rend;
581 GtkTreeViewColumn *col;
594 gtk_window_set_position(GTK_WINDOW(
spy_tech_shell), GTK_WIN_POS_MOUSE);
597 GTK_RESPONSE_ACCEPT);
599 label = gtk_frame_new(
_(
"Select Advance to Steal"));
600 gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(
spy_tech_shell))), label);
602 vbox = gtk_grid_new();
603 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox),
604 GTK_ORIENTATION_VERTICAL);
605 gtk_grid_set_row_spacing(GTK_GRID(vbox), 6);
606 gtk_container_add(GTK_CONTAINER(label), vbox);
608 store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
610 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
613 g_object_unref(store);
614 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
616 rend = gtk_cell_renderer_text_new();
617 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
619 gtk_tree_view_append_column(GTK_TREE_VIEW(
view), col);
621 label = g_object_new(GTK_TYPE_LABEL,
622 "use-underline",
TRUE,
623 "mnemonic-widget",
view,
624 "label",
_(
"_Advances:"),
628 gtk_container_add(GTK_CONTAINER(vbox), label);
630 sw = gtk_scrolled_window_new(NULL, NULL);
631 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
632 GTK_SHADOW_ETCHED_IN);
633 gtk_container_add(GTK_CONTAINER(sw),
view);
635 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
636 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
637 gtk_widget_set_size_request(sw, -1, 200);
639 gtk_container_add(GTK_CONTAINER(vbox), sw);
646 GValue value = { 0, };
653 gtk_list_store_append(store, &it);
655 g_value_init(&value, G_TYPE_STRING);
658 gtk_list_store_set_value(store, &it, 0, &value);
659 g_value_unset(&value);
660 gtk_list_store_set(store, &it, 1, i, -1);
666 gtk_list_store_append(store, &it);
668 g_value_init(&value, G_TYPE_STRING);
677 gtk_list_store_set_value(store, &it, 0, &value);
678 g_value_unset(&value);
679 gtk_list_store_set(store, &it, 1,
A_UNSET, -1);
684 GTK_RESPONSE_ACCEPT,
FALSE);
686 gtk_widget_show_all(gtk_dialog_get_content_area(GTK_DIALOG(
spy_tech_shell)));
688 g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW(
view)),
"changed",
748 if (gtk_tree_selection_get_selected(select, &model, &it)) {
752 GTK_RESPONSE_ACCEPT,
TRUE);
757 GTK_RESPONSE_ACCEPT,
FALSE);
768 GtkWidget *sw, *label, *vbox, *
view;
770 GtkCellRenderer *rend;
771 GtkTreeViewColumn *col;
788 GTK_RESPONSE_ACCEPT);
790 label = gtk_frame_new(
_(
"Select Improvement to Sabotage"));
791 gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(
spy_sabotage_shell))), label);
793 vbox = gtk_grid_new();
794 gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox),
795 GTK_ORIENTATION_VERTICAL);
796 gtk_grid_set_row_spacing(GTK_GRID(vbox), 6);
797 gtk_container_add(GTK_CONTAINER(label), vbox);
799 store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
801 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
804 g_object_unref(store);
805 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
807 rend = gtk_cell_renderer_text_new();
808 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
810 gtk_tree_view_append_column(GTK_TREE_VIEW(
view), col);
812 label = g_object_new(GTK_TYPE_LABEL,
813 "use-underline",
TRUE,
814 "mnemonic-widget",
view,
815 "label",
_(
"_Improvements:"),
819 gtk_container_add(GTK_CONTAINER(vbox), label);
821 sw = gtk_scrolled_window_new(NULL, NULL);
822 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
823 GTK_SHADOW_ETCHED_IN);
824 gtk_container_add(GTK_CONTAINER(sw),
view);
826 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
827 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
828 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(sw), 200);
830 gtk_container_add(GTK_CONTAINER(vbox), sw);
836 gtk_list_store_append(store, &it);
837 gtk_list_store_set(store, &it, 0,
_(
"City Production"), 1, -1, -1);
841 if (pimprove->sabotage > 0) {
842 gtk_list_store_append(store, &it);
843 gtk_list_store_set(store, &it,
854 gtk_list_store_append(store, &it);
865 GTK_RESPONSE_ACCEPT,
FALSE);
869 g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW(
view)),
"changed",
889 struct player *pvictim = NULL;
939 const struct action *paction)
958 if (response == GTK_RESPONSE_YES) {
963 gtk_widget_destroy(w);
974 const struct action *paction)
980 "Treasury contains %d gold.",
985 shell = gtk_message_dialog_new(NULL, 0,
986 GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
987 _(
"You can't incite a revolt in %s."),
989 gtk_window_set_title(GTK_WINDOW(
shell),
_(
"City can't be incited!"));
992 shell = gtk_message_dialog_new(NULL, 0,
993 GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
995 PL_(
"Incite a revolt for %d gold?\n%s",
996 "Incite a revolt for %d gold?\n%s",
cost),
cost, buf);
997 gtk_window_set_title(GTK_WINDOW(
shell),
_(
"Incite a Revolt!"));
1000 shell = gtk_message_dialog_new(NULL,
1002 GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
1004 PL_(
"Inciting a revolt costs %d gold.\n%s",
1005 "Inciting a revolt costs %d gold.\n%s",
cost),
cost, buf);
1006 gtk_window_set_title(GTK_WINDOW(
shell),
_(
"Traitors Demand Too Much!"));
1009 gtk_window_present(GTK_WINDOW(
shell));
1022 int au_id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(dlg),
"actor"));
1024 if (arg == GTK_RESPONSE_YES) {
1027 if (
actor != NULL) {
1028 int tgt_id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(dlg),
1031 struct tile *tgt_tile = g_object_get_data(G_OBJECT(dlg),
"tile");
1033 if (tgt_unit == NULL) {
1058 gtk_widget_destroy(dlg);
1076 _(
"Target unit selection"),
1077 _(
"Looking for target unit:"),
1078 _(
"Units at tile:"),
1094 int au_id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(dlg),
"actor"));
1096 if (arg == GTK_RESPONSE_YES) {
1099 if (
actor != NULL) {
1100 int tgt_id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(dlg),
1103 struct tile *tgt_tile = g_object_get_data(G_OBJECT(dlg),
"tile");
1106 if (tgt_extra == NULL) {
1130 gtk_widget_destroy(dlg);
1140 struct unit *act_unit;
1142 struct tile *tgt_tile;
1147 bv_extras potential_targets;
1171 _(
"Target extra selection"),
1174 _(
"Looking for target extra:"),
1177 _(
"Extra targets:"),
1248static const GCallback
af_map[ACTION_COUNT] = {
1250 [ACTION_SPY_TARGETED_SABOTAGE_CITY] =
1252 [ACTION_SPY_TARGETED_SABOTAGE_CITY_ESC] =
1333 act_probs[
act_id], custom);
1359 struct city *actor_homecity;
1376 "Diplomat queue problem. Is another diplomat window open?");
1382 for (button_id = 0; button_id <
BUTTON_COUNT; button_id++) {
1411 _(
"Choose Your %s's Strategy"),
1416 _(
"Your %s from %s reaches the city of %s.\nWhat now?"),
1422 _(
"Your %s has arrived at %s.\nWhat is your command?"),
1428 _(
"Your %s is ready to act against %s %s."),
1434 "No target specified.");
1437 _(
"Your %s is waiting for your command."),
1571 g_signal_connect(shl,
"destroy",
1573 g_signal_connect(shl,
"delete_event",
1671 "The action selection dialog should have been open");
1677 "The action selection dialog is for another actor unit.");
const char * action_prepare_ui_name(action_id act_id, const char *mnemonic, const struct act_prob prob, const char *custom)
enum action_actor_kind action_get_actor_kind(const struct action *paction)
bool action_prob_possible(const struct act_prob probability)
enum action_sub_target_kind action_get_sub_target_kind(const struct action *paction)
enum action_target_kind action_get_target_kind(const struct action *paction)
static struct action * action_by_number(action_id act_id)
#define action_iterate_end
#define action_id_get_actor_kind(act_id)
#define action_iterate(_act_)
#define action_id_get_target_kind(act_id)
void astr_free(struct astring *astr)
void astr_set(struct astring *astr, const char *format,...)
static const char * astr_str(const struct astring *astr) fc__attribute((nonnull(1)))
#define BV_ISSET(bv, bit)
const char * city_improvement_name_translation(const struct city *pcity, const struct impr_type *pimprove)
const char * city_name_get(const struct city *pcity)
#define INCITE_IMPOSSIBLE_COST
#define city_owner(_pcity_)
#define city_built_iterate(_pcity, _p)
#define city_built_iterate_end
void client_unit_init_act_prob_cache(struct unit *punit)
void action_selection_no_longer_in_progress(const int old_actor_id)
void request_do_action(action_id action, int actor_id, int target_id, int sub_tgt, const char *name)
void request_action_details(action_id action, int actor_id, int target_id)
void action_decision_clear_want(const int old_actor_id)
void action_selection_next_in_focus(const int old_actor_id)
struct unit struct city struct unit * target_unit
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id popup_bribe_dialog
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit * actor
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs action_selection_no_longer_in_progress_gui_specific
struct unit struct city struct unit struct tile * target_tile
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 * target_city
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
struct unit struct city struct unit struct tile struct extra_type * target_extra
#define IDENTITY_NUMBER_ZERO
#define PL_(String1, String2, n)
struct unit * game_unit_by_number(int id)
struct city * game_city_by_number(int id)
static GtkWidget * spy_sabotage_shell
int action_selection_target_extra(void)
static void incite_response(GtkWidget *w, gint response, gpointer data)
static int action_button_map[BUTTON_COUNT]
static void spy_improvements_callback(GtkTreeSelection *select, gpointer data)
#define BUTTON_NEW_EXTRA_TGT
static void act_sel_new_extra_tgt_callback(GtkWidget *w, gpointer data)
int action_selection_target_tile(void)
static void create_improvements_list(struct player *pplayer, struct city *pcity, struct action_data *args)
static void act_sel_destroy_callback(GtkWidget *w, gpointer data)
int action_selection_actor_unit(void)
static void spy_advances_response(GtkWidget *w, gint response, gpointer data)
static void tgt_extra_change_callback(GtkWidget *dlg, gint arg)
static GtkWidget * act_sel_dialog
static void spy_steal_popup_shared(GtkWidget *w, gpointer data)
static void diplomat_queue_handle_primary(void)
void action_selection_close(void)
static void spy_improvements_response(GtkWidget *w, gint response, gpointer data)
int action_selection_target_city(void)
static void bribe_response(GtkWidget *w, gint response, gpointer data)
static void action_entry(GtkWidget *shl, action_id act_id, const struct act_prob *act_probs, const char *custom, action_id act_num)
static void spy_steal_esc_popup(GtkWidget *w, gpointer data)
static void spy_steal_popup(GtkWidget *w, gpointer data)
static void act_sel_close_callback(GtkWidget *w, gint response_id, gpointer data)
static void diplomat_queue_handle_secondary(void)
static action_id get_non_targeted_action_id(action_id tgt_action_id)
static void request_action_details_callback(GtkWidget *w, gpointer data)
static bool action_selection_restart
#define BUTTON_NEW_UNIT_TGT
static struct action_data * act_sel_dialog_data
static void found_city_callback(GtkWidget *w, gpointer data)
static void act_sel_location_callback(GtkWidget *w, gpointer data)
void action_selection_refresh(struct unit *actor_unit, struct city *target_city, struct unit *target_unit, struct tile *target_tile, struct extra_type *target_extra, const struct act_prob *act_probs)
static struct action_data * act_data(action_id act_id, int actor_id, int target_city_id, int target_unit_id, int target_tile_id, int target_building_id, int target_tech_id, int tgt_extra_id)
static void simple_action_callback(GtkWidget *w, gpointer data)
static void create_advances_list(struct player *pplayer, struct player *pvictim, struct action_data *args)
static bool is_more_user_input_needed
static int target_extra_id
static void act_sel_wait_callback(GtkWidget *w, gpointer data)
static void act_sel_new_unit_tgt_callback(GtkWidget *w, gpointer data)
static void tgt_unit_change_callback(GtkWidget *dlg, gint arg)
static action_id get_production_targeted_action_id(action_id tgt_action_id)
static bool did_not_decide
void popup_sabotage_dialog(struct unit *actor, struct city *pcity, const struct action *paction)
static GtkWidget * spy_tech_shell
static int target_ids[ATK_COUNT]
static void act_sel_cancel_callback(GtkWidget *w, gpointer data)
static void action_entry_update(GtkWidget *shl, action_id act_id, const struct act_prob *act_probs, const char *custom, action_id act_num)
int action_selection_target_unit(void)
void popup_incite_dialog(struct unit *actor, struct city *pcity, int cost, const struct action *paction)
static const GCallback af_map[ACTION_COUNT]
static void upgrade_callback(GtkWidget *w, gpointer data)
static void spy_advances_callback(GtkTreeSelection *select, gpointer data)
GtkWidget * choice_dialog_start(GtkWindow *parent, const gchar *name, const gchar *text)
void choice_dialog_end(GtkWidget *dshell)
int choice_dialog_get_number_of_buttons(GtkWidget *cd)
void choice_dialog_button_set_tooltip(GtkWidget *cd, int number, const char *tool_tip)
void choice_dialog_button_move_to_the_end(GtkWidget *cd, const int number)
void choice_dialog_set_hide(GtkWidget *dshell, gboolean setting)
void choice_dialog_add(GtkWidget *dshell, const gchar *label, GCallback handler, gpointer data, bool meta, const gchar *tool_tip)
void choice_dialog_button_set_label(GtkWidget *cd, int number, const char *label)
void choice_dialog_button_set_sensitive(GtkWidget *cd, int button, gboolean state)
void popup_upgrade_dialog(struct unit_list *punits)
void gtk_tree_view_focus(GtkTreeView *view)
void setup_dialog(GtkWidget *shell, GtkWidget *parent)
static struct gui_dialog * shell
bool select_tgt_unit(struct unit *actor, struct tile *ptile, struct unit_list *potential_tgt_units, struct unit *suggested_tgt_unit, const gchar *dlg_title, const gchar *actor_label, const gchar *tgt_label, const gchar *do_label, GCallback do_callback)
struct impr_type * improvement_by_number(const Impr_type_id id)
Impr_type_id improvement_number(const struct impr_type *pimprove)
#define fc_assert_msg(condition, message,...)
#define fc_assert(condition)
#define fc_assert_action(condition, action)
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
void center_tile_mapcanvas(const struct tile *ptile)
const char * nation_adjective_for_player(const struct player *pplayer)
#define REQEST_PLAYER_INITIATED
int dsend_packet_unit_get_actions(struct connection *pc, int actor_unit_id16, int actor_unit_id32, int target_unit_id16, int target_unit_id32, int target_tile_id, int target_extra_id, int request_kind)
int dsend_packet_city_name_suggestion_req(struct connection *pc, int unit_id16, int unit_id32)
const char * research_advance_name_translation(const struct research *presearch, Tech_type_id tech)
struct research * research_get(const struct player *pplayer)
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
bool research_invention_gettable(const struct research *presearch, const Tech_type_id tech, bool allow_holes)
enum act_tgt_compl target_complexity
struct packet_game_info info
bool tech_steal_allow_holes
struct unit::@80::@82 client
struct act_prob * act_prob_cache
int fc_snprintf(char *str, size_t n, const char *format,...)
struct advance * valid_advance_by_number(const Tech_type_id id)
#define advance_index_iterate_end
#define advance_index_iterate(_start, _index)
const char * get_act_sel_action_custom_text(struct action *paction, const struct act_prob prob, const struct unit *actor_unit, const struct city *target_city)
const char * act_sel_action_tool_tip(const struct action *paction, const struct act_prob prob)
static const bv_extras * tile_extras(const struct tile *ptile)
const struct unit_type * unit_type_get(const struct unit *punit)
bool utype_can_remove_extra(const struct unit_type *putype, const struct extra_type *pextra)
const char * unit_name_translation(const struct unit *punit)
bool utype_can_create_extra(const struct unit_type *putype, const struct extra_type *pextra)