Project

General

Profile

Feature #806 ยป 0015-Rename-ATK_UNITS-as-ATK_STACK.patch

Marko Lindqvist, 08/25/2024 04:10 PM

View differences:

client/control.c
request_do_action(act, punit->id, punit->id, 0, "");
}
break;
case ATK_UNITS:
case ATK_STACK:
if ((ptile = unit_tile(punit))
&& action_prob_possible(action_prob_vs_stack(nmap, punit, act, ptile))) {
request_do_action(act, punit->id, ptile->index, 0, "");
client/gui-gtk-3.22/action_dialog.c
failed = TRUE;
}
break;
case ATK_UNITS:
case ATK_STACK:
case ATK_TILE:
case ATK_EXTRAS:
target_id = args->target_tile_id;
......
failed = TRUE;
}
break;
case ATK_UNITS:
case ATK_STACK:
case ATK_TILE:
case ATK_EXTRAS:
target_id = args->target_tile_id;
......
target_ids[ATK_UNIT] = target_unit ?
target_unit->id :
IDENTITY_NUMBER_ZERO;
target_ids[ATK_UNITS] = target_tile ?
target_ids[ATK_STACK] = target_tile ?
tile_index(target_tile) :
TILE_INDEX_NONE;
target_ids[ATK_TILE] = target_tile ?
......
action_iterate(act) {
if (action_id_get_actor_kind(act) == AAK_UNIT
&& action_id_get_target_kind(act) == ATK_UNITS) {
&& action_id_get_target_kind(act) == ATK_STACK) {
action_entry(shl, act, act_probs,
get_act_sel_action_custom_text(action_by_number(act),
act_probs[act],
client/gui-gtk-4.0/action_dialog.c
failed = TRUE;
}
break;
case ATK_UNITS:
case ATK_STACK:
case ATK_TILE:
case ATK_EXTRAS:
target_id = args->target_tile_id;
......
failed = TRUE;
}
break;
case ATK_UNITS:
case ATK_STACK:
case ATK_TILE:
case ATK_EXTRAS:
target_id = args->target_tile_id;
......
target_ids[ATK_UNIT] = target_unit ?
target_unit->id :
IDENTITY_NUMBER_ZERO;
target_ids[ATK_UNITS] = target_tile ?
target_ids[ATK_STACK] = target_tile ?
tile_index(target_tile) :
TILE_INDEX_NONE;
target_ids[ATK_TILE] = target_tile ?
......
action_iterate(act) {
if (action_id_get_actor_kind(act) == AAK_UNIT
&& action_id_get_target_kind(act) == ATK_UNITS) {
&& action_id_get_target_kind(act) == ATK_STACK) {
action_entry(shl, act, act_probs,
get_act_sel_action_custom_text(action_by_number(act),
act_probs[act],
client/gui-gtk-5.0/action_dialog.c
failed = TRUE;
}
break;
case ATK_UNITS:
case ATK_STACK:
case ATK_TILE:
case ATK_EXTRAS:
target_id = args->target_tile_id;
......
failed = TRUE;
}
break;
case ATK_UNITS:
case ATK_STACK:
case ATK_TILE:
case ATK_EXTRAS:
target_id = args->target_tile_id;
......
target_ids[ATK_UNIT] = target_unit ?
target_unit->id :
IDENTITY_NUMBER_ZERO;
target_ids[ATK_UNITS] = target_tile ?
target_ids[ATK_STACK] = target_tile ?
tile_index(target_tile) :
TILE_INDEX_NONE;
target_ids[ATK_TILE] = target_tile ?
......
action_iterate(act) {
if (action_id_get_actor_kind(act) == AAK_UNIT
&& action_id_get_target_kind(act) == ATK_UNITS) {
&& action_id_get_target_kind(act) == ATK_STACK) {
action_entry(shl, act, act_probs,
get_act_sel_action_custom_text(action_by_number(act),
act_probs[act],
client/gui-qt/dialogs.cpp
target_id[ATK_SELF] = unit_id;
target_id[ATK_CITY] = IDENTITY_NUMBER_ZERO;
target_id[ATK_UNIT] = IDENTITY_NUMBER_ZERO;
target_id[ATK_UNITS] = TILE_INDEX_NONE;
target_id[ATK_STACK] = TILE_INDEX_NONE;
target_id[ATK_TILE] = TILE_INDEX_NONE;
target_id[ATK_EXTRAS] = TILE_INDEX_NONE;
sub_target_id[ASTK_BUILDING] = B_LAST;
......
}
if (target_tile) {
cd->target_id[ATK_UNITS] = tile_index(target_tile);
cd->target_id[ATK_STACK] = tile_index(target_tile);
} else {
cd->target_id[ATK_UNITS] = TILE_INDEX_NONE;
cd->target_id[ATK_STACK] = TILE_INDEX_NONE;
}
if (target_tile) {
......
// Unit acting against all units at a tile
// Set the correct target for the following actions.
qv2 = cd->target_id[ATK_UNITS];
qv2 = cd->target_id[ATK_STACK];
action_iterate(act) {
if (action_id_get_actor_kind(act) == AAK_UNIT
&& action_id_get_target_kind(act) == ATK_UNITS) {
&& action_id_get_target_kind(act) == ATK_STACK) {
action_entry(cd, act, act_probs,
get_act_sel_action_custom_text(action_by_number(act),
act_probs[act],
......
break;
case ATK_TILE:
case ATK_EXTRAS:
case ATK_UNITS:
case ATK_STACK:
if (target_tile != nullptr) {
qv2 = tile_index(target_tile);
} else {
client/gui-sdl2/action_dialog.c
failed = TRUE;
}
break;
case ATK_UNITS:
case ATK_STACK:
case ATK_TILE:
case ATK_EXTRAS:
target_id = diplomat_dlg->target_ids[ATK_TILE];
......
break;
case ATK_TILE:
case ATK_EXTRAS:
case ATK_UNITS:
case ATK_STACK:
buf->data.tile = tgt_tile;
break;
case ATK_SELF:
......
diplomat_dlg->target_ids[ATK_UNIT] = IDENTITY_NUMBER_ZERO;
}
diplomat_dlg->target_ids[ATK_UNITS] = tile_index(target_tile);
diplomat_dlg->target_ids[ATK_STACK] = tile_index(target_tile);
diplomat_dlg->target_ids[ATK_TILE] = tile_index(target_tile);
diplomat_dlg->target_ids[ATK_EXTRAS] = tile_index(target_tile);
......
action_iterate(act) {
if (action_id_get_actor_kind(act) == AAK_UNIT
&& action_id_get_target_kind(act) == ATK_UNITS) {
&& action_id_get_target_kind(act) == ATK_STACK) {
action_entry(act, act_probs,
actor_unit, target_tile, NULL, NULL,
pwindow, &area);
client/gui-sdl3/action_dialog.c
failed = TRUE;
}
break;
case ATK_UNITS:
case ATK_STACK:
case ATK_TILE:
case ATK_EXTRAS:
target_id = diplomat_dlg->target_ids[ATK_TILE];
......
break;
case ATK_TILE:
case ATK_EXTRAS:
case ATK_UNITS:
case ATK_STACK:
buf->data.tile = tgt_tile;
break;
case ATK_SELF:
......
diplomat_dlg->target_ids[ATK_UNIT] = IDENTITY_NUMBER_ZERO;
}
diplomat_dlg->target_ids[ATK_UNITS] = tile_index(target_tile);
diplomat_dlg->target_ids[ATK_STACK] = tile_index(target_tile);
diplomat_dlg->target_ids[ATK_TILE] = tile_index(target_tile);
diplomat_dlg->target_ids[ATK_EXTRAS] = tile_index(target_tile);
......
action_iterate(act) {
if (action_id_get_actor_kind(act) == AAK_UNIT
&& action_id_get_target_kind(act) == ATK_UNITS) {
&& action_id_get_target_kind(act) == ATK_STACK) {
action_entry(act, act_probs,
actor_unit, target_tile, NULL, NULL,
pwindow, &area);
client/helpdata.c
/* Not relevant */
if (action_id_get_target_kind(act) != ATK_UNIT
&& action_id_get_target_kind(act) != ATK_UNITS
&& action_id_get_target_kind(act) != ATK_STACK
&& action_id_get_target_kind(act) != ATK_SELF) {
continue;
}
client/packhand.c
/* Give the order. */
switch (action_id_get_target_kind(auto_action)) {
case ATK_TILE:
case ATK_UNITS:
case ATK_STACK:
case ATK_EXTRAS:
if (target_tile != NULL) {
request_do_action(auto_action,
common/actions.c
return NULL;
}
return unit_tile(target_unit);
case ATK_UNITS:
case ATK_STACK:
fc_assert_ret_val(target_unit || target_tile_arg, NULL);
if (target_unit) {
return unit_tile(target_unit);
......
fc_assert_ret_val(target_unit, NULL);
fc_assert_ret_val(unit_tile(target_unit), NULL);
return tile_city(unit_tile(target_unit));
case ATK_UNITS:
case ATK_STACK:
fc_assert_ret_val(target_unit || target_tile, NULL);
if (target_unit) {
fc_assert_ret_val(unit_tile(target_unit), NULL);
......
return blocker;
}
break;
case ATK_UNITS:
case ATK_STACK:
if (!target_tile) {
/* Can't be enabled. No target. */
continue;
......
|| (tkind == ATK_EXTRAS && target->tile != NULL)
|| (tkind == ATK_UNIT && target->unit != NULL)
/* At this level each individual unit is tested. */
|| (tkind == ATK_UNITS && target->unit != NULL)
|| (tkind == ATK_STACK && target->unit != NULL)
|| (tkind == ATK_SELF),
"Missing target!");
......
return TRI_NO;
}
break;
case ATK_UNITS:
case ATK_STACK:
case ATK_TILE:
case ATK_EXTRAS:
case ATK_SELF:
......
action_id_get_actor_kind(wanted_action)),
action_actor_kind_name(AAK_UNIT));
fc_assert_ret_val_msg(ATK_UNITS
fc_assert_ret_val_msg(ATK_STACK
== action_id_get_target_kind(wanted_action),
FALSE, "Action %s is against %s not %s",
action_id_rule_name(wanted_action),
action_target_kind_name(
action_id_get_target_kind(wanted_action)),
action_target_kind_name(ATK_UNITS));
action_target_kind_name(ATK_STACK));
fc_assert_ret_val(actor_tile, FALSE);
......
action_id_get_actor_kind(act_id)),
action_actor_kind_name(AAK_UNIT));
fc_assert_ret_val_msg(ATK_UNITS == action_id_get_target_kind(act_id),
fc_assert_ret_val_msg(ATK_STACK == action_id_get_target_kind(act_id),
ACTPROB_IMPOSSIBLE,
"Action %s is against %s not %s",
action_id_rule_name(act_id),
action_target_kind_name(
action_id_get_target_kind(act_id)),
action_target_kind_name(ATK_UNITS));
action_target_kind_name(ATK_STACK));
fc_assert_ret_val(actor_tile, ACTPROB_IMPOSSIBLE);
......
fc_assert_ret_val(act_unit, ACTPROB_IMPOSSIBLE);
switch (action_get_target_kind(paction)) {
case ATK_UNITS:
case ATK_STACK:
if (tgt_tile) {
prob = action_prob_vs_stack(nmap, act_unit, paction->id, tgt_tile);
}
......
{
N_("individual cities"), /* ATK_CITY */
N_("individual units"), /* ATK_UNIT */
N_("unit stacks"), /* ATK_UNITS */
N_("unit stacks"), /* ATK_STACK */
N_("tiles"), /* ATK_TILE */
N_("tile extras"), /* ATK_EXTRAS */
N_("itself") /* ATK_SELF */
common/actres.c
EC_NONE, ERM_NONE, ATK_UNIT },
{ ACT_TGT_COMPL_SIMPLE, ABK_NONE, /* ACTRES_CAPTURE_UNITS */
TRUE, ACTIVITY_LAST, DRT_NONE,
EC_NONE, ERM_NONE, ATK_UNITS },
EC_NONE, ERM_NONE, ATK_STACK },
{ ACT_TGT_COMPL_SIMPLE, ABK_NONE, /* ACTRES_FOUND_CITY */
FALSE, ACTIVITY_LAST, DRT_NONE,
EC_NONE, ERM_NONE, ATK_TILE },
......
EC_NONE, ERM_NONE, ATK_CITY },
{ ACT_TGT_COMPL_SIMPLE, ABK_NONE, /* ACTRES_BOMBARD */
TRUE, ACTIVITY_LAST, DRT_NONE,
EC_NONE, ERM_NONE, ATK_UNITS },
EC_NONE, ERM_NONE, ATK_STACK },
{ ACT_TGT_COMPL_SIMPLE, ABK_DIPLOMATIC, /* ACTRES_SPY_NUKE */
TRUE, ACTIVITY_LAST, DRT_DIPLCHANCE,
EC_NONE, ERM_NONE, ATK_CITY },
......
EC_NONE, ERM_NONE, ATK_TILE },
{ ACT_TGT_COMPL_SIMPLE, ABK_NONE, /* ACTRES_NUKE_UNITS */
TRUE, ACTIVITY_LAST, DRT_NONE,
EC_NONE, ERM_NONE, ATK_UNITS },
EC_NONE, ERM_NONE, ATK_STACK },
{ ACT_TGT_COMPL_SIMPLE, ABK_NONE, /* ACTRES_DESTROY_CITY */
TRUE, ACTIVITY_LAST, DRT_NONE,
EC_NONE, ERM_NONE, ATK_CITY },
......
EC_NONE, ERM_NONE, ATK_CITY },
{ ACT_TGT_COMPL_SIMPLE, ABK_STANDARD, /* ACTRES_ATTACK */
TRUE, ACTIVITY_LAST, DRT_NONE,
EC_NONE, ERM_NONE, ATK_UNITS },
EC_NONE, ERM_NONE, ATK_STACK },
{ ACT_TGT_COMPL_MANDATORY, ABK_NONE, /* ACTRES_STRIKE_BUILDING */
TRUE, ACTIVITY_LAST, DRT_DIPLCHANCE,
EC_NONE, ERM_NONE, ATK_CITY },
......
EC_IRRIGATION, ERM_NONE, ATK_TILE },
{ ACT_TGT_COMPL_SIMPLE, ABK_STANDARD, /* ACTRES_COLLECT_RANSOM */
TRUE, ACTIVITY_LAST, DRT_NONE,
EC_NONE, ERM_NONE, ATK_UNITS },
EC_NONE, ERM_NONE, ATK_STACK },
{ ACT_TGT_COMPL_SIMPLE, ABK_NONE, /* ACTRES_TRANSPORT_DEBOARD */
FALSE, ACTIVITY_LAST, DRT_NONE,
EC_NONE, ERM_NONE, ATK_UNIT },
......
EC_NONE, ERM_NONE, ATK_CITY },
{ ACT_TGT_COMPL_SIMPLE, ABK_DIPLOMATIC, /* ACTRES_SPY_ATTACK */
TRUE, ACTIVITY_LAST, DRT_NONE,
EC_NONE, ERM_NONE, ATK_UNITS },
EC_NONE, ERM_NONE, ATK_STACK },
{ ACT_TGT_COMPL_SIMPLE, ABK_NONE, /* ACTRES_CONQUER_EXTRAS */
TRUE, ACTIVITY_LAST, DRT_NONE,
EC_NONE, ERM_NONE, ATK_EXTRAS },
......
EC_NONE, ERM_NONE, ATK_SELF },
{ ACT_TGT_COMPL_SIMPLE, ABK_STANDARD, /* ACTRES_WIPE_UNITS */
TRUE, ACTIVITY_LAST, DRT_NONE,
EC_NONE, ERM_NONE, ATK_UNITS },
EC_NONE, ERM_NONE, ATK_STACK },
{ ACT_TGT_COMPL_SIMPLE, ABK_NONE, /* ACTRES_SPY_ESCAPE */
FALSE, ACTIVITY_LAST, DRT_NONE,
EC_NONE, ERM_NONE, ATK_CITY },
......
case ACTRES_WIPE_UNITS:
case ACTRES_SPY_ATTACK:
case ACTRES_COLLECT_RANSOM:
return tgt_kind == ATK_UNITS;
return tgt_kind == ATK_STACK;
case ACTRES_FOUND_CITY:
case ACTRES_PARADROP:
case ACTRES_PARADROP_CONQUER:
......
switch (tgt_kind) {
case ATK_CITY:
case ATK_UNIT:
case ATK_UNITS:
case ATK_STACK:
case ATK_TILE:
case ATK_EXTRAS:
case ATK_SELF:
common/actres.h
#define SPECENUM_VALUE0NAME "City"
#define SPECENUM_VALUE1 ATK_UNIT
#define SPECENUM_VALUE1NAME "Unit"
#define SPECENUM_VALUE2 ATK_UNITS
#define SPECENUM_VALUE2 ATK_STACK
#define SPECENUM_VALUE2NAME "Stack"
#define SPECENUM_VALUE3 ATK_TILE
#define SPECENUM_VALUE3NAME "Tile"
common/unit.c
punit, ptile, target); \
case ATK_CITY: \
case ATK_UNIT: \
case ATK_UNITS: \
case ATK_STACK: \
case ATK_SELF: \
return FALSE; \
case ATK_COUNT: \
server/actiontools.c
victim_link);
break;
case ATK_UNIT:
case ATK_UNITS:
case ATK_STACK:
notify_player(receiver, victim_tile,
E_DIPLOMATIC_INCIDENT, ftc_server,
/* TRANS: Bribe Enemy Unit ... American ... Partisan */
......
victim_link);
break;
case ATK_UNIT:
case ATK_UNITS:
case ATK_STACK:
notify_player(receiver, victim_tile,
E_DIPLOMATIC_INCIDENT, ftc_server,
/* TRANS: Europeans ... Bribe Enemy Unit ... Partisan */
......
victim_link);
break;
case ATK_UNIT:
case ATK_UNITS:
case ATK_STACK:
notify_player(receiver, victim_tile,
E_DIPLOMATIC_INCIDENT, ftc_server,
/* TRAND: Bribe Enemy Unit ... American ... Partisan */
......
victim_link);
break;
case ATK_UNIT:
case ATK_UNITS:
case ATK_STACK:
notify_player(receiver, victim_tile,
E_DIPLOMATIC_INCIDENT, ftc_server,
/* TRANS: Europeans ... Bribe Enemy Unit ... Partisan */
......
case ATK_EXTRAS:
prob = action_prob_vs_extras(nmap, actor, act, target, target_extra);
break;
case ATK_UNITS:
case ATK_STACK:
prob = action_prob_vs_stack(nmap, actor, act, target);
break;
case ATK_CITY:
......
break;
case ATK_CITY:
case ATK_UNIT:
case ATK_UNITS:
case ATK_STACK:
case ATK_SELF:
/* Not supported. */
break;
......
}
switch (action_id_get_target_kind(act)) {
case ATK_UNITS:
case ATK_STACK:
if (tgt_tile
&& is_action_enabled_unit_on_stack(nmap, act, actor, tgt_tile)) {
perform_action_to(act, actor, tgt_tile->index, EXTRA_NONE);
......
/* This action can be done by units. */
switch (action_id_get_target_kind(act)) {
case ATK_UNITS:
case ATK_STACK:
if (tgt_tile
&& is_action_enabled_unit_on_stack(nmap, act, actor, tgt_tile)) {
current = action_prob_vs_stack(nmap, actor, act, tgt_tile);
server/advisors/autoworkers.c
fc_assert_ret_val(action_get_target_kind(paction) != ATK_UNIT,
FALSE);
break;
case ATK_UNITS:
case ATK_STACK:
return action_prob_possible(action_speculate_unit_on_stack(
paction->id,
punit, unit_home(punit), ptile,
server/diplomats.c
victim_link = city_link(pcity);
break;
case ATK_UNIT:
case ATK_UNITS:
case ATK_STACK:
victim_link = pvictim ? unit_tile_link(pvictim)
: tile_link(ptile);
break;
server/ruleset/rssanity.c
requirement_vector_iterate(&peffect->reqs, preq) {
if (preq->source.kind == VUT_ACTION) {
if (action_get_target_kind(preq->source.value.action) != ATK_UNIT) {
/* TODO: support for ATK_UNITS could be added. That would require
/* TODO: support for ATK_STACK could be added. That would require
* manually calling action_success_target_pay_mp() in each
* supported unit stack targeted action performer (like
* action_consequence_success() does) or to have the unit stack
server/scripting/api_server_edit.c
fc_assert_ret_val(action_get_actor_kind(paction) == AAK_UNIT, FALSE);
switch (action_get_target_kind(paction)) {
case ATK_UNITS:
case ATK_STACK:
enabled = is_action_enabled_unit_on_stack(nmap, paction->id, punit, tgt);
break;
case ATK_TILE:
......
fc_assert_ret_val(action_get_actor_kind(paction) == AAK_UNIT, FALSE);
switch (action_get_target_kind(paction)) {
case ATK_UNITS:
case ATK_STACK:
enabled = is_action_enabled_unit_on_stack(nmap, paction->id, punit, tgt);
break;
case ATK_TILE:
server/unithand.c
case ACTRES_WIPE_UNITS:
case ACTRES_COLLECT_RANSOM:
/* Target is a unit stack but a city can block it. */
fc_assert_action(action_get_target_kind(paction) == ATK_UNITS, break);
fc_assert_action(action_get_target_kind(paction) == ATK_STACK, break);
if (!unit_has_type_flag(actor, UTYF_FLAGLESS)) {
if (target_tile != NULL) {
......
target_player = unit_owner(target_unit);
break;
case ATK_UNITS:
case ATK_STACK:
if (target_tile == NULL) {
/* No target units since no target tile. */
return NULL;
......
explnat->kind = ANEK_MISSING_TARGET;
}
break;
case ATK_UNITS:
case ATK_STACK:
case ATK_TILE:
case ATK_EXTRAS:
if (target_tile == NULL) {
......
case ATK_EXTRAS:
tgt_player = target_tile->extras_owner;
break;
case ATK_UNITS:
case ATK_STACK:
/* A unit stack may contain units with multiple owners. Pick the
* first one. */
if (target_tile
......
probabilities[act] = ACTPROB_IMPOSSIBLE;
}
break;
case ATK_UNITS:
case ATK_STACK:
if (target_tile) {
/* Calculate the probabilities. */
probabilities[act] = action_prob_vs_stack(nmap, actor_unit, act,
......
target_extra_id = target_extra->id;
}
break;
case ATK_UNITS:
case ATK_STACK:
/* The target tile isn't selected here so it hasn't changed. */
fc_assert(target_tile != NULL);
break;
......
fc_assert_ret_val(target_tile != NULL, FALSE);
pcity = tile_city(target_tile);
break;
case ATK_UNITS:
case ATK_STACK:
case ATK_TILE:
case ATK_EXTRAS:
target_tile = index_to_tile(nmap, target_id);
......
ACTION_PERFORM_UNIT_UNIT(paction->id, actor, target_unit, \
action_performer); \
break; \
case ATK_UNITS: \
case ATK_STACK: \
ACTION_PERFORM_UNIT_UNITS(paction->id, actor, target_tile, \
action_performer); \
break; \
server/unittools.c
prob = ACTPROB_IMPOSSIBLE;
switch (action_id_get_target_kind(order.action)) {
case ATK_UNITS:
case ATK_STACK:
prob = action_prob_vs_stack(nmap, punit, order.action,
dst_tile);
tgt_id = dst_tile->index;
    (1-1/1)