Project

General

Profile

Feature #222 ยป 0038-Move-action_sub_target_kind_default-to-actres.c.patch

Marko Lindqvist, 02/01/2024 07:21 AM

View differences:

common/actions.c
const int max_distance,
bool actor_consuming_always);
static enum action_sub_target_kind
action_sub_target_kind_default(enum action_result result);
static bool is_enabler_active(const struct action_enabler *enabler,
const struct req_context *actor,
const struct req_context *target);
......
action->actor_kind = AAK_UNIT;
action->target_kind = actres_target_kind_default(result);
action->sub_target_kind = action_sub_target_kind_default(result);
action->sub_target_kind = actres_sub_target_kind_default(result);
action->target_complexity = actres_target_compl_calc(result);
/* ASTK_NONE implies ACT_TGT_COMPL_SIMPLE and
......
return FALSE;
}
/**********************************************************************//**
Return default sub target kind for the action with the specified result.
**************************************************************************/
static enum action_sub_target_kind
action_sub_target_kind_default(enum action_result result)
{
fc_assert_ret_val(action_result_is_valid(result) || result == ACTRES_NONE,
ASTK_NONE);
switch (result) {
case ACTRES_ESTABLISH_EMBASSY:
case ACTRES_SPY_INVESTIGATE_CITY:
case ACTRES_SPY_POISON:
case ACTRES_SPY_STEAL_GOLD:
case ACTRES_SPY_SABOTAGE_CITY:
case ACTRES_SPY_SABOTAGE_CITY_PRODUCTION:
case ACTRES_SPY_STEAL_TECH:
case ACTRES_SPY_INCITE_CITY:
case ACTRES_TRADE_ROUTE:
case ACTRES_MARKETPLACE:
case ACTRES_HELP_WONDER:
case ACTRES_JOIN_CITY:
case ACTRES_STEAL_MAPS:
case ACTRES_SPY_NUKE:
case ACTRES_DESTROY_CITY:
case ACTRES_DISBAND_UNIT_RECOVER:
case ACTRES_HOME_CITY:
case ACTRES_HOMELESS:
case ACTRES_UPGRADE_UNIT:
case ACTRES_AIRLIFT:
case ACTRES_STRIKE_PRODUCTION:
case ACTRES_CONQUER_CITY:
case ACTRES_SPY_SPREAD_PLAGUE:
return ASTK_NONE;
case ACTRES_SPY_TARGETED_SABOTAGE_CITY:
case ACTRES_STRIKE_BUILDING:
return ASTK_BUILDING;
case ACTRES_SPY_TARGETED_STEAL_TECH:
return ASTK_TECH;
case ACTRES_SPY_BRIBE_UNIT:
case ACTRES_SPY_SABOTAGE_UNIT:
case ACTRES_EXPEL_UNIT:
case ACTRES_HEAL_UNIT:
case ACTRES_TRANSPORT_DEBOARD:
case ACTRES_TRANSPORT_UNLOAD:
case ACTRES_TRANSPORT_LOAD:
case ACTRES_TRANSPORT_BOARD:
case ACTRES_TRANSPORT_EMBARK:
return ASTK_NONE;
case ACTRES_CAPTURE_UNITS:
case ACTRES_BOMBARD:
case ACTRES_NUKE_UNITS:
case ACTRES_ATTACK:
case ACTRES_WIPE_UNITS:
case ACTRES_SPY_ATTACK:
case ACTRES_COLLECT_RANSOM:
return ASTK_NONE;
case ACTRES_FOUND_CITY:
case ACTRES_NUKE:
case ACTRES_PARADROP:
case ACTRES_PARADROP_CONQUER:
case ACTRES_TRANSFORM_TERRAIN:
case ACTRES_CULTIVATE:
case ACTRES_PLANT:
case ACTRES_TRANSPORT_DISEMBARK:
case ACTRES_HUT_ENTER:
case ACTRES_HUT_FRIGHTEN:
case ACTRES_UNIT_MOVE:
case ACTRES_TELEPORT:
case ACTRES_TELEPORT_CONQUER:
case ACTRES_ENABLER_CHECK:
case ACTRES_SPY_ESCAPE:
return ASTK_NONE;
case ACTRES_PILLAGE:
case ACTRES_CLEAN:
return ASTK_EXTRA;
case ACTRES_ROAD:
case ACTRES_BASE:
case ACTRES_MINE:
case ACTRES_IRRIGATE:
return ASTK_EXTRA_NOT_THERE;
case ACTRES_CONQUER_EXTRAS:
return ASTK_NONE;
case ACTRES_DISBAND_UNIT:
case ACTRES_CONVERT:
case ACTRES_FORTIFY:
return ASTK_NONE;
case ACTRES_NONE:
return ASTK_NONE;
ASSERT_UNUSED_ACTRES_CASES;
}
/* Should never be reached. */
return ASTK_NONE;
}
/**********************************************************************//**
Return actor consuming always ruleset variable name for the action or
NULL if actor consuming always can't be set in the ruleset.
common/actres.c
return 0;
}
/**********************************************************************//**
Return default sub target kind for the action with the specified result.
**************************************************************************/
enum action_sub_target_kind
actres_sub_target_kind_default(enum action_result result)
{
fc_assert_ret_val(action_result_is_valid(result) || result == ACTRES_NONE,
ASTK_NONE);
switch (result) {
case ACTRES_ESTABLISH_EMBASSY:
case ACTRES_SPY_INVESTIGATE_CITY:
case ACTRES_SPY_POISON:
case ACTRES_SPY_STEAL_GOLD:
case ACTRES_SPY_SABOTAGE_CITY:
case ACTRES_SPY_SABOTAGE_CITY_PRODUCTION:
case ACTRES_SPY_STEAL_TECH:
case ACTRES_SPY_INCITE_CITY:
case ACTRES_TRADE_ROUTE:
case ACTRES_MARKETPLACE:
case ACTRES_HELP_WONDER:
case ACTRES_JOIN_CITY:
case ACTRES_STEAL_MAPS:
case ACTRES_SPY_NUKE:
case ACTRES_DESTROY_CITY:
case ACTRES_DISBAND_UNIT_RECOVER:
case ACTRES_HOME_CITY:
case ACTRES_HOMELESS:
case ACTRES_UPGRADE_UNIT:
case ACTRES_AIRLIFT:
case ACTRES_STRIKE_PRODUCTION:
case ACTRES_CONQUER_CITY:
case ACTRES_SPY_SPREAD_PLAGUE:
return ASTK_NONE;
case ACTRES_SPY_TARGETED_SABOTAGE_CITY:
case ACTRES_STRIKE_BUILDING:
return ASTK_BUILDING;
case ACTRES_SPY_TARGETED_STEAL_TECH:
return ASTK_TECH;
case ACTRES_SPY_BRIBE_UNIT:
case ACTRES_SPY_SABOTAGE_UNIT:
case ACTRES_EXPEL_UNIT:
case ACTRES_HEAL_UNIT:
case ACTRES_TRANSPORT_DEBOARD:
case ACTRES_TRANSPORT_UNLOAD:
case ACTRES_TRANSPORT_LOAD:
case ACTRES_TRANSPORT_BOARD:
case ACTRES_TRANSPORT_EMBARK:
return ASTK_NONE;
case ACTRES_CAPTURE_UNITS:
case ACTRES_BOMBARD:
case ACTRES_NUKE_UNITS:
case ACTRES_ATTACK:
case ACTRES_WIPE_UNITS:
case ACTRES_SPY_ATTACK:
case ACTRES_COLLECT_RANSOM:
return ASTK_NONE;
case ACTRES_FOUND_CITY:
case ACTRES_NUKE:
case ACTRES_PARADROP:
case ACTRES_PARADROP_CONQUER:
case ACTRES_TRANSFORM_TERRAIN:
case ACTRES_CULTIVATE:
case ACTRES_PLANT:
case ACTRES_TRANSPORT_DISEMBARK:
case ACTRES_HUT_ENTER:
case ACTRES_HUT_FRIGHTEN:
case ACTRES_UNIT_MOVE:
case ACTRES_TELEPORT:
case ACTRES_TELEPORT_CONQUER:
case ACTRES_ENABLER_CHECK:
case ACTRES_SPY_ESCAPE:
return ASTK_NONE;
case ACTRES_PILLAGE:
case ACTRES_CLEAN:
return ASTK_EXTRA;
case ACTRES_ROAD:
case ACTRES_BASE:
case ACTRES_MINE:
case ACTRES_IRRIGATE:
return ASTK_EXTRA_NOT_THERE;
case ACTRES_CONQUER_EXTRAS:
return ASTK_NONE;
case ACTRES_DISBAND_UNIT:
case ACTRES_CONVERT:
case ACTRES_FORTIFY:
return ASTK_NONE;
case ACTRES_NONE:
return ASTK_NONE;
ASSERT_UNUSED_ACTRES_CASES;
}
/* Should never be reached. */
return ASTK_NONE;
}
/**********************************************************************//**
Return default target kind for the action with the specified result.
common/actres.h
int actres_max_range_default(enum action_result result);
enum action_target_kind
actres_target_kind_default(enum action_result result);
enum action_sub_target_kind
actres_sub_target_kind_default(enum action_result result);
#ifdef __cplusplus
}
    (1-1/1)