Project

General

Profile

Feature #684 ยป 0077-Unhardcode-wld.map-from-action_prob_vs_extras.patch

Marko Lindqvist, 05/29/2024 08:01 PM

View differences:

client/control.c
break;
case ATK_EXTRAS:
if ((ptile = unit_tile(punit))
&& action_prob_possible(action_prob_vs_extras(punit, act,
&& action_prob_possible(action_prob_vs_extras(nmap, punit, act,
ptile, NULL))) {
request_do_action(act, punit->id, ptile->index, 0, "");
}
common/actions.c
Get the actor unit's probability of successfully performing the chosen
action on the extras at the target tile.
**************************************************************************/
struct act_prob action_prob_vs_extras(const struct unit *actor_unit,
struct act_prob action_prob_vs_extras(const struct civ_map *nmap,
const struct unit *actor_unit,
const action_id act_id,
const struct tile *target_tile,
const struct extra_type *target_extra)
{
const struct civ_map *nmap = &(wld.map);
return action_prob_vs_extras_full(nmap, actor_unit,
unit_home(actor_unit),
unit_tile(actor_unit),
......
break;
case ATK_EXTRAS:
if (tgt_tile) {
prob = action_prob_vs_extras(act_unit, paction->id,
prob = action_prob_vs_extras(nmap, act_unit, paction->id,
tgt_tile, extra_tgt);
}
break;
common/actions.h
const struct tile *victims,
const struct extra_type *target_extra);
struct act_prob action_prob_vs_extras(const struct unit *actor,
struct act_prob action_prob_vs_extras(const struct civ_map *nmap,
const struct unit *actor,
const action_id act_id,
const struct tile *target,
const struct extra_type *tgt_extra);
server/actiontools.c
prob = action_prob_vs_tile(nmap, actor, act, target, target_extra);
break;
case ATK_EXTRAS:
prob = action_prob_vs_extras(actor, act, target, target_extra);
prob = action_prob_vs_extras(nmap, actor, act, target, target_extra);
break;
case ATK_UNITS:
prob = action_prob_vs_stack(nmap, actor, act, target);
......
}
break;
case ATK_EXTRAS:
if (action_prob_possible(action_prob_vs_extras(actor, act,
if (action_prob_possible(action_prob_vs_extras(nmap, actor, act,
tgt_tile,
tgt_extra))) {
/* The actor unit may be able to do this action to the target
......
if (tgt_tile
&& is_action_enabled_unit_on_extras(nmap, act, actor,
tgt_tile, target_extra)) {
current = action_prob_vs_extras(actor, act,
current = action_prob_vs_extras(nmap, actor, act,
tgt_tile, target_extra);
}
break;
server/unithand.c
case ATK_EXTRAS:
if (target_tile) {
/* Calculate the probabilities. */
probabilities[act] = action_prob_vs_extras(actor_unit, act,
probabilities[act] = action_prob_vs_extras(nmap, actor_unit, act,
target_tile,
target_extra);
} else {
server/unittools.c
tgt_id = dst_tile->index;
break;
case ATK_EXTRAS:
prob = action_prob_vs_extras(punit, order.action,
prob = action_prob_vs_extras(nmap, punit, order.action,
dst_tile, pextra);
tgt_id = dst_tile->index;
break;
    (1-1/1)