Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...

Feature #923136 » 0001-Consider-effect-move-cost-in-move-to-unknown.patch

Sveinung Kvilhaugsvik, 2021-03-19 07:07 AM

View differences:

common/movement.c
{
const struct unit_class *uclass = utype_class(utype);
int move_cost;
int worst_effect_mc;
if (!uclass_has_flag(uclass, UCF_TERRAIN_SPEED)) {
/* Unit is not subject to terrain movement costs. */
......
move_cost *= SINGLE_MOVE; /* Real value. */
}
/* Move cost from effects. */
worst_effect_mc = 0;
action_by_result_iterate(paction, act_id, ACTRES_UNIT_MOVE) {
struct universal req_pattern = {
.kind = VUT_UTYPE, .value.utype = utype
};
int max_effect_mc;
if (!utype_can_do_action(utype, paction->id)) {
/* Not relevant. */
continue;
}
max_effect_mc = effect_cumulative_max(EFT_ACTION_SUCCESS_MOVE_COST,
&req_pattern);
if (max_effect_mc > worst_effect_mc) {
worst_effect_mc = max_effect_mc;
}
} action_by_result_iterate_end;
move_cost += worst_effect_mc;
/* Let's see if we can cross over all terrain types, else apply a malus.
* We want units that may encounter unsuitable terrain explore less.
* N.B.: We don't take in account terrain no unit can enter here. */
(1-1/2)