Project

General

Profile

Feature #2032 ยป 0039-Add-select_actres_action_unit_on_city.patch

Marko Lindqvist, 05/20/2026 06:25 AM

View differences:

common/actions.c
return ACTION_NONE;
}
/************************************************************************//**
Can unit do any action with the given action result to city?
Returns one of the possible actions, or ACTION_NONE.
****************************************************************************/
enum gen_action select_actres_action_unit_on_city(struct civ_map *nmap,
enum action_result actres,
struct unit *punit,
struct city *pcity)
{
if (actres >= ACTRES_LAST) {
return ACTION_NONE;
}
action_list_iterate(action_list_by_result(actres), paction) {
enum gen_action act = action_number(paction);
if (action_id_get_target_kind(act) == ATK_CITY
&& is_action_enabled_unit_on_city(nmap, act, punit, pcity)) {
return act;
}
} action_list_iterate_end;
return ACTION_NONE;
}
common/actions.h
enum action_result actres,
struct unit *punit,
struct tile *ptile);
enum gen_action select_actres_action_unit_on_city(struct civ_map *nmap,
enum action_result actres,
struct unit *punit,
struct city *pcity);
#ifdef __cplusplus
}
    (1-1/1)