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 #876960 ยป 0016-is_extra_-_by_action-take-action-as-action.patch

Sveinung Kvilhaugsvik, 2020-06-08 02:48 PM

View differences:

ai/tex/texaicity.c
unit_list_iterate(units, punit) {
if (removing) {
as_rmextra_action_iterate(try_act) {
if (is_extra_removed_by_action(tgt,
action_id_get_activity(try_act))
struct action *taction = action_by_number(try_act);
if (is_extra_removed_by_action(tgt, taction)
&& action_prob_possible(
action_speculate_unit_on_tile(try_act,
punit,
unit_home(punit), ptile,
TRUE,
ptile, tgt))) {
act = action_id_get_activity(try_act);
act = action_get_activity(taction);
break;
}
} as_rmextra_action_iterate_end;
} else {
as_extra_action_iterate(try_act) {
if (is_extra_caused_by_action(tgt,
action_id_get_activity(try_act))
struct action *taction = action_by_number(try_act);
if (is_extra_caused_by_action(tgt, taction)
&& action_prob_possible(
action_speculate_unit_on_tile(try_act,
punit,
unit_home(punit), ptile,
TRUE,
ptile, tgt))) {
act = action_id_get_activity(try_act);
act = action_get_activity(taction);
break;
}
} as_extra_action_iterate_end;
ai/threaded/taicity.c
unit_list_iterate(units, punit) {
if (removing) {
as_rmextra_action_iterate(try_act) {
if (is_extra_removed_by_action(tgt,
action_id_get_activity(try_act))
struct action *taction = action_by_number(try_act);
if (is_extra_removed_by_action(tgt, taction)
&& action_prob_possible(
action_speculate_unit_on_tile(try_act,
punit,
unit_home(punit), ptile,
TRUE,
ptile, tgt))) {
act = action_id_get_activity(try_act);
act = action_get_activity(taction);
break;
}
} as_rmextra_action_iterate_end;
} else {
as_extra_action_iterate(try_act) {
if (is_extra_caused_by_action(tgt,
action_id_get_activity(try_act))
struct action *taction = action_by_number(try_act);
if (is_extra_caused_by_action(tgt, taction)
&& action_prob_possible(
action_speculate_unit_on_tile(try_act,
punit,
unit_home(punit), ptile,
TRUE,
ptile, tgt))) {
act = action_id_get_activity(try_act);
act = action_get_activity(taction);
break;
}
} as_extra_action_iterate_end;
common/extras.c
Is the extra caused by specific worker action?
****************************************************************************/
bool is_extra_caused_by_action(const struct extra_type *pextra,
enum unit_activity act)
const struct action *paction)
{
enum unit_activity act = action_get_activity(paction);
return is_extra_caused_by(pextra, activity_to_extra_cause(act));
}
......
Is the extra removed by specific worker action?
****************************************************************************/
bool is_extra_removed_by_action(const struct extra_type *pextra,
enum unit_activity act)
const struct action *paction)
{
enum unit_activity act = action_get_activity(paction);
return is_extra_removed_by(pextra, activity_to_extra_rmcause(act));
}
common/extras.h
#define is_extra_caused_by(e, c) (e->causes & (1 << c))
bool is_extra_caused_by_worker_action(const struct extra_type *pextra);
bool is_extra_caused_by_action(const struct extra_type *pextra,
enum unit_activity act);
const struct action *paction);
void extra_to_removed_by_list(struct extra_type *pextra, enum extra_rmcause rmcause);
struct extra_type_list *extra_type_list_by_rmcause(enum extra_rmcause rmcause);
......
bool is_extra_removed_by(const struct extra_type *pextra, enum extra_rmcause rmcause);
bool is_extra_removed_by_worker_action(const struct extra_type *pextra);
bool is_extra_removed_by_action(const struct extra_type *pextra,
enum unit_activity act);
const struct action *paction);
bool is_extra_card_near(const struct tile *ptile, const struct extra_type *pextra);
bool is_extra_near_tile(const struct tile *ptile, const struct extra_type *pextra);
server/advisors/autosettlers.c
if (removing) {
as_rmextra_action_iterate(try_act) {
if (is_extra_removed_by_action(pextra,
action_id_get_activity(try_act))) {
struct action *taction = action_by_number(try_act);
if (is_extra_removed_by_action(pextra, taction)) {
/* We do not even evaluate actions we can't do.
* Removal is not considered prerequisite for anything */
if (action_prob_possible(
......
ptile,
parameter.omniscience,
ptile, pextra))) {
act = action_id_get_activity(try_act);
eval_act = action_id_get_activity(act);
act = action_get_activity(taction);
eval_act = action_get_activity(taction);
break;
}
}
} as_rmextra_action_iterate_end;
} else {
as_extra_action_iterate(try_act) {
if (is_extra_caused_by_action(pextra,
action_id_get_activity(try_act))) {
struct action *taction = action_by_number(try_act);
if (is_extra_caused_by_action(pextra, taction)) {
eval_act = action_id_get_activity(try_act);
if (action_prob_possible(
action_speculate_unit_on_tile(try_act,
......
ptile,
parameter.omniscience,
ptile, pextra))) {
act = action_id_get_activity(try_act);
act = action_get_activity(taction);
break;
}
}
    (1-1/1)