Project

General

Profile

Feature #739 ยป 0030-Unhardcode-wld.map-from-action_prob_self.patch

Marko Lindqvist, 06/29/2024 08:01 AM

View differences:

client/control.c
}
break;
case ATK_SELF:
if (action_prob_possible(action_prob_self(punit, act))) {
if (action_prob_possible(action_prob_self(nmap, punit, act))) {
request_do_action(act, punit->id, punit->id, 0, "");
}
break;
common/actions.c
Get the actor unit's probability of successfully performing the chosen
action on itself.
**************************************************************************/
struct act_prob action_prob_self(const struct unit *actor_unit,
struct act_prob action_prob_self(const struct civ_map *nmap,
const struct unit *actor_unit,
const action_id act_id)
{
const struct civ_map *nmap = &(wld.map);
return action_prob_self_full(nmap, actor_unit,
unit_home(actor_unit),
unit_tile(actor_unit),
......
}
break;
case ATK_SELF:
prob = action_prob_self(act_unit, paction->id);
prob = action_prob_self(nmap, act_unit, paction->id);
break;
case ATK_COUNT:
log_error("Invalid action target kind");
common/actions.h
const struct tile *target,
const struct extra_type *tgt_extra);
struct act_prob action_prob_self(const struct unit *actor,
struct act_prob action_prob_self(const struct civ_map *nmap,
const struct unit *actor,
const action_id act_id);
struct act_prob action_prob_unit_vs_tgt(const struct action *paction,
server/actiontools.c
case ATK_SELF:
if (actor
&& is_action_enabled_unit_on_self(nmap, act, actor)) {
current = action_prob_self(actor, act);
current = action_prob_self(nmap, actor, act);
}
break;
case ATK_COUNT:
server/unithand.c
case ATK_SELF:
if (actor_target_distance == 0) {
/* Calculate the probabilities. */
probabilities[act] = action_prob_self(actor_unit, act);
probabilities[act] = action_prob_self(nmap, actor_unit, act);
} else {
/* Don't bother with self targeted actions unless the actor is
* asking about what can be done to its own tile. */
server/unittools.c
tgt_id = tgt_unit->id;
break;
case ATK_SELF:
prob = action_prob_self(punit, order.action);
prob = action_prob_self(nmap, punit, order.action);
tgt_id = unitid;
break;
    (1-1/1)