Project

General

Profile

Feature #803 ยป 0036-Add-Stack-Bribe-action-type.patch

Marko Lindqvist, 09/14/2024 06:43 PM

View differences:

ai/default/aidiplomat.c
unit_do_action(pplayer, punit->id,
pvictim->id, -1, "",
ACTION_SPY_BRIBE_UNIT);
/* autoattack might kill us as we move in */
/* Autoattack might kill us as we move in */
if (game_unit_by_number(sanity) && punit->moves_left > 0) {
return TRUE;
} else {
ai/default/daicity.c
case ACTRES_PARADROP_CONQUER:
/* Against the tile so potential city effects are overlooked for now. */
case ACTRES_SPY_BRIBE_UNIT:
case ACTRES_SPY_BRIBE_STACK:
case ACTRES_SPY_SABOTAGE_UNIT:
case ACTRES_SPY_ATTACK:
case ACTRES_EXPEL_UNIT:
ai/default/daidiplomacy.c
dai_incident_simple(receiver, violator, victim, scope, 3);
break;
case ACTRES_SPY_BRIBE_UNIT:
case ACTRES_SPY_BRIBE_STACK:
case ACTRES_CAPTURE_UNITS:
case ACTRES_BOMBARD:
case ACTRES_ATTACK:
client/gui-gtk-3.22/action_dialog.c
}
/**********************************************************************//**
User responded to bribe dialog
User responded to bribe unit dialog
**************************************************************************/
static void bribe_response(GtkWidget *w, gint response, gpointer data)
static void bribe_unit_response(GtkWidget *w, gint response, gpointer data)
{
struct action_data *args = (struct action_data *)data;
......
diplomat_queue_handle_secondary();
}
/**********************************************************************//**
User responded to bribe stack dialog
**************************************************************************/
static void bribe_stack_response(GtkWidget *w, gint response, gpointer data)
{
struct action_data *args = (struct action_data *)data;
if (response == GTK_RESPONSE_YES) {
request_do_action(args->act_id, args->actor_unit_id,
args->target_tile_id, 0, "");
}
gtk_widget_destroy(w);
free(args);
/* The user have answered the follow up question. Move on. */
diplomat_queue_handle_secondary();
}
/**********************************************************************//**
Popup unit bribe dialog
**************************************************************************/
void popup_bribe_dialog(struct unit *actor, struct unit *punit, int cost,
const struct action *paction)
void popup_bribe_unit_dialog(struct unit *actor, struct unit *punit, int cost,
const struct action *paction)
{
GtkWidget *shell;
char buf[1024];
......
setup_dialog(shell, toplevel);
}
gtk_window_present(GTK_WINDOW(shell));
g_signal_connect(shell, "response", G_CALLBACK(bribe_response),
g_signal_connect(shell, "response", G_CALLBACK(bribe_unit_response),
act_data(paction->id, actor->id,
0, punit->id, 0,
0, 0, 0));
}
/**********************************************************************//**
Popup stack bribe dialog
**************************************************************************/
void popup_bribe_stack_dialog(struct unit *actor, struct tile *ptile, int cost,
const struct action *paction)
{
GtkWidget *shell;
char buf[1024];
fc_snprintf(buf, ARRAY_SIZE(buf), PL_("Treasury contains %d gold.",
"Treasury contains %d gold.",
client_player()->economic.gold),
client_player()->economic.gold);
if (cost <= client_player()->economic.gold) {
shell = gtk_message_dialog_new(NULL, 0,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
/* TRANS: %s is pre-pluralised "Treasury contains %d gold." */
PL_("Bribe unit stack for %d gold?\n%s",
"Bribe unit stack for %d gold?\n%s", cost), cost, buf);
gtk_window_set_title(GTK_WINDOW(shell), _("Bribe Enemy Unit"));
setup_dialog(shell, toplevel);
} else {
shell = gtk_message_dialog_new(NULL, 0,
GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
/* TRANS: %s is pre-pluralised "Treasury contains %d gold." */
PL_("Bribing units costs %d gold.\n%s",
"Bribing units costs %d gold.\n%s", cost), cost, buf);
gtk_window_set_title(GTK_WINDOW(shell), _("Traitors Demand Too Much!"));
setup_dialog(shell, toplevel);
}
gtk_window_present(GTK_WINDOW(shell));
g_signal_connect(shell, "response", G_CALLBACK(bribe_stack_response),
act_data(paction->id, actor->id,
0, 0, ptile->index,
0, 0, 0));
}
/**********************************************************************//**
User responded to steal advances dialog
**************************************************************************/
......
/* Unit acting against a unit target. */
[ACTION_SPY_BRIBE_UNIT] = (GCallback)request_action_details_callback,
[ACTION_SPY_BRIBE_STACK] = (GCallback)request_action_details_callback,
/* Unit acting against all units at a tile. */
/* No special callback functions needed for any unit stack targeted
* actions. */
[ACTION_SPY_BRIBE_STACK] = (GCallback)request_action_details_callback,
/* Unit acting against a tile. */
[ACTION_FOUND_CITY] = (GCallback)found_city_callback,
client/gui-gtk-4.0/action_dialog.c
}
/**********************************************************************//**
User responded to bribe dialog
User responded to unit bribe dialog
**************************************************************************/
static void bribe_response(GtkWidget *w, gint response, gpointer data)
static void bribe_unit_response(GtkWidget *w, gint response, gpointer data)
{
struct action_data *args = (struct action_data *)data;
......
diplomat_queue_handle_secondary();
}
/**********************************************************************//**
User responded to stack bribe dialog
**************************************************************************/
static void bribe_stack_response(GtkWidget *w, gint response, gpointer data)
{
struct action_data *args = (struct action_data *)data;
if (response == GTK_RESPONSE_YES) {
request_do_action(args->act_id, args->actor_unit_id,
args->target_tile_id, 0, "");
}
gtk_window_destroy(GTK_WINDOW(w));
free(args);
/* The user have answered the follow up question. Move on. */
diplomat_queue_handle_secondary();
}
/**********************************************************************//**
Popup unit bribe dialog
**************************************************************************/
void popup_bribe_dialog(struct unit *actor, struct unit *punit, int cost,
const struct action *paction)
void popup_bribe_unit_dialog(struct unit *actor, struct unit *punit, int cost,
const struct action *paction)
{
GtkWidget *shell;
char buf[1024];
......
}
gtk_window_present(GTK_WINDOW(shell));
g_signal_connect(shell, "response", G_CALLBACK(bribe_response),
g_signal_connect(shell, "response", G_CALLBACK(bribe_unit_response),
act_data(paction->id, actor->id,
0, punit->id, 0,
0, 0, 0));
}
/**********************************************************************//**
Popup stack bribe dialog
**************************************************************************/
void popup_bribe_stack_dialog(struct unit *actor, struct tile *ptile, int cost,
const struct action *paction)
{
GtkWidget *shell;
char buf[1024];
fc_snprintf(buf, ARRAY_SIZE(buf), PL_("Treasury contains %d gold.",
"Treasury contains %d gold.",
client_player()->economic.gold),
client_player()->economic.gold);
if (cost <= client_player()->economic.gold) {
shell = gtk_message_dialog_new(NULL, 0,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
/* TRANS: %s is pre-pluralised "Treasury contains %d gold." */
PL_("Bribe unit stack for %d gold?\n%s",
"Bribe unit stack for %d gold?\n%s", cost), cost, buf);
gtk_window_set_title(GTK_WINDOW(shell), _("Bribe Enemy Unit"));
setup_dialog(shell, toplevel);
} else {
shell = gtk_message_dialog_new(NULL, 0,
GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
/* TRANS: %s is pre-pluralised "Treasury contains %d gold." */
PL_("Bribing units costs %d gold.\n%s",
"Bribing units costs %d gold.\n%s", cost), cost, buf);
gtk_window_set_title(GTK_WINDOW(shell), _("Traitors Demand Too Much!"));
setup_dialog(shell, toplevel);
}
gtk_window_present(GTK_WINDOW(shell));
g_signal_connect(shell, "response", G_CALLBACK(bribe_stack_response),
act_data(paction->id, actor->id,
0, 0, ptile->index,
0, 0, 0));
}
/**********************************************************************//**
User responded to steal advances dialog
**************************************************************************/
......
[ACTION_SPY_BRIBE_UNIT] = (GCallback)request_action_details_callback,
/* Unit acting against all units at a tile. */
/* No special callback functions needed for any unit stack targeted
* actions. */
[ACTION_SPY_BRIBE_STACK] = (GCallback)request_action_details_callback,
/* Unit acting against a tile. */
[ACTION_FOUND_CITY] = (GCallback)found_city_callback,
client/gui-gtk-5.0/action_dialog.c
}
/**********************************************************************//**
User responded to bribe dialog
User responded to bribe unit dialog
**************************************************************************/
static void bribe_response(GtkWidget *w, gint response, gpointer data)
static void bribe_unit_response(GtkWidget *w, gint response, gpointer data)
{
struct action_data *args = (struct action_data *)data;
......
diplomat_queue_handle_secondary();
}
/**********************************************************************//**
User responded to bribe stack dialog
**************************************************************************/
static void bribe_stack_response(GtkWidget *w, gint response, gpointer data)
{
struct action_data *args = (struct action_data *)data;
if (response == GTK_RESPONSE_YES) {
request_do_action(args->act_id, args->actor_unit_id,
args->target_tile_id, 0, "");
}
gtk_window_destroy(GTK_WINDOW(w));
free(args);
/* The user have answered the follow up question. Move on. */
diplomat_queue_handle_secondary();
}
/**********************************************************************//**
Popup unit bribe dialog
**************************************************************************/
void popup_bribe_dialog(struct unit *actor, struct unit *punit, int cost,
const struct action *paction)
void popup_bribe_unit_dialog(struct unit *actor, struct unit *punit, int cost,
const struct action *paction)
{
GtkWidget *shell;
char buf[1024];
......
}
gtk_window_present(GTK_WINDOW(shell));
g_signal_connect(shell, "response", G_CALLBACK(bribe_response),
g_signal_connect(shell, "response", G_CALLBACK(bribe_unit_response),
act_data(paction->id, actor->id,
0, punit->id, 0,
0, 0, 0));
}
/**********************************************************************//**
Popup stack bribe dialog
**************************************************************************/
void popup_bribe_stack_dialog(struct unit *actor, struct tile *ptile, int cost,
const struct action *paction)
{
GtkWidget *shell;
char buf[1024];
fc_snprintf(buf, ARRAY_SIZE(buf), PL_("Treasury contains %d gold.",
"Treasury contains %d gold.",
client_player()->economic.gold),
client_player()->economic.gold);
if (cost <= client_player()->economic.gold) {
shell = gtk_message_dialog_new(NULL, 0,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
/* TRANS: %s is pre-pluralised "Treasury contains %d gold." */
PL_("Bribe unit stack for %d gold?\n%s",
"Bribe unit stack for %d gold?\n%s", cost), cost, buf);
gtk_window_set_title(GTK_WINDOW(shell), _("Bribe Enemy Stack"));
setup_dialog(shell, toplevel);
} else {
shell = gtk_message_dialog_new(NULL, 0,
GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
/* TRANS: %s is pre-pluralised "Treasury contains %d gold." */
PL_("Bribing units costs %d gold.\n%s",
"Bribing units costs %d gold.\n%s", cost), cost, buf);
gtk_window_set_title(GTK_WINDOW(shell), _("Traitors Demand Too Much!"));
setup_dialog(shell, toplevel);
}
gtk_window_present(GTK_WINDOW(shell));
g_signal_connect(shell, "response", G_CALLBACK(bribe_stack_response),
act_data(paction->id, actor->id,
0, 0, ptile->index,
0, 0, 0));
}
/**********************************************************************//**
User responded to steal advances dialog
**************************************************************************/
......
[ACTION_SPY_BRIBE_UNIT] = (GCallback)request_action_details_callback,
/* Unit acting against all units at a tile. */
/* No special callback functions needed for any unit stack targeted
* actions. */
[ACTION_SPY_BRIBE_STACK] = (GCallback)request_action_details_callback,
/* Unit acting against a tile. */
[ACTION_FOUND_CITY] = (GCallback)found_city_callback,
client/gui-qt/dialogs.cpp
static void diplomat_investigate(QVariant data1, QVariant data2);
static void diplomat_sabotage(QVariant data1, QVariant data2);
static void diplomat_sabotage_esc(QVariant data1, QVariant data2);
static void diplomat_bribe(QVariant data1, QVariant data2);
static void diplomat_bribe_unit(QVariant data1, QVariant data2);
static void diplomat_bribe_stack(QVariant data1, QVariant data2);
static void caravan_marketplace(QVariant data1, QVariant data2);
static void caravan_establish_trade(QVariant data1, QVariant data2);
static void caravan_help_build(QVariant data1, QVariant data2);
......
action_function[ACTION_NUKE_CITY] = nuke_city;
// Unit acting against a unit target.
action_function[ACTION_SPY_BRIBE_UNIT] = diplomat_bribe;
action_function[ACTION_SPY_BRIBE_UNIT] = diplomat_bribe_unit;
action_function[ACTION_SPY_SABOTAGE_UNIT] = spy_sabotage_unit;
action_function[ACTION_SPY_SABOTAGE_UNIT_ESC] = spy_sabotage_unit_esc;
action_function[ACTION_EXPEL_UNIT] = expel_unit;
......
action_function[ACTION_TRANSPORT_EMBARK4] = transport_embark4;
// Unit acting against all units at a tile.
action_function[ACTION_SPY_BRIBE_STACK] = diplomat_bribe_stack;
action_function[ACTION_CAPTURE_UNITS] = capture_units;
action_function[ACTION_BOMBARD] = bombard;
action_function[ACTION_BOMBARD2] = bombard2;
......
/***********************************************************************//**
Action bribe unit for choice dialog
***************************************************************************/
static void diplomat_bribe(QVariant data1, QVariant data2)
static void diplomat_bribe_unit(QVariant data1, QVariant data2)
{
int diplomat_id = data1.toInt();
int diplomat_target_id = data2.toInt();
......
}
}
/***********************************************************************//**
Action bribe stack for choice dialog
***************************************************************************/
static void diplomat_bribe_stack(QVariant data1, QVariant data2)
{
int diplomat_id = data1.toInt();
int diplomat_target_id = data2.toInt();
if (game_unit_by_number(diplomat_id) != nullptr) {
// Wait for the server's reply before moving on to the next queued diplomat.
is_more_user_input_needed = TRUE;
request_action_details(ACTION_SPY_BRIBE_STACK, diplomat_id,
diplomat_target_id);
}
}
/***********************************************************************//**
Action sabotage unit for choice dialog
***************************************************************************/
......
Popup a dialog asking a diplomatic unit if it wishes to bribe the
given enemy unit.
***************************************************************************/
void popup_bribe_dialog(struct unit *actor, struct unit *tunit, int cost,
const struct action *paction)
void popup_bribe_unit_dialog(struct unit *actor, struct unit *tunit, int cost,
const struct action *paction)
{
hud_message_box *ask = new hud_message_box(gui()->central_wdg);
char buf[1024];
......
diplomat_queue_handle_secondary(diplomat_id);
}
/***********************************************************************//**
Popup a dialog asking a diplomatic unit if it wishes to bribe the
given enemy unit stack.
***************************************************************************/
void popup_bribe_stack_dialog(struct unit *actor, struct tile *ttile, int cost,
const struct action *paction)
{
hud_message_box *ask = new hud_message_box(gui()->central_wdg);
char buf[1024];
char buf2[1024];
int diplomat_id = actor->id;
int diplomat_target_id = ttile->index;
const int act_id = paction->id;
// Should be set before sending request to the server.
fc_assert(is_more_user_input_needed);
fc_snprintf(buf, ARRAY_SIZE(buf), PL_("Treasury contains %d gold.",
"Treasury contains %d gold.",
client_player()->economic.gold),
client_player()->economic.gold);
if (cost <= client_player()->economic.gold) {
fc_snprintf(buf2, ARRAY_SIZE(buf2), PL_("Bribe unit stack for %d gold?\n%s",
"Bribe unit stack for %d gold?\n%s",
cost), cost, buf);
ask->set_text_title(buf2, _("Bribe Enemy Stack"));
ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
ask->setDefaultButton(QMessageBox::Cancel);
ask->setAttribute(Qt::WA_DeleteOnClose);
QObject::connect(ask, &hud_message_box::accepted, [=]() {
request_do_action(act_id, diplomat_id, diplomat_target_id, 0, "");
diplomat_queue_handle_secondary(diplomat_id);
});
ask->show();
return;
} else {
fc_snprintf(buf2, ARRAY_SIZE(buf2),
PL_("Bribing the unit stack costs %d gold.\n%s",
"Bribing the unit stack costs %d gold.\n%s", cost), cost, buf);
ask->set_text_title(buf2, _("Traitors Demand Too Much!"));
ask->setAttribute(Qt::WA_DeleteOnClose);
ask->show();
}
diplomat_queue_handle_secondary(diplomat_id);
}
/***********************************************************************//**
Action pillage for choice dialog
***************************************************************************/
client/gui-qt/menu.cpp
action_vs_unit->addAction(act);
connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_unit);
act = action_unit_menu->addAction(_("Bribe"));
act = action_unit_menu->addAction(_("Bribe Unit"));
act->setCheckable(true);
act->setChecked(false);
act->setData(ACTION_SPY_BRIBE_UNIT);
client/gui-sdl2/action_dialog.c
/**********************************************************************//**
Ask the server how much the bribe costs
**************************************************************************/
static int diplomat_bribe_callback(struct widget *pwidget)
static int diplomat_bribe_unit_callback(struct widget *pwidget)
{
if (PRESSED_EVENT(main_data.event)) {
if (NULL != game_unit_by_number(diplomat_dlg->actor_unit_id)
......
return -1;
}
/**********************************************************************//**
Ask the server how much the bribe costs
**************************************************************************/
static int diplomat_bribe_stack_callback(struct widget *pwidget)
{
if (PRESSED_EVENT(main_data.event)) {
if (game_unit_by_number(diplomat_dlg->actor_unit_id) != nullptr) {
request_action_details(ACTION_SPY_BRIBE_STACK,
diplomat_dlg->actor_unit_id,
diplomat_dlg->target_ids[ATK_STACK]);
is_more_user_input_needed = TRUE;
popdown_diplomat_dialog();
} else {
popdown_diplomat_dialog();
}
}
return -1;
}
/**********************************************************************//**
User clicked "Found City"
**************************************************************************/
......
[ACTION_STRIKE_BUILDING] = spy_strike_bld_request,
/* Unit acting against a unit target. */
[ACTION_SPY_BRIBE_UNIT] = diplomat_bribe_callback,
[ACTION_SPY_BRIBE_UNIT] = diplomat_bribe_unit_callback,
/* Unit acting against all units at a tile. */
/* No special callback functions needed for any unit stack targeted
* actions. */
[ACTION_SPY_BRIBE_STACK] = diplomat_bribe_stack_callback,
/* Unit acting against a tile. */
[ACTION_FOUND_CITY] = found_city_callback,
......
area.h += buf->size.h;
/* ------- */
create_active_iconlabel(buf, pwindow->dst, pstr,
_("No") , exit_incite_dlg_callback);
_("No"), exit_incite_dlg_callback);
set_wstate(buf, FC_WS_NORMAL);
buf->key = SDLK_ESCAPE;
......
}
/**********************************************************************//**
User confirmed bribe.
User confirmed unit bribe.
**************************************************************************/
static int diplomat_bribe_yes_callback(struct widget *pwidget)
static int diplomat_bribe_unit_yes_callback(struct widget *pwidget)
{
if (PRESSED_EVENT(main_data.event)) {
if (NULL != game_unit_by_number(bribe_dlg->actor_unit_id)
......
return -1;
}
/**********************************************************************//**
User confirmed stack bribe.
**************************************************************************/
static int diplomat_bribe_stack_yes_callback(struct widget *pwidget)
{
if (PRESSED_EVENT(main_data.event)) {
if (NULL != game_unit_by_number(bribe_dlg->actor_unit_id)) {
request_do_action(bribe_dlg->act_id, bribe_dlg->actor_unit_id,
bribe_dlg->target_id, 0, "");
}
popdown_bribe_dialog();
}
return -1;
}
/**********************************************************************//**
Close bribe dialog.
**************************************************************************/
......
Popup a dialog asking a diplomatic unit if it wishes to bribe the
given enemy unit.
**************************************************************************/
void popup_bribe_dialog(struct unit *actor, struct unit *punit, int cost,
const struct action *paction)
void popup_bribe_unit_dialog(struct unit *actor, struct unit *punit, int cost,
const struct action *paction)
{
struct widget *pwindow = NULL, *buf = NULL;
utf8_str *pstr;
......
/*------------*/
create_active_iconlabel(buf, pwindow->dst, pstr,
_("Yes"), diplomat_bribe_yes_callback);
_("Yes"), diplomat_bribe_unit_yes_callback);
buf->data.unit = punit;
set_wstate(buf, FC_WS_NORMAL);
......
area.h += buf->size.h;
/* ------- */
create_active_iconlabel(buf, pwindow->dst, pstr,
_("No") , exit_bribe_dlg_callback);
_("No"), exit_bribe_dlg_callback);
set_wstate(buf, FC_WS_NORMAL);
buf->key = SDLK_ESCAPE;
......
}
bribe_dlg->pdialog->begin_widget_list = buf;
/* setup window size and start position */
/* Setup window size and start position */
resize_window(pwindow, NULL, NULL,
(pwindow->size.w - pwindow->area.w) + area.w,
......
put_window_near_map_tile(pwindow, pwindow->size.w, pwindow->size.h,
unit_tile(actor));
/* setup widget size and start position */
/* Setup widget size and start position */
buf = pwindow;
if (exit) {
/* exit button */
/* Exit button */
buf = buf->prev;
buf->size.x = area.x + area.w - buf->size.w - 1;
buf->size.y = pwindow->size.y + adj_size(2);
......
bribe_dlg->pdialog->begin_widget_list, buf);
/* --------------------- */
/* redraw */
/* Redraw */
redraw_group(bribe_dlg->pdialog->begin_widget_list, pwindow, 0);
widget_flush(pwindow);
}
/**********************************************************************//**
Popup a dialog asking a diplomatic unit if it wishes to bribe the
given enemy unit.
**************************************************************************/
void popup_bribe_stack_dialog(struct unit *actor, struct tile *ptile, int cost,
const struct action *paction)
{
struct widget *pwindow = NULL, *buf = NULL;
utf8_str *pstr;
char tBuf[255], cbuf[255];
bool exit = FALSE;
SDL_Rect area;
if (bribe_dlg) {
return;
}
/* Should be set before sending request to the server. */
fc_assert(is_more_user_input_needed);
if (!actor || !unit_can_do_action(actor, paction->id)) {
act_sel_done_secondary(actor ? actor->id : IDENTITY_NUMBER_ZERO);
return;
}
is_unit_move_blocked = TRUE;
bribe_dlg = fc_calloc(1, sizeof(struct small_diplomat_dialog));
bribe_dlg->act_id = paction->id;
bribe_dlg->actor_unit_id = actor->id;
bribe_dlg->target_id = ptile->index;
bribe_dlg->pdialog = fc_calloc(1, sizeof(struct small_dialog));
fc_snprintf(tBuf, ARRAY_SIZE(tBuf), PL_("Treasury contains %d gold.",
"Treasury contains %d gold.",
client_player()->economic.gold),
client_player()->economic.gold);
/* Window */
pstr = create_utf8_from_char_fonto(_("Bribe Enemy Stack"), FONTO_ATTENTION);
pstr->style |= TTF_STYLE_BOLD;
pwindow = create_window_skeleton(NULL, pstr, 0);
pwindow->action = bribe_dlg_window_callback;
set_wstate(pwindow, FC_WS_NORMAL);
add_to_gui_list(ID_BRIBE_DLG_WINDOW, pwindow);
bribe_dlg->pdialog->end_widget_list = pwindow;
area = pwindow->area;
area.w = MAX(area.w, adj_size(8));
area.h = MAX(area.h, adj_size(2));
if (cost <= client_player()->economic.gold) {
fc_snprintf(cbuf, sizeof(cbuf),
/* TRANS: %s is pre-pluralised "Treasury contains %d gold." */
PL_("Bribe unit stack for %d gold?\n%s",
"Bribe unit stack for %d gold?\n%s", cost), cost, tBuf);
create_active_iconlabel(buf, pwindow->dst, pstr, cbuf, NULL);
add_to_gui_list(ID_LABEL, buf);
area.w = MAX(area.w, buf->size.w);
area.h += buf->size.h;
/*------------*/
create_active_iconlabel(buf, pwindow->dst, pstr,
_("Yes"), diplomat_bribe_stack_yes_callback);
buf->data.tile = ptile;
set_wstate(buf, FC_WS_NORMAL);
add_to_gui_list(MAX_ID - actor->id, buf);
area.w = MAX(area.w, buf->size.w);
area.h += buf->size.h;
/* ------- */
create_active_iconlabel(buf, pwindow->dst, pstr,
_("No"), exit_bribe_dlg_callback);
set_wstate(buf, FC_WS_NORMAL);
buf->key = SDLK_ESCAPE;
add_to_gui_list(ID_LABEL, buf);
area.w = MAX(area.w, buf->size.w);
area.h += buf->size.h;
} else {
/* Exit button */
buf = create_themeicon(current_theme->small_cancel_icon, pwindow->dst,
WF_WIDGET_HAS_INFO_LABEL
| WF_RESTORE_BACKGROUND);
buf->info_label = create_utf8_from_char_fonto(_("Close Dialog (Esc)"),
FONTO_ATTENTION);
area.w += buf->size.w + adj_size(10);
buf->action = exit_bribe_dlg_callback;
set_wstate(buf, FC_WS_NORMAL);
buf->key = SDLK_ESCAPE;
add_to_gui_list(ID_BRIBE_DLG_EXIT_BUTTON, buf);
exit = TRUE;
/* --------------- */
fc_snprintf(cbuf, sizeof(cbuf),
/* TRANS: %s is pre-pluralised "Treasury contains %d gold." */
PL_("Bribing the unit stack costs %d gold.\n%s",
"Bribing the unit stack costs %d gold.\n%s", cost), cost, tBuf);
create_active_iconlabel(buf, pwindow->dst, pstr, cbuf, NULL);
add_to_gui_list(ID_LABEL, buf);
area.w = MAX(area.w, buf->size.w);
area.h += buf->size.h;
/*------------*/
create_active_iconlabel(buf, pwindow->dst, pstr,
_("Traitors Demand Too Much!"), NULL);
add_to_gui_list(ID_LABEL, buf);
area.w = MAX(area.w, buf->size.w);
area.h += buf->size.h;
}
bribe_dlg->pdialog->begin_widget_list = buf;
/* Setup window size and start position */
resize_window(pwindow, NULL, NULL,
(pwindow->size.w - pwindow->area.w) + area.w,
(pwindow->size.h - pwindow->area.h) + area.h);
area = pwindow->area;
auto_center_on_focus_unit();
put_window_near_map_tile(pwindow, pwindow->size.w, pwindow->size.h,
unit_tile(actor));
/* Setup widget size and start position */
buf = pwindow;
if (exit) {
/* Exit button */
buf = buf->prev;
buf->size.x = area.x + area.w - buf->size.w - 1;
buf->size.y = pwindow->size.y + adj_size(2);
}
buf = buf->prev;
setup_vertical_widgets_position(1,
area.x,
area.y + 1, area.w, 0,
bribe_dlg->pdialog->begin_widget_list, buf);
/* --------------------- */
/* Redraw */
redraw_group(bribe_dlg->pdialog->begin_widget_list, pwindow, 0);
widget_flush(pwindow);
client/gui-sdl3/action_dialog.c
/**********************************************************************//**
Ask the server how much the bribe costs
**************************************************************************/
static int diplomat_bribe_callback(struct widget *pwidget)
static int diplomat_bribe_unit_callback(struct widget *pwidget)
{
if (PRESSED_EVENT(main_data.event)) {
if (NULL != game_unit_by_number(diplomat_dlg->actor_unit_id)
......
return -1;
}
/**********************************************************************//**
Ask the server how much the bribe costs
**************************************************************************/
static int diplomat_bribe_stack_callback(struct widget *pwidget)
{
if (PRESSED_EVENT(main_data.event)) {
if (game_unit_by_number(diplomat_dlg->actor_unit_id) != nullptr) {
request_action_details(ACTION_SPY_BRIBE_STACK,
diplomat_dlg->actor_unit_id,
diplomat_dlg->target_ids[ATK_STACK]);
is_more_user_input_needed = TRUE;
popdown_diplomat_dialog();
} else {
popdown_diplomat_dialog();
}
}
return -1;
}
/**********************************************************************//**
User clicked "Found City"
**************************************************************************/
......
[ACTION_STRIKE_BUILDING] = spy_strike_bld_request,
/* Unit acting against a unit target. */
[ACTION_SPY_BRIBE_UNIT] = diplomat_bribe_callback,
[ACTION_SPY_BRIBE_UNIT] = diplomat_bribe_unit_callback,
/* Unit acting against all units at a tile. */
/* No special callback functions needed for any unit stack targeted
* actions. */
[ACTION_SPY_BRIBE_STACK] = diplomat_bribe_stack_callback,
/* Unit acting against a tile. */
[ACTION_FOUND_CITY] = found_city_callback,
......
area.h += buf->size.h;
/* ------- */
create_active_iconlabel(buf, pwindow->dst, pstr,
_("No") , exit_incite_dlg_callback);
_("No"), exit_incite_dlg_callback);
set_wstate(buf, FC_WS_NORMAL);
buf->key = SDLK_ESCAPE;
......
}
/**********************************************************************//**
User confirmed bribe.
User confirmed unit bribe.
**************************************************************************/
static int diplomat_bribe_yes_callback(struct widget *pwidget)
static int diplomat_bribe_unit_yes_callback(struct widget *pwidget)
{
if (PRESSED_EVENT(main_data.event)) {
if (NULL != game_unit_by_number(bribe_dlg->actor_unit_id)
......
return -1;
}
/**********************************************************************//**
User confirmed stack bribe.
**************************************************************************/
static int diplomat_bribe_stack_yes_callback(struct widget *pwidget)
{
if (PRESSED_EVENT(main_data.event)) {
if (NULL != game_unit_by_number(bribe_dlg->actor_unit_id)) {
request_do_action(bribe_dlg->act_id, bribe_dlg->actor_unit_id,
bribe_dlg->target_id, 0, "");
}
popdown_bribe_dialog();
}
return -1;
}
/**********************************************************************//**
Close bribe dialog.
**************************************************************************/
......
Popup a dialog asking a diplomatic unit if it wishes to bribe the
given enemy unit.
**************************************************************************/
void popup_bribe_dialog(struct unit *actor, struct unit *punit, int cost,
const struct action *paction)
void popup_bribe_unit_dialog(struct unit *actor, struct unit *punit, int cost,
const struct action *paction)
{
struct widget *pwindow = NULL, *buf = NULL;
utf8_str *pstr;
......
/*------------*/
create_active_iconlabel(buf, pwindow->dst, pstr,
_("Yes"), diplomat_bribe_yes_callback);
_("Yes"), diplomat_bribe_unit_yes_callback);
buf->data.unit = punit;
set_wstate(buf, FC_WS_NORMAL);
......
area.h += buf->size.h;
/* ------- */
create_active_iconlabel(buf, pwindow->dst, pstr,
_("No") , exit_bribe_dlg_callback);
_("No"), exit_bribe_dlg_callback);
set_wstate(buf, FC_WS_NORMAL);
buf->key = SDLK_ESCAPE;
......
}
bribe_dlg->pdialog->begin_widget_list = buf;
/* setup window size and start position */
/* Setup window size and start position */
resize_window(pwindow, NULL, NULL,
(pwindow->size.w - pwindow->area.w) + area.w,
......
put_window_near_map_tile(pwindow, pwindow->size.w, pwindow->size.h,
unit_tile(actor));
/* setup widget size and start position */
/* Setup widget size and start position */
buf = pwindow;
if (exit) {
/* exit button */
/* Exit button */
buf = buf->prev;
buf->size.x = area.x + area.w - buf->size.w - 1;
buf->size.y = pwindow->size.y + adj_size(2);
......
bribe_dlg->pdialog->begin_widget_list, buf);
/* --------------------- */
/* redraw */
/* Redraw */
redraw_group(bribe_dlg->pdialog->begin_widget_list, pwindow, 0);
widget_flush(pwindow);
}
/**********************************************************************//**
Popup a dialog asking a diplomatic unit if it wishes to bribe the
given enemy unit.
**************************************************************************/
void popup_bribe_stack_dialog(struct unit *actor, struct tile *ptile, int cost,
const struct action *paction)
{
struct widget *pwindow = NULL, *buf = NULL;
utf8_str *pstr;
char tBuf[255], cbuf[255];
bool exit = FALSE;
SDL_Rect area;
if (bribe_dlg) {
return;
}
/* Should be set before sending request to the server. */
fc_assert(is_more_user_input_needed);
if (!actor || !unit_can_do_action(actor, paction->id)) {
act_sel_done_secondary(actor ? actor->id : IDENTITY_NUMBER_ZERO);
return;
}
is_unit_move_blocked = TRUE;
bribe_dlg = fc_calloc(1, sizeof(struct small_diplomat_dialog));
bribe_dlg->act_id = paction->id;
bribe_dlg->actor_unit_id = actor->id;
bribe_dlg->target_id = ptile->index;
bribe_dlg->pdialog = fc_calloc(1, sizeof(struct small_dialog));
fc_snprintf(tBuf, ARRAY_SIZE(tBuf), PL_("Treasury contains %d gold.",
"Treasury contains %d gold.",
client_player()->economic.gold),
client_player()->economic.gold);
/* Window */
pstr = create_utf8_from_char_fonto(_("Bribe Enemy Stack"), FONTO_ATTENTION);
pstr->style |= TTF_STYLE_BOLD;
pwindow = create_window_skeleton(NULL, pstr, 0);
pwindow->action = bribe_dlg_window_callback;
set_wstate(pwindow, FC_WS_NORMAL);
add_to_gui_list(ID_BRIBE_DLG_WINDOW, pwindow);
bribe_dlg->pdialog->end_widget_list = pwindow;
area = pwindow->area;
area.w = MAX(area.w, adj_size(8));
area.h = MAX(area.h, adj_size(2));
if (cost <= client_player()->economic.gold) {
fc_snprintf(cbuf, sizeof(cbuf),
/* TRANS: %s is pre-pluralised "Treasury contains %d gold." */
PL_("Bribe unit stack for %d gold?\n%s",
"Bribe unit stack for %d gold?\n%s", cost), cost, tBuf);
create_active_iconlabel(buf, pwindow->dst, pstr, cbuf, NULL);
add_to_gui_list(ID_LABEL, buf);
area.w = MAX(area.w, buf->size.w);
area.h += buf->size.h;
/*------------*/
create_active_iconlabel(buf, pwindow->dst, pstr,
_("Yes"), diplomat_bribe_stack_yes_callback);
buf->data.tile = ptile;
set_wstate(buf, FC_WS_NORMAL);
add_to_gui_list(MAX_ID - actor->id, buf);
area.w = MAX(area.w, buf->size.w);
area.h += buf->size.h;
/* ------- */
create_active_iconlabel(buf, pwindow->dst, pstr,
_("No"), exit_bribe_dlg_callback);
set_wstate(buf, FC_WS_NORMAL);
buf->key = SDLK_ESCAPE;
add_to_gui_list(ID_LABEL, buf);
area.w = MAX(area.w, buf->size.w);
area.h += buf->size.h;
} else {
/* Exit button */
buf = create_themeicon(current_theme->small_cancel_icon, pwindow->dst,
WF_WIDGET_HAS_INFO_LABEL
| WF_RESTORE_BACKGROUND);
buf->info_label = create_utf8_from_char_fonto(_("Close Dialog (Esc)"),
FONTO_ATTENTION);
area.w += buf->size.w + adj_size(10);
buf->action = exit_bribe_dlg_callback;
set_wstate(buf, FC_WS_NORMAL);
buf->key = SDLK_ESCAPE;
add_to_gui_list(ID_BRIBE_DLG_EXIT_BUTTON, buf);
exit = TRUE;
/* --------------- */
fc_snprintf(cbuf, sizeof(cbuf),
/* TRANS: %s is pre-pluralised "Treasury contains %d gold." */
PL_("Bribing the unit stack costs %d gold.\n%s",
"Bribing the unit stack costs %d gold.\n%s", cost), cost, tBuf);
create_active_iconlabel(buf, pwindow->dst, pstr, cbuf, NULL);
add_to_gui_list(ID_LABEL, buf);
area.w = MAX(area.w, buf->size.w);
area.h += buf->size.h;
/*------------*/
create_active_iconlabel(buf, pwindow->dst, pstr,
_("Traitors Demand Too Much!"), NULL);
add_to_gui_list(ID_LABEL, buf);
area.w = MAX(area.w, buf->size.w);
area.h += buf->size.h;
}
bribe_dlg->pdialog->begin_widget_list = buf;
/* Setup window size and start position */
resize_window(pwindow, NULL, NULL,
(pwindow->size.w - pwindow->area.w) + area.w,
(pwindow->size.h - pwindow->area.h) + area.h);
area = pwindow->area;
auto_center_on_focus_unit();
put_window_near_map_tile(pwindow, pwindow->size.w, pwindow->size.h,
unit_tile(actor));
/* Setup widget size and start position */
buf = pwindow;
if (exit) {
/* Exit button */
buf = buf->prev;
buf->size.x = area.x + area.w - buf->size.w - 1;
buf->size.y = pwindow->size.y + adj_size(2);
}
buf = buf->prev;
setup_vertical_widgets_position(1,
area.x,
area.y + 1, area.w, 0,
bribe_dlg->pdialog->begin_widget_list, buf);
/* --------------------- */
/* Redraw */
redraw_group(bribe_dlg->pdialog->begin_widget_list, pwindow, 0);
widget_flush(pwindow);
client/gui-stub/dialogs.c
Popup a dialog asking a diplomatic unit if it wishes to bribe the
given enemy unit.
**************************************************************************/
void popup_bribe_dialog(struct unit *actor, struct unit *punit, int cost,
const struct action *paction)
void popup_bribe_unit_dialog(struct unit *actor, struct unit *punit, int cost,
const struct action *paction)
{
/* PORTME */
}
/**********************************************************************//**
Popup a dialog asking a diplomatic unit if it wishes to bribe the
given enemy unit stack.
**************************************************************************/
void popup_bribe_stack_dialog(struct unit *actor, struct tile *ptile, int cost,
const struct action *paction)
{
/* PORTME */
}
client/include/dialogs_g.h
int actor_unit_id)
GUI_FUNC_PROTO(void, popup_incite_dialog, struct unit *actor,
struct city *pcity, int cost, const struct action *paction)
GUI_FUNC_PROTO(void, popup_bribe_dialog, struct unit *actor,
GUI_FUNC_PROTO(void, popup_bribe_unit_dialog, struct unit *actor,
struct unit *punit, int cost, const struct action *paction)
GUI_FUNC_PROTO(void, popup_bribe_stack_dialog, struct unit *actor,
struct tile *ptile, int cost, const struct action *paction)
GUI_FUNC_PROTO(void, popup_sabotage_dialog, struct unit *actor,
struct city *pcity, const struct action *paction)
GUI_FUNC_PROTO(void, popup_pillage_dialog, struct unit *punit, bv_extras extras)
client/packhand.c
ACTION_SPY_INCITE_CITY, ACTION_SPY_INCITE_CITY_ESC,
ACTION_TRADE_ROUTE, ACTION_MARKETPLACE,
ACTION_HELP_WONDER,
ACTION_SPY_BRIBE_UNIT,
ACTION_SPY_BRIBE_UNIT, ACTION_SPY_BRIBE_STACK,
ACTION_SPY_SABOTAGE_UNIT, ACTION_SPY_SABOTAGE_UNIT_ESC,
ACTION_SPY_ATTACK,
ACTION_FOUND_CITY,
......
{
struct city *pcity = game_city_by_number(target_id);
struct unit *punit = game_unit_by_number(target_id);
struct tile *ptile = index_to_tile(&(wld.map), target_id);
struct unit *pactor = player_unit_by_number(client_player(), actor_id);
struct action *paction = action_by_number(action_type);
......
switch ((enum gen_action)action_type) {
case ACTION_SPY_BRIBE_UNIT:
if (punit && client.conn.playing
if (punit != nullptr && client.conn.playing
&& is_human(client.conn.playing)) {
if (request_kind == REQEST_PLAYER_INITIATED) {
/* Focus on the unit so the player knows where it is */
unit_focus_set(pactor);
popup_bribe_dialog(pactor, punit, cost, paction);
popup_bribe_unit_dialog(pactor, punit, cost, paction);
} else {
/* Not in use (yet). */
log_error("Unimplemented: received background unit bribe cost.");
......
}
}
break;
case ACTION_SPY_BRIBE_STACK:
if (ptile != nullptr && client.conn.playing
&& is_human(client.conn.playing)) {
if (request_kind == REQEST_PLAYER_INITIATED) {
/* Focus on the unit so the player knows where it is */
unit_focus_set(pactor);
popup_bribe_stack_dialog(pactor, ptile, cost, paction);
} else {
/* Not in use (yet). */
log_error("Unimplemented: received background stack bribe cost.");
}
} else {
log_debug("Bad target %d.", target_id);
if (request_kind == REQEST_PLAYER_INITIATED) {
action_selection_no_longer_in_progress(actor_id);
action_decision_clear_want(actor_id);
action_selection_next_in_focus(actor_id);
}
}
break;
case ACTION_SPY_INCITE_CITY:
case ACTION_SPY_INCITE_CITY_ESC:
if (pcity && client.conn.playing
common/actions.c
* the forced move fails. */
MAK_FORCED,
0, 1, FALSE);
actions[ACTION_SPY_BRIBE_STACK] =
unit_action_new(ACTION_SPY_BRIBE_STACK, ACTRES_SPY_BRIBE_STACK,
FALSE, TRUE,
MAK_FORCED,
0, 1, FALSE);
actions[ACTION_SPY_SABOTAGE_CITY] =
unit_action_new(ACTION_SPY_SABOTAGE_CITY, ACTRES_SPY_SABOTAGE_CITY,
FALSE, TRUE,
......
case ACTRES_MARKETPLACE:
case ACTRES_HELP_WONDER:
case ACTRES_SPY_BRIBE_UNIT:
case ACTRES_SPY_BRIBE_STACK:
case ACTRES_SPY_SABOTAGE_UNIT:
case ACTRES_CAPTURE_UNITS:
case ACTRES_FOUND_CITY:
......
case ACTRES_MARKETPLACE:
case ACTRES_HELP_WONDER:
case ACTRES_SPY_BRIBE_UNIT:
case ACTRES_SPY_BRIBE_STACK:
case ACTRES_SPY_SABOTAGE_UNIT:
case ACTRES_CAPTURE_UNITS:
case ACTRES_FOUND_CITY:
......
paction);
break;
case ACTRES_SPY_BRIBE_UNIT:
case ACTRES_SPY_BRIBE_STACK:
/* All uncertainty comes from potential diplomatic battles. */
chance = ap_diplomat_battle(actor->unit, target->unit, target->tile,
paction);
......
return "ui_name_sabotage_unit_escape";
case ACTION_SPY_BRIBE_UNIT:
return "ui_name_bribe_unit";
case ACTION_SPY_BRIBE_STACK:
return "ui_name_bribe_stack";
case ACTION_SPY_SABOTAGE_CITY:
return "ui_name_sabotage_city";
case ACTION_SPY_SABOTAGE_CITY_ESC:
......
case ACTION_SPY_BRIBE_UNIT:
/* TRANS: Bribe Enemy _Unit (3% chance of success). */
return N_("Bribe Enemy %sUnit%s");
case ACTION_SPY_BRIBE_STACK:
/* TRANS: Bribe Enemy _Stack (3% chance of success). */
return N_("Bribe Enemy %sStack%s");
case ACTION_SPY_SABOTAGE_CITY:
/* TRANS: _Sabotage City (3% chance of success). */
return N_("%sSabotage City%s");
......
case ACTION_SPY_SABOTAGE_UNIT:
case ACTION_SPY_SABOTAGE_UNIT_ESC:
case ACTION_SPY_BRIBE_UNIT:
case ACTION_SPY_BRIBE_STACK:
case ACTION_SPY_SABOTAGE_CITY:
case ACTION_SPY_SABOTAGE_CITY_ESC:
case ACTION_SPY_TARGETED_SABOTAGE_CITY:
......
case ACTION_SPY_SABOTAGE_UNIT:
case ACTION_SPY_SABOTAGE_UNIT_ESC:
case ACTION_SPY_BRIBE_UNIT:
case ACTION_SPY_BRIBE_STACK:
case ACTION_SPY_SABOTAGE_CITY:
case ACTION_SPY_SABOTAGE_CITY_ESC:
case ACTION_SPY_TARGETED_SABOTAGE_CITY:
......
case ACTION_SPY_SABOTAGE_UNIT:
case ACTION_SPY_SABOTAGE_UNIT_ESC:
case ACTION_SPY_BRIBE_UNIT:
case ACTION_SPY_BRIBE_STACK:
case ACTION_SPY_SABOTAGE_CITY:
case ACTION_SPY_SABOTAGE_CITY_ESC:
case ACTION_SPY_TARGETED_SABOTAGE_CITY:
......
case ACTION_SPY_SABOTAGE_UNIT:
case ACTION_SPY_SABOTAGE_UNIT_ESC:
case ACTION_SPY_BRIBE_UNIT:
case ACTION_SPY_BRIBE_STACK:
case ACTION_SPY_SABOTAGE_CITY:
case ACTION_SPY_SABOTAGE_CITY_ESC:
case ACTION_SPY_TARGETED_SABOTAGE_CITY:
......
case ACTION_SPY_SABOTAGE_UNIT:
case ACTION_SPY_SABOTAGE_UNIT_ESC:
case ACTION_SPY_BRIBE_UNIT:
case ACTION_SPY_BRIBE_STACK:
case ACTION_SPY_SABOTAGE_CITY:
case ACTION_SPY_SABOTAGE_CITY_ESC:
case ACTION_SPY_TARGETED_SABOTAGE_CITY:
......
fc_assert_ret_val(act != NULL, NULL);
if (!(action_has_result(act, ACTRES_SPY_BRIBE_UNIT)
|| action_has_result(act, ACTRES_SPY_BRIBE_STACK)
|| action_has_result(act, ACTRES_ATTACK)
|| action_has_result(act, ACTRES_WIPE_UNITS)
|| action_has_result(act, ACTRES_COLLECT_RANSOM))) {
......
switch ((enum gen_action)action_number(act)) {
case ACTION_SPY_BRIBE_UNIT:
return "bribe_unit_post_success_forced_actions";
case ACTION_SPY_BRIBE_STACK:
return "bribe_stack_post_success_forced_actions";
case ACTION_ATTACK:
return "attack_post_success_forced_actions";
case ACTION_ATTACK2:
common/actions.h
#define ACTION_AUTO_UPKEEP_GOLD 1
#define ACTION_AUTO_UPKEEP_SHIELD 2
#define ACTION_AUTO_MOVED_ADJ 3
#define ACTION_AUTO_POST_BRIBE 4
#define ACTION_AUTO_POST_ATTACK 5
#define ACTION_AUTO_POST_ATTACK2 6
#define ACTION_AUTO_POST_COLLECT_RANSOM 7
#define ACTION_AUTO_ESCAPE_CITY 8
#define ACTION_AUTO_ESCAPE_STACK 9
#define ACTION_AUTO_POST_WIPE_UNITS 10
#define ACTION_AUTO_POST_BRIBE_UNIT 4
#define ACTION_AUTO_POST_BRIBE_STACK 5
#define ACTION_AUTO_POST_ATTACK 6
#define ACTION_AUTO_POST_ATTACK2 7
#define ACTION_AUTO_POST_COLLECT_RANSOM 8
#define ACTION_AUTO_ESCAPE_CITY 9
#define ACTION_AUTO_ESCAPE_STACK 10
#define ACTION_AUTO_POST_WIPE_UNITS 11
/* Initialization */
void actions_init(void);
common/actres.c
{ ACT_TGT_COMPL_SIMPLE, ABK_DIPLOMATIC, /* ACTRES_SPY_BRIBE_UNIT */
TRUE, ACTIVITY_LAST, DRT_NONE,
EC_NONE, ERM_NONE, ATK_UNIT },
{ ACT_TGT_COMPL_SIMPLE, ABK_DIPLOMATIC, /* ACTRES_SPY_BRIBE_STACK */
TRUE, ACTIVITY_LAST, DRT_NONE,
EC_NONE, ERM_NONE, ATK_STACK },
{ ACT_TGT_COMPL_SIMPLE, ABK_DIPLOMATIC, /* ACTRES_SPY_SABOTAGE_UNIT */
TRUE, ACTIVITY_LAST, DRT_NONE,
EC_NONE, ERM_NONE, ATK_UNIT },
......
case ACTRES_MARKETPLACE:
case ACTRES_HELP_WONDER:
case ACTRES_SPY_BRIBE_UNIT:
case ACTRES_SPY_BRIBE_STACK:
case ACTRES_SPY_SABOTAGE_UNIT:
case ACTRES_CAPTURE_UNITS:
case ACTRES_FOUND_CITY:
......
case ACTRES_TRADE_ROUTE:
case ACTRES_MARKETPLACE:
case ACTRES_SPY_BRIBE_UNIT:
case ACTRES_SPY_BRIBE_STACK:
case ACTRES_SPY_SABOTAGE_UNIT:
case ACTRES_CAPTURE_UNITS:
case ACTRES_FOUND_CITY:
......
case ACTRES_TRANSPORT_BOARD:
case ACTRES_TRANSPORT_EMBARK:
return tgt_kind == ATK_UNIT;
case ACTRES_SPY_BRIBE_STACK:
case ACTRES_CAPTURE_UNITS:
case ACTRES_BOMBARD:
case ACTRES_NUKE_UNITS:
......
case ACTRES_SPY_TARGETED_STEAL_TECH:
return ASTK_TECH;
... This diff was truncated because it exceeds the maximum size that can be displayed.
    (1-1/1)