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_window_destroy(GTK_WINDOW(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, *frame, *label, *vgrid, *
view;
580 GtkCellRenderer *rend;
581 GtkTreeViewColumn *col;
587 _(
"_Cancel"), GTK_RESPONSE_CANCEL,
588 _(
"_Steal"), GTK_RESPONSE_ACCEPT,
593 GTK_RESPONSE_ACCEPT);
595 frame = gtk_frame_new(
_(
"Select Advance to Steal"));
596 gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(
spy_tech_shell))), frame);
598 vgrid = gtk_grid_new();
599 gtk_orientable_set_orientation(GTK_ORIENTABLE(vgrid),
600 GTK_ORIENTATION_VERTICAL);
601 gtk_grid_set_row_spacing(GTK_GRID(vgrid), 6);
602 gtk_frame_set_child(GTK_FRAME(frame), vgrid);
604 store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
606 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
609 g_object_unref(store);
610 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
612 rend = gtk_cell_renderer_text_new();
613 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
615 gtk_tree_view_append_column(GTK_TREE_VIEW(
view), col);
617 label = g_object_new(GTK_TYPE_LABEL,
618 "use-underline",
TRUE,
619 "mnemonic-widget",
view,
620 "label",
_(
"_Advances:"),
624 gtk_grid_attach(GTK_GRID(vgrid), label, 0, 0, 1, 1);
626 sw = gtk_scrolled_window_new();
627 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
TRUE);
628 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw),
view);
630 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
631 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
632 gtk_widget_set_size_request(sw, -1, 200);
634 gtk_grid_attach(GTK_GRID(vgrid), sw, 0, 1, 1, 1);
641 GValue value = { 0, };
648 gtk_list_store_append(store, &it);
650 g_value_init(&value, G_TYPE_STRING);
653 gtk_list_store_set_value(store, &it, 0, &value);
654 g_value_unset(&value);
655 gtk_list_store_set(store, &it, 1, i, -1);
661 gtk_list_store_append(store, &it);
663 g_value_init(&value, G_TYPE_STRING);
672 gtk_list_store_set_value(store, &it, 0, &value);
673 g_value_unset(&value);
674 gtk_list_store_set(store, &it, 1,
A_UNSET, -1);
679 GTK_RESPONSE_ACCEPT,
FALSE);
681 gtk_widget_show(gtk_dialog_get_content_area(GTK_DIALOG(
spy_tech_shell)));
683 g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW(
view)),
"changed",
743 if (gtk_tree_selection_get_selected(select, &model, &it)) {
747 GTK_RESPONSE_ACCEPT,
TRUE);
752 GTK_RESPONSE_ACCEPT,
FALSE);
763 GtkWidget *sw, *frame, *label, *vgrid, *
view;
765 GtkCellRenderer *rend;
766 GtkTreeViewColumn *col;
773 _(
"_Cancel"), GTK_RESPONSE_CANCEL,
774 _(
"_Sabotage"), GTK_RESPONSE_ACCEPT,
779 GTK_RESPONSE_ACCEPT);
781 frame = gtk_frame_new(
_(
"Select Improvement to Sabotage"));
782 gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(
spy_sabotage_shell))), frame);
784 vgrid = gtk_grid_new();
785 gtk_orientable_set_orientation(GTK_ORIENTABLE(vgrid),
786 GTK_ORIENTATION_VERTICAL);
787 gtk_grid_set_row_spacing(GTK_GRID(vgrid), 6);
788 gtk_frame_set_child(GTK_FRAME(frame), vgrid);
790 store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
792 view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
795 g_object_unref(store);
796 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
view),
FALSE);
798 rend = gtk_cell_renderer_text_new();
799 col = gtk_tree_view_column_new_with_attributes(NULL, rend,
801 gtk_tree_view_append_column(GTK_TREE_VIEW(
view), col);
803 label = g_object_new(GTK_TYPE_LABEL,
804 "use-underline",
TRUE,
805 "mnemonic-widget",
view,
806 "label",
_(
"_Improvements:"),
810 gtk_grid_attach(GTK_GRID(vgrid), label, 0, 0, 1, 1);
812 sw = gtk_scrolled_window_new();
813 gtk_scrolled_window_set_has_frame(GTK_SCROLLED_WINDOW(sw),
TRUE);
814 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw),
view);
816 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
817 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
818 gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(sw), 200);
820 gtk_grid_attach(GTK_GRID(vgrid), sw, 0, 1, 1, 1);
826 gtk_list_store_append(store, &it);
827 gtk_list_store_set(store, &it, 0,
_(
"City Production"), 1, -1, -1);
831 if (pimprove->sabotage > 0) {
832 gtk_list_store_append(store, &it);
833 gtk_list_store_set(store, &it,
844 gtk_list_store_append(store, &it);
855 GTK_RESPONSE_ACCEPT,
FALSE);
859 g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW(
view)),
"changed",
879 struct player *pvictim = NULL;
929 const struct action *paction)
948 if (response == GTK_RESPONSE_YES) {
953 gtk_window_destroy(GTK_WINDOW(w));
964 const struct action *paction)
970 "Treasury contains %d gold.",
975 shell = gtk_message_dialog_new(NULL, 0,
976 GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
977 _(
"You can't incite a revolt in %s."),
979 gtk_window_set_title(GTK_WINDOW(
shell),
_(
"City can't be incited!"));
982 shell = gtk_message_dialog_new(NULL, 0,
983 GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
985 PL_(
"Incite a revolt for %d gold?\n%s",
986 "Incite a revolt for %d gold?\n%s",
cost),
cost, buf);
987 gtk_window_set_title(GTK_WINDOW(
shell),
_(
"Incite a Revolt!"));
990 shell = gtk_message_dialog_new(NULL,
992 GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
994 PL_(
"Inciting a revolt costs %d gold.\n%s",
995 "Inciting a revolt costs %d gold.\n%s",
cost),
cost, buf);
996 gtk_window_set_title(GTK_WINDOW(
shell),
_(
"Traitors Demand Too Much!"));
999 gtk_window_present(GTK_WINDOW(
shell));
1012 int au_id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(dlg),
"actor"));
1014 if (arg == GTK_RESPONSE_YES) {
1017 if (
actor != NULL) {
1018 int tgt_id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(dlg),
1021 struct tile *tgt_tile = g_object_get_data(G_OBJECT(dlg),
"tile");
1023 if (tgt_unit == NULL) {
1048 gtk_window_destroy(GTK_WINDOW(dlg));
1066 _(
"Target unit selection"),
1067 _(
"Looking for target unit:"),
1068 _(
"Units at tile:"),
1084 int au_id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(dlg),
"actor"));
1086 if (arg == GTK_RESPONSE_YES) {
1089 if (
actor != NULL) {
1090 int tgt_id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(dlg),
1093 struct tile *tgt_tile = g_object_get_data(G_OBJECT(dlg),
"tile");
1096 if (tgt_extra == NULL) {
1120 gtk_window_destroy(GTK_WINDOW(dlg));
1130 struct unit *act_unit;
1132 struct tile *tgt_tile;
1137 bv_extras potential_targets;
1161 _(
"Target extra selection"),
1164 _(
"Looking for target extra:"),
1167 _(
"Extra targets:"),
1236static const GCallback
af_map[ACTION_COUNT] = {
1238 [ACTION_SPY_TARGETED_SABOTAGE_CITY] =
1240 [ACTION_SPY_TARGETED_SABOTAGE_CITY_ESC] =
1321 act_probs[
act_id], custom);
1347 struct city *actor_homecity;
1364 "Diplomat queue problem. Is another diplomat window open?");
1370 for (button_id = 0; button_id <
BUTTON_COUNT; button_id++) {
1399 _(
"Choose Your %s's Strategy"),
1404 _(
"Your %s from %s reaches the city of %s.\nWhat now?"),
1410 _(
"Your %s has arrived at %s.\nWhat is your command?"),
1416 _(
"Your %s is ready to act against %s %s."),
1422 "No target specified.");
1425 _(
"Your %s is waiting for your command."),
1559 g_signal_connect(shl,
"destroy",
1561 g_signal_connect(shl,
"close-request",
1659 "The action selection dialog should have been open");
1665 "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)
void choice_dialog_destroy(GtkWidget *dlg)
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)