Freeciv-3.3
Loading...
Searching...
No Matches
Macros | Functions | Variables
actions.c File Reference
#include <math.h>
#include <stdarg.h>
#include "astring.h"
#include "actions.h"
#include "city.h"
#include "combat.h"
#include "fc_interface.h"
#include "game.h"
#include "map.h"
#include "metaknowledge.h"
#include "movement.h"
#include "oblig_reqs.h"
#include "research.h"
#include "server_settings.h"
#include "unit.h"

Go to the source code of this file.

Macros

#define ACTPROB_VAL_MIN   0
 
#define ACTPROB_VAL_MAX   200
 
#define ACTPROB_VAL_1_PCT   (ACTPROB_VAL_MAX / 100)
 
#define ACTPROB_VAL_NA   253
 
#define ACTPROB_VAL_NOT_IMPL   254
 

Functions

static struct actionunit_action_new (action_id id, enum action_result result, bool rare_pop_up, bool unitwaittime_controlled, enum moves_actor_kind moves_actor, const int min_distance, const int max_distance, bool actor_consuming_always)
 
static struct actionplayer_action_new (action_id id, enum action_result result)
 
static bool is_enabler_active (const struct action_enabler *enabler, const struct req_context *actor, const struct req_context *target)
 
static bool action_prob_is_signal (const struct act_prob probability)
 
static bool action_prob_not_relevant (const struct act_prob probability)
 
static bool action_prob_not_impl (const struct act_prob probability)
 
static struct act_prob ap_diplomat_battle (const struct unit *pattacker, const struct unit *pvictim, const struct tile *tgt_tile, const struct action *paction) fc__attribute((nonnull(3)))
 
 FC_STATIC_ASSERT (MAP_DISTANCE_MAX<=ACTION_DISTANCE_LAST_NON_SIGNAL, action_range_can_not_cover_the_whole_map)
 
static void hard_code_actions (void)
 
void actions_init (void)
 
void actions_rs_pre_san_gen (void)
 
void actions_free (void)
 
bool actions_are_ready (void)
 
static struct actionaction_new (action_id id, enum action_result result, const int min_distance, const int max_distance, bool actor_consuming_always)
 
bool action_id_exists (const action_id act_id)
 
struct actionaction_by_rule_name (const char *name)
 
enum action_actor_kind action_get_actor_kind (const struct action *paction)
 
enum action_target_kind action_get_target_kind (const struct action *paction)
 
enum action_sub_target_kind action_get_sub_target_kind (const struct action *paction)
 
bool action_has_complex_target (const struct action *paction)
 
bool action_requires_details (const struct action *paction)
 
bool action_id_is_rare_pop_up (action_id act_id)
 
bool action_distance_inside_max (const struct action *action, const int distance)
 
bool action_distance_accepted (const struct action *action, const int distance)
 
bool action_would_be_blocked_by (const struct action *blocked, const struct action *blocker)
 
int action_number (const struct action *action)
 
const charaction_rule_name (const struct action *action)
 
const charaction_name_translation (const struct action *paction)
 
const charaction_id_rule_name (action_id act_id)
 
const charaction_id_name_translation (action_id act_id)
 
const charaction_get_ui_name_mnemonic (action_id act_id, const char *mnemonic)
 
static const charaction_prob_to_text (const struct act_prob prob)
 
const charaction_prepare_ui_name (action_id act_id, const char *mnemonic, const struct act_prob prob, const char *custom)
 
const charaction_prob_explain (const struct act_prob prob)
 
int action_get_role (const struct action *paction)
 
struct action_enableraction_enabler_new (void)
 
void action_enabler_free (struct action_enabler *enabler)
 
struct action_enableraction_enabler_copy (const struct action_enabler *original)
 
void action_enabler_add (struct action_enabler *enabler)
 
bool action_enabler_remove (struct action_enabler *enabler)
 
struct action_enabler_listaction_enablers_for_action (action_id action)
 
static struct req_vec_problemae_suggest_repair_if_no_oblig (const struct action_enabler *enabler, const struct obligatory_req_vector *oblig)
 
struct req_vec_problemaction_enabler_suggest_repair_oblig (const struct action_enabler *enabler)
 
static struct requirementreq_vec_first_local_diplrel (const struct requirement_vector *vec)
 
static struct requirementreq_vec_first_contradiction_in_vec (const struct requirement *req, const struct requirement_vector *vec)
 
static struct req_vec_problemenabler_tile_tgt_local_diplrel_implies_claimed (const struct action_enabler *enabler)
 
static struct req_vec_problemenabler_first_self_contradiction (const struct action_enabler *enabler)
 
struct req_vec_problemaction_enabler_suggest_repair (const struct action_enabler *enabler)
 
static struct req_vec_problemenabler_first_clarification (const struct action_enabler *enabler)
 
struct req_vec_problemaction_enabler_suggest_improvement (const struct action_enabler *enabler)
 
req_vec_num_in_item action_enabler_vector_number (const void *enabler, const struct requirement_vector *vec)
 
struct requirement_vectoraction_enabler_vector_by_number (const void *enabler, req_vec_num_in_item number)
 
const charaction_enabler_vector_by_number_name (req_vec_num_in_item vec)
 
static const struct impr_typetgt_city_local_building (const struct city *target_city)
 
static const struct unit_typetgt_city_local_utype (const struct city *target_city)
 
static const struct tileblocked_find_target_tile (const struct action *act, const struct unit *actor_unit, const struct tile *target_tile_arg, const struct city *target_city, const struct unit *target_unit)
 
static const struct cityblocked_find_target_city (const struct action *act, const struct unit *actor_unit, const struct tile *target_tile, const struct city *target_city_arg, const struct unit *target_unit)
 
struct actionaction_is_blocked_by (const struct civ_map *nmap, const struct action *act, const struct unit *actor_unit, const struct tile *target_tile_arg, const struct city *target_city_arg, const struct unit *target_unit)
 
static bool action_actor_utype_hard_reqs_ok_full (const struct action *paction, const struct unit_type *actor_unittype, bool ignore_third_party)
 
bool action_actor_utype_hard_reqs_ok (const struct action *paction, const struct unit_type *actor_unittype)
 
static enum fc_tristate action_hard_reqs_actor (const struct civ_map *nmap, const struct action *paction, const struct req_context *actor, const bool omniscient, const struct city *homecity)
 
static enum fc_tristate is_action_possible (const struct civ_map *nmap, const action_id wanted_action, const struct req_context *actor, const struct req_context *target, const struct extra_type *target_extra, const bool omniscient, const struct city *homecity)
 
static bool is_action_enabled (const struct civ_map *nmap, const action_id wanted_action, const struct req_context *actor, const struct req_context *target, const struct extra_type *target_extra, const struct city *actor_home)
 
static bool is_action_enabled_unit_on_city_full (const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct city *actor_home, const struct tile *actor_tile, const struct city *target_city)
 
bool is_action_enabled_unit_on_city (const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct city *target_city)
 
static bool is_action_enabled_unit_on_unit_full (const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct city *actor_home, const struct tile *actor_tile, const struct unit *target_unit)
 
bool is_action_enabled_unit_on_unit (const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct unit *target_unit)
 
static bool is_action_enabled_unit_on_stack_full (const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct city *actor_home, const struct tile *actor_tile, const struct tile *target_tile)
 
bool is_action_enabled_unit_on_stack (const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct tile *target_tile)
 
static bool is_action_enabled_unit_on_tile_full (const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct city *actor_home, const struct tile *actor_tile, const struct tile *target_tile, const struct extra_type *target_extra)
 
bool is_action_enabled_unit_on_tile (const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct tile *target_tile, const struct extra_type *target_extra)
 
static bool is_action_enabled_unit_on_extras_full (const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct city *actor_home, const struct tile *actor_tile, const struct tile *target_tile, const struct extra_type *target_extra)
 
bool is_action_enabled_unit_on_extras (const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct tile *target_tile, const struct extra_type *target_extra)
 
static bool is_action_enabled_unit_on_self_full (const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct city *actor_home, const struct tile *actor_tile)
 
bool is_action_enabled_unit_on_self (const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit)
 
bool is_action_enabled_player (const struct civ_map *nmap, const action_id wanted_action, const struct player *actor_plr)
 
static enum fc_tristate action_enabled_local (const action_id wanted_action, const struct req_context *actor, const struct req_context *target)
 
static bool is_effect_val_known (enum effect_type effect_type, const struct player *pov_player, const struct req_context *context, const struct req_context *other_context)
 
static enum fc_tristate tech_can_be_stolen (const struct player *actor_player, const struct player *target_player)
 
static struct act_prob ap_dipl_battle_win (const struct unit *pattacker, const struct unit *pdefender)
 
static struct act_prob act_prob_unseen_target (const struct civ_map *nmap, action_id act_id, const struct unit *actor_unit)
 
static struct act_prob action_prob_pre_action_dice_roll (const struct player *act_player, const struct unit *act_unit, const struct city *tgt_city, const struct player *tgt_player, const struct action *paction)
 
static struct act_prob action_prob_battle_then_dice_roll (const struct player *act_player, const struct unit *act_unit, const struct city *tgt_city, const struct unit *tgt_unit, const struct tile *tgt_tile, const struct player *tgt_player, const struct action *paction)
 
static struct act_prob action_prob (const struct civ_map *nmap, const action_id wanted_action, const struct req_context *actor, const struct city *actor_home, const struct req_context *target, const struct extra_type *target_extra)
 
static struct act_prob action_prob_vs_city_full (const struct civ_map *nmap, const struct unit *actor_unit, const struct city *actor_home, const struct tile *actor_tile, const action_id act_id, const struct city *target_city)
 
struct act_prob action_prob_vs_city (const struct civ_map *nmap, const struct unit *actor_unit, const action_id act_id, const struct city *target_city)
 
static struct act_prob action_prob_vs_unit_full (const struct civ_map *nmap, const struct unit *actor_unit, const struct city *actor_home, const struct tile *actor_tile, const action_id act_id, const struct unit *target_unit)
 
struct act_prob action_prob_vs_unit (const struct civ_map *nmap, const struct unit *actor_unit, const action_id act_id, const struct unit *target_unit)
 
static struct act_prob action_prob_vs_stack_full (const struct civ_map *nmap, const struct unit *actor_unit, const struct city *actor_home, const struct tile *actor_tile, const action_id act_id, const struct tile *target_tile)
 
struct act_prob action_prob_vs_stack (const struct civ_map *nmap, const struct unit *actor_unit, const action_id act_id, const struct tile *target_tile)
 
static struct act_prob action_prob_vs_tile_full (const struct civ_map *nmap, const struct unit *actor_unit, const struct city *actor_home, const struct tile *actor_tile, const action_id act_id, const struct tile *target_tile, const struct extra_type *target_extra)
 
struct act_prob action_prob_vs_tile (const struct civ_map *nmap, const struct unit *actor_unit, const action_id act_id, const struct tile *target_tile, const struct extra_type *target_extra)
 
static struct act_prob action_prob_vs_extras_full (const struct civ_map *nmap, const struct unit *actor_unit, const struct city *actor_home, const struct tile *actor_tile, const action_id act_id, const struct tile *target_tile, const struct extra_type *target_extra)
 
struct act_prob action_prob_vs_extras (const struct civ_map *nmap, const struct unit *actor_unit, const action_id act_id, const struct tile *target_tile, const struct extra_type *target_extra)
 
static struct act_prob action_prob_self_full (const struct civ_map *nmap, const struct unit *actor_unit, const struct city *actor_home, const struct tile *actor_tile, const action_id act_id)
 
struct act_prob action_prob_self (const struct civ_map *nmap, const struct unit *actor_unit, const action_id act_id)
 
struct act_prob action_prob_unit_vs_tgt (const struct civ_map *nmap, const struct action *paction, const struct unit *act_unit, const struct city *tgt_city, const struct unit *tgt_unit, const struct tile *tgt_tile, const struct extra_type *extra_tgt)
 
struct act_prob action_speculate_unit_on_city (const struct civ_map *nmap, const action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, const bool omniscient_cheat, const struct city *target)
 
struct act_prob action_speculate_unit_on_unit (const struct civ_map *nmap, action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat, const struct unit *target)
 
struct act_prob action_speculate_unit_on_stack (const struct civ_map *nmap, action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat, const struct tile *target)
 
struct act_prob action_speculate_unit_on_tile (const struct civ_map *nmap, action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat, const struct tile *target_tile, const struct extra_type *target_extra)
 
struct act_prob action_speculate_unit_on_extras (const struct civ_map *nmap, action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat, const struct tile *target_tile, const struct extra_type *target_extra)
 
struct act_prob action_speculate_unit_on_self (const struct civ_map *nmap, action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat)
 
struct act_prob action_prob_new_impossible (void)
 
struct act_prob action_prob_new_certain (void)
 
struct act_prob action_prob_new_not_relevant (void)
 
struct act_prob action_prob_new_not_impl (void)
 
struct act_prob action_prob_new_unknown (void)
 
bool action_prob_possible (const struct act_prob probability)
 
bool action_prob_certain (const struct act_prob probability)
 
bool are_action_probabilitys_equal (const struct act_prob *ap1, const struct act_prob *ap2)
 
int action_prob_cmp_pessimist (const struct act_prob ap1, const struct act_prob ap2)
 
double action_prob_to_0_to_1_pessimist (const struct act_prob ap)
 
struct act_prob action_prob_and (const struct act_prob *ap1, const struct act_prob *ap2)
 
struct act_prob action_prob_fall_back (const struct act_prob *ap1, const struct act_prob *ap2)
 
int action_dice_roll_initial_odds (const struct action *paction)
 
int action_dice_roll_odds (const struct player *act_player, const struct unit *act_unit, const struct city *tgt_city, const struct player *tgt_player, const struct action *paction)
 
bool action_immune_government (struct government *gov, action_id act)
 
static bool is_target_possible (const action_id wanted_action, const struct player *actor_player, const struct req_context *target)
 
bool is_action_possible_on_city (action_id act_id, const struct player *actor_player, const struct city *target_city)
 
bool action_maybe_possible_actor_unit (const struct civ_map *nmap, const action_id act_id, const struct unit *actor_unit)
 
bool action_mp_full_makes_legal (const struct unit *actor, const action_id act_id)
 
bool action_enabler_utype_possible_actor (const struct action_enabler *ae, const struct unit_type *act_utype)
 
bool action_enabler_possible_actor (const struct action_enabler *ae)
 
static bool action_has_possible_actor_hard_reqs (struct action *paction)
 
bool action_is_in_use (struct action *paction)
 
bool action_is_internal (struct action *paction)
 
bool action_id_is_internal (action_id act)
 
struct action_auto_perfaction_auto_perf_slot_number (const int num)
 
const struct action_auto_perfaction_auto_perf_by_number (const int num)
 
bool action_univs_not_blocking (const struct action *paction, struct universal *actor_uni, struct universal *target_uni)
 
void action_array_end (action_id *act_array, int size)
 
void action_array_add_all_by_result (action_id *act_array, int *position, enum action_result result)
 
const charaction_ui_name_ruleset_var_name (int act)
 
const charaction_ui_name_default (int act)
 
const charaction_min_range_ruleset_var_name (int act)
 
const charaction_max_range_ruleset_var_name (int act)
 
const charaction_target_kind_ruleset_var_name (int act)
 
const charaction_actor_consuming_always_ruleset_var_name (action_id act)
 
const charaction_blocked_by_ruleset_var_name (const struct action *act)
 
const charaction_post_success_forced_ruleset_var_name (const struct action *act)
 
bool action_ever_possible (action_id action)
 
const chargen_action_name_update_cb (const char *old_name)
 
const charaction_target_kind_help (enum action_target_kind kind)
 
struct action_listaction_list_by_result (enum action_result result)
 
struct action_listaction_list_by_activity (enum unit_activity activity)
 

Variables

static struct actionactions [MAX_NUM_ACTIONS]
 
struct action ** _actions = actions
 
struct action_auto_perf auto_perfs [MAX_NUM_ACTION_AUTO_PERFORMERS]
 
static bool actions_initialized = FALSE
 
static struct action_enabler_listaction_enablers_by_action [MAX_NUM_ACTIONS]
 
static struct astring ui_name_str = ASTRING_INIT
 
static struct action_listactlist_by_result [ACTRES_LAST]
 
static struct action_listactlist_by_activity [ACTIVITY_LAST]
 
const charatk_helpnames [ATK_COUNT]
 

Macro Definition Documentation

◆ ACTPROB_VAL_1_PCT

#define ACTPROB_VAL_1_PCT   (ACTPROB_VAL_MAX / 100)

Definition at line 51 of file actions.c.

◆ ACTPROB_VAL_MAX

#define ACTPROB_VAL_MAX   200

Definition at line 49 of file actions.c.

◆ ACTPROB_VAL_MIN

#define ACTPROB_VAL_MIN   0

Definition at line 47 of file actions.c.

◆ ACTPROB_VAL_NA

#define ACTPROB_VAL_NA   253

Definition at line 53 of file actions.c.

◆ ACTPROB_VAL_NOT_IMPL

#define ACTPROB_VAL_NOT_IMPL   254

Definition at line 55 of file actions.c.

Function Documentation

◆ act_prob_unseen_target()

static struct act_prob act_prob_unseen_target ( const struct civ_map nmap,
action_id  act_id,
const struct unit actor_unit 
)
static

Returns the action probability for when a target is unseen.

Definition at line 3731 of file actions.c.

Referenced by action_prob_vs_city_full(), and action_prob_vs_stack_full().

◆ action_actor_consuming_always_ruleset_var_name()

const char * action_actor_consuming_always_ruleset_var_name ( action_id  act)

Return actor consuming always ruleset variable name for the action or NULL if actor consuming always can't be set in the ruleset.

TODO: make actions generic and put actor consuming always in a field of the action.

Definition at line 7006 of file actions.c.

Referenced by load_action_actor_consuming_always(), and save_action_actor_consuming_always().

◆ action_actor_utype_hard_reqs_ok()

bool action_actor_utype_hard_reqs_ok ( const struct action paction,
const struct unit_type actor_unittype 
)

Returns TRUE if the specified unit type can perform the specified action given that an action enabler later will enable it.

This is done by checking the action result's hard requirements. Hard requirements must be TRUE before an action can be done. The reason why is usually that code dealing with the action assumes that the requirements are true. A requirement may also end up here if it can't be expressed in a requirement vector or if its absence makes the action pointless.

Parameters
pactionthe action to check the hard reqs for
actor_unittypethe unit type that may be able to act
Returns
TRUE iff the specified unit type can perform the wanted action given that an action enabler later will enable it.

Definition at line 2607 of file actions.c.

Referenced by action_enabler_suggest_improvement(), action_enabler_utype_possible_actor(), action_has_possible_actor_hard_reqs(), expl_act_not_enabl(), and unit_can_act_cache_set().

◆ action_actor_utype_hard_reqs_ok_full()

static bool action_actor_utype_hard_reqs_ok_full ( const struct action paction,
const struct unit_type actor_unittype,
bool  ignore_third_party 
)
static

Returns TRUE if the specified unit type can perform the specified action given that an action enabler later will enable it.

This is done by checking the action result's hard requirements. Hard requirements must be TRUE before an action can be done. The reason why is usually that code dealing with the action assumes that the requirements are true. A requirement may also end up here if it can't be expressed in a requirement vector or if its absence makes the action pointless.

When adding a new hard requirement here: explain why it is a hard requirement in a comment.

Parameters
pactionthe action to check the hard reqs for
actor_unittypethe unit type that may be able to act
ignore_third_partyignore if potential targets etc exists
Returns
TRUE iff the specified unit type can perform the wanted action given that an action enabler later will enable it.

Definition at line 2399 of file actions.c.

Referenced by action_actor_utype_hard_reqs_ok(), and action_hard_reqs_actor().

◆ action_array_add_all_by_result()

void action_array_add_all_by_result ( action_id act_array,
int position,
enum action_result  result 
)

Add all actions with the specified result to the specified action array starting at the specified position.

Parameters
act_arraythe array to add the actions to
positionindex in act_array that is updated as action are added
resultall actions with this result are added.

Definition at line 5787 of file actions.c.

Referenced by adv_data_phase_init(), auto_workers_ruleset_init(), dai_upgrade_units(), and helptext_building().

◆ action_array_end()

void action_array_end ( action_id act_array,
int  size 
)

Terminate an action array of the specified size.

Parameters
act_arraythe array to end
sizethe number of elements to include in the list

Definition at line 5770 of file actions.c.

Referenced by adv_data_phase_init(), auto_workers_ruleset_init(), dai_upgrade_units(), helptext_building(), and save_action_auto_actions().

◆ action_auto_perf_by_number()

const struct action_auto_perf * action_auto_perf_by_number ( const int  num)

Returns action auto performer rule number num.

Used in action_auto_perf_iterate()

WARNING: If the cause of the returned action performer rule is AAPC_COUNT it means that it is unused.

Definition at line 5738 of file actions.c.

Referenced by save_action_auto_actions(), save_action_auto_uflag_block(), and save_actions_ruleset().

◆ action_auto_perf_slot_number()

struct action_auto_perf * action_auto_perf_slot_number ( const int  num)

Returns action auto performer rule slot number num so it can be filled.

Definition at line 5722 of file actions.c.

Referenced by action_auto_perf_by_number(), handle_ruleset_action_auto(), load_action_post_success_force(), load_ruleset_actions(), load_ruleset_cities(), and sanity_check_ruleset_data().

◆ action_blocked_by_ruleset_var_name()

const char * action_blocked_by_ruleset_var_name ( const struct action act)

Return action blocked by ruleset variable name for the action or NULL if actor consuming always can't be set in the ruleset.

TODO: make actions generic and put blocked by actions in a field of the action.

Definition at line 7179 of file actions.c.

Referenced by load_action_blocked_by_list(), and save_action_blocked_by().

◆ action_by_rule_name()

struct action * action_by_rule_name ( const char name)

Return the action with the given name.

Returns NULL if no action with the given name exists.

Definition at line 1079 of file actions.c.

Referenced by api_find_action_by_name(), api_find_action_type_by_name(), compat_load_030300(), tab_enabler::edit_type(), load_ruleset_actions(), sg_load_savefile(), and universal_value_from_str().

◆ action_dice_roll_initial_odds()

int action_dice_roll_initial_odds ( const struct action paction)

Returns the initial odds of an action not failing its dice roll.

Definition at line 5367 of file actions.c.

Referenced by action_dice_roll_odds(), effect_list_sanity_cb(), and helptext_unit().

◆ action_dice_roll_odds()

int action_dice_roll_odds ( const struct player act_player,
const struct unit act_unit,
const struct city tgt_city,
const struct player tgt_player,
const struct action paction 
)

Returns the odds of an action not failing its dice roll.

Definition at line 5391 of file actions.c.

Referenced by action_failed_dice_roll(), and action_prob_pre_action_dice_roll().

◆ action_distance_accepted()

bool action_distance_accepted ( const struct action action,
const int  distance 
)

Returns TRUE iff the specified distance between actor and target is within the range acceptable to the specified action.

Definition at line 1184 of file actions.c.

Referenced by is_action_possible().

◆ action_distance_inside_max()

bool action_distance_inside_max ( const struct action action,
const int  distance 
)

Returns TRUE iff the specified distance between actor and target is sm,aller or equal to the max range accepted by the specified action.

Definition at line 1173 of file actions.c.

Referenced by action_distance_accepted(), expl_act_not_enabl(), and sanity_check_ruleset_data().

◆ action_enabled_local()

static enum fc_tristate action_enabled_local ( const action_id  wanted_action,
const struct req_context actor,
const struct req_context target 
)
static

Find out if the action is enabled, may be enabled or isn't enabled given what the player owning the actor knowns.

A player don't always know everything needed to figure out if an action is enabled or not. A server side AI with the same limits on its knowledge as a human player or a client should use this to figure out what is what.

Assumes to be called from the point of view of the actor. Its knowledge is assumed to be given in the parameters.

Returns TRI_YES if the action is enabled, TRI_NO if it isn't and TRI_MAYBE if the player don't know enough to tell.

If meta knowledge is missing TRI_MAYBE will be returned.

target may be NULL. This is equivalent to passing an empty context.

Definition at line 3524 of file actions.c.

Referenced by action_prob().

◆ action_enabler_add()

void action_enabler_add ( struct action_enabler enabler)

◆ action_enabler_copy()

struct action_enabler * action_enabler_copy ( const struct action_enabler original)

Create a new copy of an existing action enabler.

Definition at line 1511 of file actions.c.

Referenced by fix_enabler_item::fix_enabler_item(), and rscompat_enabler_add_obligatory_hard_reqs().

◆ action_enabler_free()

void action_enabler_free ( struct action_enabler enabler)

Free resources allocated for the action enabler.

Definition at line 1495 of file actions.c.

Referenced by actions_free(), and fix_enabler_item::~fix_enabler_item().

◆ action_enabler_new()

struct action_enabler * action_enabler_new ( void  )

Create a new action enabler.

Definition at line 1475 of file actions.c.

Referenced by action_enabler_copy(), tab_enabler::add_now(), handle_ruleset_action_enabler(), load_ruleset_actions(), and rscompat_postprocess().

◆ action_enabler_possible_actor()

bool action_enabler_possible_actor ( const struct action_enabler ae)

Returns TRUE iff the specified action enabler may have an actor that it may be enabled for in the current ruleset. An enabler can't be enabled if no potential actor fulfills both its action's hard requirements and its own actor requirement vector, actor_reqs. Note that the answer may be "no" even if this function returns TRUE. It may just be unable to detect it.

Parameters
aethe action enabler to check
Returns
TRUE if the enabler may be enabled at all

Definition at line 5619 of file actions.c.

Referenced by ruleset_purge_unused_enablers().

◆ action_enabler_remove()

bool action_enabler_remove ( struct action_enabler enabler)

Remove an action enabler from the current ruleset.

Returns TRUE on success.

Definition at line 1543 of file actions.c.

Referenced by tab_enabler::edit_type().

◆ action_enabler_suggest_improvement()

struct req_vec_problem * action_enabler_suggest_improvement ( const struct action_enabler enabler)

Returns a suggestion to improve the specified action enabler or NULL if nothing to improve is found to be needed. It is the responsibility of the caller to free the suggestion when it is done with it. A possible improvement isn't always an error.

Parameters
enablerthe enabler to improve
Returns
a suggestion to improve the specified action enabler

Definition at line 1988 of file actions.c.

Referenced by enabler_problem_level(), fix_enabler_item::find_next_problem(), and sanity_check_ruleset_data().

◆ action_enabler_suggest_repair()

struct req_vec_problem * action_enabler_suggest_repair ( const struct action_enabler enabler)

Returns a suggestion to fix the specified action enabler or NULL if no fix is found to be needed. It is the responsibility of the caller to free the suggestion with req_vec_problem_free() when it is done with it.

Definition at line 1922 of file actions.c.

Referenced by action_enabler_suggest_improvement(), enabler_problem_level(), fix_enabler_item::find_next_problem(), rscompat_enabler_add_obligatory_hard_reqs(), and sanity_check_ruleset_data().

◆ action_enabler_suggest_repair_oblig()

struct req_vec_problem * action_enabler_suggest_repair_oblig ( const struct action_enabler enabler)

Returns a suggestion to add an obligatory hard requirement to an action enabler or NULL if no hard obligatory reqs were missing. It is the responsibility of the caller to free the suggestion when it is done with it.

Parameters
enablerthe action enabler to suggest a fix for.
Returns
a problem with fix suggestions or NULL if no obligatory hard requirement problems were detected.

Definition at line 1683 of file actions.c.

Referenced by action_enabler_suggest_repair().

◆ action_enabler_utype_possible_actor()

bool action_enabler_utype_possible_actor ( const struct action_enabler ae,
const struct unit_type act_utype 
)

Returns TRUE iff the specified action enabler may be active for an actor of the specified unit type in the current ruleset. Note that the answer may be "no" even if this function returns TRUE. It may just be unable to detect it.

Parameters
aethe action enabler to check
act_utypethe candidate actor unit type
Returns
TRUE if the enabler may be active for act_utype

Definition at line 5592 of file actions.c.

Referenced by action_enabler_possible_actor().

◆ action_enabler_vector_by_number()

struct requirement_vector * action_enabler_vector_by_number ( const void enabler,
req_vec_num_in_item  number 
)

Returns a writable pointer to the specified requirement vector in the action enabler or NULL if the action enabler doesn't have a requirement vector with that requirement vector number.

Parameters
enablerthe action enabler that may own the vector.
numberthe item's requirement vector number.
Returns
a pointer to the specified requirement vector.

Definition at line 2075 of file actions.c.

Referenced by rscompat_enabler_add_obligatory_hard_reqs(), and fix_enabler_item::vector_getter().

◆ action_enabler_vector_by_number_name()

const char * action_enabler_vector_by_number_name ( req_vec_num_in_item  vec)

Returns the name of the given requirement vector number n in an action enabler or NULL if enablers don't have a requirement vector with that number.

Parameters
vecthe requirement vector to name
Returns
the requirement vector name or NULL.

Definition at line 2099 of file actions.c.

Referenced by rscompat_enabler_add_obligatory_hard_reqs(), and fix_enabler_item::vector_namer().

◆ action_enabler_vector_number()

req_vec_num_in_item action_enabler_vector_number ( const void enabler,
const struct requirement_vector vec 
)

Returns the requirement vector number of the specified requirement vector in the specified action enabler.

Parameters
enablerthe action enabler that may own the vector.
vecthe requirement vector to number.
Returns
the requirement vector number the vector has in this enabler.

Definition at line 2052 of file actions.c.

Referenced by action_enabler_suggest_improvement(), action_enabler_suggest_repair(), ae_suggest_repair_if_no_oblig(), enabler_first_self_contradiction(), and enabler_tile_tgt_local_diplrel_implies_claimed().

◆ action_enablers_for_action()

struct action_enabler_list * action_enablers_for_action ( action_id  action)

◆ action_ever_possible()

bool action_ever_possible ( action_id  action)

Is the action ever possible? Currently just checks that there's any action enablers for the action.

Definition at line 7550 of file actions.c.

Referenced by create_unit_menu(), dai_upgrade_units(), present_unit_callback(), and units_report_selection_callback().

◆ action_get_actor_kind()

enum action_actor_kind action_get_actor_kind ( const struct action paction)

◆ action_get_role()

int action_get_role ( const struct action paction)

Get the unit type role corresponding to the ability to do the specified action.

Definition at line 1463 of file actions.c.

◆ action_get_sub_target_kind()

enum action_sub_target_kind action_get_sub_target_kind ( const struct action paction)

◆ action_get_target_kind()

enum action_target_kind action_get_target_kind ( const struct action paction)

◆ action_get_ui_name_mnemonic()

const char * action_get_ui_name_mnemonic ( action_id  act_id,
const char mnemonic 
)

Get the action name with a mnemonic ready to display in the UI.

Definition at line 1258 of file actions.c.

Referenced by real_menus_init(), and real_menus_update().

◆ action_hard_reqs_actor()

static enum fc_tristate action_hard_reqs_actor ( const struct civ_map nmap,
const struct action paction,
const struct req_context actor,
const bool  omniscient,
const struct city homecity 
)
static

Returns TRUE iff the wanted action is possible as far as the actor is concerned given that an action enabler later will enable it. Will, unlike action_actor_utype_hard_reqs_ok(), check the actor unit's current state.

Can return maybe when not omniscient. Should always return yes or no when omniscient.

Passing NULL for actor is equivalent to passing an empty context. This may or may not be legal depending on the action.

Definition at line 2627 of file actions.c.

Referenced by action_maybe_possible_actor_unit(), and is_action_possible().

◆ action_has_complex_target()

bool action_has_complex_target ( const struct action paction)

Returns TRUE iff the specified action allows the player to provide details in addition to actor and target. Returns FALSE if the action doesn't support any additional details.

Definition at line 1132 of file actions.c.

◆ action_has_possible_actor_hard_reqs()

static bool action_has_possible_actor_hard_reqs ( struct action paction)
static

Returns TRUE iff the specified action has an actor that fulfills its hard requirements in the current ruleset.

Parameters
pactionthe action to check
Returns
TRUE if the action's hard requirement may be fulfilled in the current ruleset.

Definition at line 5650 of file actions.c.

Referenced by action_is_in_use().

◆ action_id_exists()

bool action_id_exists ( const action_id  act_id)

◆ action_id_is_internal()

bool action_id_is_internal ( action_id  act)

Is action by id for freeciv's internal use only?

Parameters
actId of the action to check
Returns
Whether action is for internal use only

Definition at line 5714 of file actions.c.

Referenced by action_ui_name_ruleset_var_name(), load_ruleset_actions(), and save_actions_ruleset().

◆ action_id_is_rare_pop_up()

bool action_id_is_rare_pop_up ( action_id  act_id)

Returns TRUE iff a unit's ability to perform this action will pop up the action selection dialog before the player asks for it only in exceptional cases.

An example of an exceptional case is when the player tries to move a unit to a tile it can't move to but can perform this action to.

Definition at line 1160 of file actions.c.

Referenced by action_tgt_tile(), may_unit_act_vs_city(), may_unit_act_vs_tile_extra(), and may_unit_act_vs_unit().

◆ action_id_name_translation()

const char * action_id_name_translation ( action_id  act_id)

◆ action_id_rule_name()

const char * action_id_rule_name ( action_id  act_id)

◆ action_immune_government()

bool action_immune_government ( struct government gov,
action_id  act 
)

Will a player with the government gov be immune to the action act?

Definition at line 5447 of file actions.c.

Referenced by adv_gov_action_immunity_want(), and helptext_government().

◆ action_is_blocked_by()

struct action * action_is_blocked_by ( const struct civ_map nmap,
const struct action act,
const struct unit actor_unit,
const struct tile target_tile_arg,
const struct city target_city_arg,
const struct unit target_unit 
)

Returns the action that blocks the specified action or NULL if the specified action isn't blocked.

An action that can block another blocks when it is forced and possible.

Definition at line 2286 of file actions.c.

Referenced by action_prob_vs_city_full(), action_prob_vs_stack_full(), expl_act_not_enabl(), and is_action_possible().

◆ action_is_in_use()

bool action_is_in_use ( struct action paction)

Returns TRUE if the specified action may be enabled in the current ruleset.

Parameters
pactionthe action to check if is in use.
Returns
TRUE if the action could be enabled in the current ruleset.

Definition at line 5676 of file actions.c.

Referenced by action_immune_government(), helptext_building(), helptext_unit(), ruleset_purge_unused_enablers(), save_action_actor_consuming_always(), save_action_auto_actions(), save_action_blocked_by(), save_action_kind(), save_action_post_success_force(), save_actions_ruleset(), save_bv_actions(), and universal_never_there().

◆ action_is_internal()

bool action_is_internal ( struct action paction)

Is the action for freeciv's internal use only?

Parameters
pactionThe action to check
Returns
Whether action is for internal use only

Definition at line 5702 of file actions.c.

Referenced by action_id_is_internal().

◆ action_list_by_activity()

struct action_list * action_list_by_activity ( enum unit_activity  activity)

Returns action list by activity.

Definition at line 7612 of file actions.c.

Referenced by unit_activity_handling_targeted().

◆ action_list_by_result()

struct action_list * action_list_by_result ( enum action_result  result)

Returns action list by result.

Definition at line 7602 of file actions.c.

◆ action_max_range_ruleset_var_name()

const char * action_max_range_ruleset_var_name ( int  act)

Return max range ruleset variable name for the action or NULL if max range can't be set in the ruleset.

TODO: make actions generic and put max_range in a field of the action.

Definition at line 6647 of file actions.c.

Referenced by load_action_range_max(), save_action_max_range(), and save_action_range().

◆ action_maybe_possible_actor_unit()

bool action_maybe_possible_actor_unit ( const struct civ_map nmap,
const action_id  act_id,
const struct unit actor_unit 
)

Returns TRUE if the wanted action (as far as the player knows) can be performed right now by the specified actor unit if an approriate target is provided.

Definition at line 5514 of file actions.c.

Referenced by act_prob_unseen_target(), can_unit_paradrop(), can_unit_teleport(), and handle_unit_get_actions().

◆ action_min_range_ruleset_var_name()

const char * action_min_range_ruleset_var_name ( int  act)

Return min range ruleset variable name for the action or NULL if min range can't be set in the ruleset.

TODO: Make actions generic and put min_range in a field of the action.

Definition at line 6469 of file actions.c.

Referenced by load_action_range(), and save_action_range().

◆ action_mp_full_makes_legal()

bool action_mp_full_makes_legal ( const struct unit actor,
const action_id  act_id 
)

Returns TRUE if the specified action can't be done now but would have been legal if the unit had full movement.

Definition at line 5569 of file actions.c.

Referenced by execute_orders(), and expl_act_not_enabl().

◆ action_name_translation()

const char * action_name_translation ( const struct action paction)

Get the action name used when displaying the action in the UI. Nothing is added to the UI name.

This always returns the same static string, just modified according to the call. Copy the result if you want it to remain valid over another call to this function.

Definition at line 1230 of file actions.c.

Referenced by go_act_menu::create(), do_paradrop(), do_unit_strike_city_building(), do_unit_strike_city_production(), helptext_unit(), illegal_action_pay_price(), key_unit_action_select_tgt(), notify_actor_caught(), notify_actor_success(), notify_global_caught(), notify_global_success(), notify_victim_caught(), notify_victim_success(), req_text_insert(), spy_poison(), spy_spread_plague(), unit_attack_civilian_casualties(), unit_bombard(), unit_do_help_build(), and universal_name_translation().

◆ action_new()

static struct action * action_new ( action_id  id,
enum action_result  result,
const int  min_distance,
const int  max_distance,
bool  actor_consuming_always 
)
static

Create a new action.

Definition at line 966 of file actions.c.

Referenced by player_action_new(), and unit_action_new().

◆ action_number()

int action_number ( const struct action action)

◆ action_post_success_forced_ruleset_var_name()

const char * action_post_success_forced_ruleset_var_name ( const struct action act)

Return action post success forced action ruleset variable name for the action or NULL if it can't be set in the ruleset.

Definition at line 7373 of file actions.c.

Referenced by load_action_post_success_force(), and save_action_post_success_force().

◆ action_prepare_ui_name()

const char * action_prepare_ui_name ( action_id  act_id,
const char mnemonic,
const struct act_prob  prob,
const char custom 
)

Get the UI name ready to show the action in the UI. It is possible to add a client specific mnemonic; it is assumed that if the mnemonic appears in the action name it can be escaped by doubling. Success probability information is interpreted and added to the text. A custom text can be inserted before the probability information.

The returned string is in statically allocated astring, and thus this function is not thread-safe.

Definition at line 1312 of file actions.c.

Referenced by action_entry(), action_entry(), action_entry(), action_entry_update(), action_entry_update(), action_get_ui_name_mnemonic(), and action_id_name_translation().

◆ action_prob()

static struct act_prob action_prob ( const struct civ_map nmap,
const action_id  wanted_action,
const struct req_context actor,
const struct city actor_home,
const struct req_context target,
const struct extra_type target_extra 
)
static

An action's probability of success.

"Success" indicates that the action achieves its goal, not that the actor survives. For actions that cost money it is assumed that the player has and is willing to spend the money. This is so the player can figure out what their odds are before deciding to get the extra money.

Passing NULL for actor or target is equivalent to passing an empty context. This may or may not be legal depending on the action.

Definition at line 3845 of file actions.c.

Referenced by action_prob_self_full(), action_prob_vs_city_full(), action_prob_vs_extras_full(), action_prob_vs_stack_full(), action_prob_vs_tile_full(), and action_prob_vs_unit_full().

◆ action_prob_and()

struct act_prob action_prob_and ( const struct act_prob ap1,
const struct act_prob ap2 
)

Returns ap1 and ap2 - as in both ap1 and ap2 happening. Said in math that is: P(A) * P(B)

Definition at line 5229 of file actions.c.

Referenced by action_prob_battle_then_dice_roll().

◆ action_prob_battle_then_dice_roll()

static struct act_prob action_prob_battle_then_dice_roll ( const struct player act_player,
const struct unit act_unit,
const struct city tgt_city,
const struct unit tgt_unit,
const struct tile tgt_tile,
const struct player tgt_player,
const struct action paction 
)
static

Returns the action probability of an action winning a potential pre action battle - like a diplomatic battle - and then not failing its dice roll. Shouldn't leak information.

Definition at line 3797 of file actions.c.

Referenced by action_prob().

◆ action_prob_certain()

bool action_prob_certain ( const struct act_prob  probability)

Returns TRUE iff the given action probability is certain that its action is possible.

Definition at line 5101 of file actions.c.

◆ action_prob_cmp_pessimist()

int action_prob_cmp_pessimist ( const struct act_prob  ap1,
const struct act_prob  ap2 
)

Compare action probabilities. Prioritize the lowest possible value.

Definition at line 5151 of file actions.c.

Referenced by compare_units().

◆ action_prob_explain()

const char * action_prob_explain ( const struct act_prob  prob)

Explain an action probability in a way suitable for a tool tip for the button that starts it.

Returns
an explanation of what an action probability means

The returned string is in statically allocated astring, and thus this function is not thread-safe.

Definition at line 1423 of file actions.c.

Referenced by act_sel_action_tool_tip().

◆ action_prob_fall_back()

struct act_prob action_prob_fall_back ( const struct act_prob ap1,
const struct act_prob ap2 
)

Returns ap1 with ap2 as fall back in cases where ap1 doesn't happen. Said in math that is: P(A) + P(A') * P(B)

This is useful to calculate the probability of doing action A or, when A is impossible, falling back to doing action B.

Definition at line 5299 of file actions.c.

Referenced by action_auto_perf_unit_prob().

◆ action_prob_is_signal()

static bool action_prob_is_signal ( const struct act_prob  probability)
inlinestatic

Returns TRUE iff the given action probability represents a special signal value rather than a regular action probability value.

Definition at line 5134 of file actions.c.

Referenced by action_prob(), action_prob_and(), action_prob_cmp_pessimist(), action_prob_explain(), action_prob_fall_back(), action_prob_to_0_to_1_pessimist(), action_prob_to_text(), and action_prob_vs_stack_full().

◆ action_prob_new_certain()

struct act_prob action_prob_new_certain ( void  )

Returns the certain action probability.

Definition at line 5050 of file actions.c.

◆ action_prob_new_impossible()

struct act_prob action_prob_new_impossible ( void  )

Returns the impossible action probability.

Definition at line 5040 of file actions.c.

◆ action_prob_new_not_impl()

struct act_prob action_prob_new_not_impl ( void  )

Returns the "not implemented" action probability.

Definition at line 5070 of file actions.c.

◆ action_prob_new_not_relevant()

struct act_prob action_prob_new_not_relevant ( void  )

Returns the n/a action probability.

Definition at line 5060 of file actions.c.

◆ action_prob_new_unknown()

struct act_prob action_prob_new_unknown ( void  )

Returns the "user don't know" action probability.

Definition at line 5080 of file actions.c.

◆ action_prob_not_impl()

static bool action_prob_not_impl ( const struct act_prob  probability)
inlinestatic

Returns TRUE iff the given action probability represents that support for finding this action probability currently is missing from Freeciv.

Definition at line 5123 of file actions.c.

Referenced by action_prob_and(), action_prob_cmp_pessimist(), action_prob_explain(), action_prob_fall_back(), action_prob_possible(), action_prob_to_0_to_1_pessimist(), action_prob_to_text(), and action_prob_vs_stack_full().

◆ action_prob_not_relevant()

static bool action_prob_not_relevant ( const struct act_prob  probability)
inlinestatic

Returns TRUE iff the given action probability represents the lack of an action probability.

Definition at line 5112 of file actions.c.

Referenced by action_prepare_ui_name(), action_prob_and(), action_prob_cmp_pessimist(), action_prob_fall_back(), action_prob_to_0_to_1_pessimist(), and action_prob_to_text().

◆ action_prob_possible()

bool action_prob_possible ( const struct act_prob  probability)

◆ action_prob_pre_action_dice_roll()

static struct act_prob action_prob_pre_action_dice_roll ( const struct player act_player,
const struct unit act_unit,
const struct city tgt_city,
const struct player tgt_player,
const struct action paction 
)
static

Returns the action probability of an action not failing its dice roll without leaking information.

Definition at line 3749 of file actions.c.

Referenced by action_prob(), and action_prob_battle_then_dice_roll().

◆ action_prob_self()

struct act_prob action_prob_self ( const struct civ_map nmap,
const struct unit actor_unit,
const action_id  act_id 
)

Get the actor unit's probability of successfully performing the chosen action on itself.

Definition at line 4765 of file actions.c.

Referenced by action_auto_perf_unit_prob(), action_prob_unit_vs_tgt(), do_disband_alternative(), execute_orders(), and handle_unit_get_actions().

◆ action_prob_self_full()

static struct act_prob action_prob_self_full ( const struct civ_map nmap,
const struct unit actor_unit,
const struct city actor_home,
const struct tile actor_tile,
const action_id  act_id 
)
static

Get the actor unit's probability of successfully performing the chosen action on itself.

Definition at line 4712 of file actions.c.

Referenced by action_prob_self(), and action_speculate_unit_on_self().

◆ action_prob_to_0_to_1_pessimist()

double action_prob_to_0_to_1_pessimist ( const struct act_prob  ap)

Returns double in the range [0-1] representing the minimum of the given action probability.

Definition at line 5202 of file actions.c.

Referenced by unit_survive_autoattack().

◆ action_prob_to_text()

static const char * action_prob_to_text ( const struct act_prob  prob)
static

Returns a text representation of the action probability prob unless it is a signal. Returns NULL if prob is a signal.

The returned string is in statically allocated astring, and thus this function is not thread-safe.

Definition at line 1271 of file actions.c.

Referenced by action_prepare_ui_name().

◆ action_prob_unit_vs_tgt()

struct act_prob action_prob_unit_vs_tgt ( const struct civ_map nmap,
const struct action paction,
const struct unit act_unit,
const struct city tgt_city,
const struct unit tgt_unit,
const struct tile tgt_tile,
const struct extra_type extra_tgt 
)

Returns the actor unit's probability of successfully performing the specified action against the action specific target.

Parameters
nmapMap to consult
pactionThe action to perform
act_unitThe actor unit
tgt_cityThe target for city targeted actions
tgt_unitThe target for unit targeted actions
tgt_tileThe target for tile and unit stack targeted actions
extra_tgtThe target for extra sub targeted actions
Returns
The action probability of performing the action

Definition at line 4787 of file actions.c.

Referenced by dai_manage_paratrooper(), do_unit_paradrop_to(), do_unit_teleport_to(), and illegal_action().

◆ action_prob_vs_city()

struct act_prob action_prob_vs_city ( const struct civ_map nmap,
const struct unit actor_unit,
const action_id  act_id,
const struct city target_city 
)

◆ action_prob_vs_city_full()

static struct act_prob action_prob_vs_city_full ( const struct civ_map nmap,
const struct unit actor_unit,
const struct city actor_home,
const struct tile actor_tile,
const action_id  act_id,
const struct city target_city 
)
static

Get the actor unit's probability of successfully performing the chosen action on the target city.

Definition at line 4167 of file actions.c.

Referenced by action_prob_vs_city(), and action_speculate_unit_on_city().

◆ action_prob_vs_extras()

struct act_prob action_prob_vs_extras ( const struct civ_map nmap,
const struct unit actor_unit,
const action_id  act_id,
const struct tile target_tile,
const struct extra_type target_extra 
)

Get the actor unit's probability of successfully performing the chosen action on the extras at the target tile.

Definition at line 4695 of file actions.c.

Referenced by action_auto_perf_unit_prob(), action_prob_unit_vs_tgt(), action_tgt_tile(), do_disband_alternative(), execute_orders(), handle_unit_get_actions(), and may_unit_act_vs_tile_extra().

◆ action_prob_vs_extras_full()

static struct act_prob action_prob_vs_extras_full ( const struct civ_map nmap,
const struct unit actor_unit,
const struct city actor_home,
const struct tile actor_tile,
const action_id  act_id,
const struct tile target_tile,
const struct extra_type target_extra 
)
static

Get the actor unit's probability of successfully performing the chosen action on the extras at the target tile.

Definition at line 4629 of file actions.c.

Referenced by action_prob_vs_extras(), and action_speculate_unit_on_extras().

◆ action_prob_vs_stack()

struct act_prob action_prob_vs_stack ( const struct civ_map nmap,
const struct unit actor_unit,
const action_id  act_id,
const struct tile target_tile 
)

Get the actor unit's probability of successfully performing the chosen action on all units at the target tile.

Definition at line 4529 of file actions.c.

Referenced by action_auto_perf_unit_prob(), action_prob_unit_vs_tgt(), action_tgt_tile(), do_disband_alternative(), execute_orders(), handle_unit_get_actions(), and random_movements().

◆ action_prob_vs_stack_full()

static struct act_prob action_prob_vs_stack_full ( const struct civ_map nmap,
const struct unit actor_unit,
const struct city actor_home,
const struct tile actor_tile,
const action_id  act_id,
const struct tile target_tile 
)
static

Get the actor unit's probability of successfully performing the chosen action on all units at the target tile.

Definition at line 4354 of file actions.c.

Referenced by action_prob_vs_stack(), and action_speculate_unit_on_stack().

◆ action_prob_vs_tile()

struct act_prob action_prob_vs_tile ( const struct civ_map nmap,
const struct unit actor_unit,
const action_id  act_id,
const struct tile target_tile,
const struct extra_type target_extra 
)

◆ action_prob_vs_tile_full()

static struct act_prob action_prob_vs_tile_full ( const struct civ_map nmap,
const struct unit actor_unit,
const struct city actor_home,
const struct tile actor_tile,
const action_id  act_id,
const struct tile target_tile,
const struct extra_type target_extra 
)
static

Get the actor unit's probability of successfully performing the chosen action on the target tile.

Definition at line 4546 of file actions.c.

Referenced by action_prob_vs_tile(), and action_speculate_unit_on_tile().

◆ action_prob_vs_unit()

struct act_prob action_prob_vs_unit ( const struct civ_map nmap,
const struct unit actor_unit,
const action_id  act_id,
const struct unit target_unit 
)

Get the actor unit's probability of successfully performing the chosen action on the target unit.

Definition at line 4337 of file actions.c.

Referenced by action_auto_perf_unit_prob(), action_prob_unit_vs_tgt(), can_unit_deboard_or_be_unloaded(), dai_diplomat_bribe_nearby(), do_disband_alternative(), execute_orders(), handle_unit_get_actions(), may_unit_act_vs_unit(), and request_unit_load().

◆ action_prob_vs_unit_full()

static struct act_prob action_prob_vs_unit_full ( const struct civ_map nmap,
const struct unit actor_unit,
const struct city actor_home,
const struct tile actor_tile,
const action_id  act_id,
const struct unit target_unit 
)
static

Get the actor unit's probability of successfully performing the chosen action on the target unit.

Definition at line 4270 of file actions.c.

Referenced by action_prob_vs_unit(), and action_speculate_unit_on_unit().

◆ action_requires_details()

bool action_requires_details ( const struct action paction)

Returns TRUE iff the specified action REQUIRES the player to provide details in addition to actor and target. Returns FALSE if the action doesn't support any additional details or if they can be set by Freeciv it self.

Definition at line 1145 of file actions.c.

◆ action_rule_name()

const char * action_rule_name ( const struct action action)

◆ action_speculate_unit_on_city()

struct act_prob action_speculate_unit_on_city ( const struct civ_map nmap,
const action_id  act_id,
const struct unit actor,
const struct city actor_home,
const struct tile actor_tile,
const bool  omniscient_cheat,
const struct city target 
)

Returns a speculation about the actor unit's probability of successfully performing the chosen action on the target city given the specified game state changes.

Definition at line 4844 of file actions.c.

Referenced by auto_workers_speculate_can_act_at(), and get_discounted_reward().

◆ action_speculate_unit_on_extras()

struct act_prob action_speculate_unit_on_extras ( const struct civ_map nmap,
action_id  act_id,
const struct unit actor,
const struct city actor_home,
const struct tile actor_tile,
bool  omniscient_cheat,
const struct tile target_tile,
const struct extra_type target_extra 
)

Returns a speculation about the actor unit's probability of successfully performing the chosen action to the extras at the target tile (and, if specified, specific extra) given the specified game state changes.

Definition at line 4979 of file actions.c.

Referenced by auto_workers_speculate_can_act_at().

◆ action_speculate_unit_on_self()

struct act_prob action_speculate_unit_on_self ( const struct civ_map nmap,
action_id  act_id,
const struct unit actor,
const struct city actor_home,
const struct tile actor_tile,
bool  omniscient_cheat 
)

Returns a speculation about the actor unit's probability of successfully performing the chosen action on itself given the specified game state changes.

Definition at line 5013 of file actions.c.

Referenced by auto_workers_speculate_can_act_at().

◆ action_speculate_unit_on_stack()

struct act_prob action_speculate_unit_on_stack ( const struct civ_map nmap,
action_id  act_id,
const struct unit actor,
const struct city actor_home,
const struct tile actor_tile,
bool  omniscient_cheat,
const struct tile target 
)

Returns a speculation about the actor unit's probability of successfully performing the chosen action on the target unit stack given the specified game state changes.

Definition at line 4912 of file actions.c.

Referenced by auto_workers_speculate_can_act_at().

◆ action_speculate_unit_on_tile()

struct act_prob action_speculate_unit_on_tile ( const struct civ_map nmap,
action_id  act_id,
const struct unit actor,
const struct city actor_home,
const struct tile actor_tile,
bool  omniscient_cheat,
const struct tile target_tile,
const struct extra_type target_extra 
)

Returns a speculation about the actor unit's probability of successfully performing the chosen action on the target tile (and, if specified, extra) given the specified game state changes.

Definition at line 4945 of file actions.c.

Referenced by auto_workers_speculate_can_act_at(), texai_tile_worker_task_select(), and worker_evaluate_improvements().

◆ action_speculate_unit_on_unit()

struct act_prob action_speculate_unit_on_unit ( const struct civ_map nmap,
action_id  act_id,
const struct unit actor,
const struct city actor_home,
const struct tile actor_tile,
bool  omniscient_cheat,
const struct unit target 
)

Returns a speculation about the actor unit's probability of successfully performing the chosen action on the target unit given the specified game state changes.

Definition at line 4879 of file actions.c.

◆ action_target_kind_help()

const char * action_target_kind_help ( enum action_target_kind  kind)

Return description of the action target kind suitable to use in the helptext.

Definition at line 7592 of file actions.c.

Referenced by helptext_government(), and helptext_unit().

◆ action_target_kind_ruleset_var_name()

const char * action_target_kind_ruleset_var_name ( int  act)

Return target kind ruleset variable name for the action or NULL if target kind can't be set in the ruleset.

TODO: make actions generic and put target_kind in a field of the action.

Definition at line 6834 of file actions.c.

Referenced by load_action_kind(), and save_action_kind().

◆ action_ui_name_default()

const char * action_ui_name_default ( int  act)

Return default ui_name for the action

Definition at line 6105 of file actions.c.

Referenced by load_action_ui_name_3_3(), load_ruleset_actions(), and save_actions_ruleset().

◆ action_ui_name_ruleset_var_name()

const char * action_ui_name_ruleset_var_name ( int  act)

Return ui_name ruleset variable name for the action.

TODO: make actions generic and put ui_name in a field of the action.

Definition at line 5807 of file actions.c.

Referenced by load_ruleset_actions().

◆ action_univs_not_blocking()

bool action_univs_not_blocking ( const struct action paction,
struct universal actor_uni,
struct universal target_uni 
)

Is there any action enablers of the given type not blocked by universals?

Definition at line 5746 of file actions.c.

◆ action_would_be_blocked_by()

bool action_would_be_blocked_by ( const struct action blocked,
const struct action blocker 
)

Returns TRUE iff blocked will be illegal if blocker is legal.

Definition at line 1196 of file actions.c.

Referenced by action_is_blocked_by(), autoadjust_ruleset_data(), and helptext_unit().

◆ actions_are_ready()

bool actions_are_ready ( void  )

Returns TRUE iff the actions are initialized.

Doesn't care about action enablers.

Definition at line 942 of file actions.c.

Referenced by action_prepare_ui_name(), and go_act_menu::update().

◆ actions_free()

void actions_free ( void  )

Free the actions and the action enablers.

Definition at line 900 of file actions.c.

Referenced by game_ruleset_free().

◆ actions_init()

void actions_init ( void  )

Initialize the actions and the action enablers.

Definition at line 841 of file actions.c.

Referenced by game_ruleset_init().

◆ actions_rs_pre_san_gen()

void actions_rs_pre_san_gen ( void  )

Generate action related data based on the currently loaded ruleset. Done before ruleset sanity checking and ruleset compatibility post processing.

Definition at line 890 of file actions.c.

Referenced by handle_rulesets_ready(), and load_rulesetdir().

◆ ae_suggest_repair_if_no_oblig()

static struct req_vec_problem * ae_suggest_repair_if_no_oblig ( const struct action_enabler enabler,
const struct obligatory_req_vector oblig 
)
static

Returns a suggestion to add an obligatory hard requirement to an action enabler or NULL if no hard obligatory reqs were missing. It is the responsibility of the caller to free the suggestion when it is done with it.

Parameters
enablerthe action enabler to suggest a fix for.
oblighard obligatory requirements to check
Returns
a problem with fix suggestions or NULL if no obligatory hard requirement problems were detected.

Definition at line 1579 of file actions.c.

Referenced by action_enabler_suggest_repair_oblig().

◆ ap_dipl_battle_win()

static struct act_prob ap_dipl_battle_win ( const struct unit pattacker,
const struct unit pdefender 
)
static

The action probability that pattacker will win a diplomatic battle.

It is assumed that pattacker and pdefender have different owners and that the defender can defend in a diplomatic battle.

See diplomat_success_vs_defender() in server/diplomats.c

Definition at line 3626 of file actions.c.

Referenced by ap_diplomat_battle().

◆ ap_diplomat_battle()

static struct act_prob ap_diplomat_battle ( const struct unit pattacker,
const struct unit pvictim,
const struct tile tgt_tile,
const struct action paction 
)
static

The action probability that pattacker will win a diplomatic battle.

See diplomat_infiltrate_tile() in server/diplomats.c

Definition at line 3703 of file actions.c.

Referenced by action_prob(), and action_prob_battle_then_dice_roll().

◆ are_action_probabilitys_equal()

bool are_action_probabilitys_equal ( const struct act_prob ap1,
const struct act_prob ap2 
)

Returns TRUE iff ap1 and ap2 are equal.

Definition at line 5142 of file actions.c.

Referenced by action_prob_and(), action_prob_fall_back(), and send_packet_unit_actions_100().

◆ blocked_find_target_city()

static const struct city * blocked_find_target_city ( const struct action act,
const struct unit actor_unit,
const struct tile target_tile,
const struct city target_city_arg,
const struct unit target_unit 
)
static

Returns the target city for actions that may block the specified action. This is needed because some actions can be blocked by an action with a different target kind. The target city argument could therefore be missing.

Example: The ATK_SELF action ACTION_DISBAND_UNIT can be blocked by the ATK_CITY action ACTION_DISBAND_UNIT_RECOVER.

Definition at line 2227 of file actions.c.

Referenced by action_is_blocked_by().

◆ blocked_find_target_tile()

static const struct tile * blocked_find_target_tile ( const struct action act,
const struct unit actor_unit,
const struct tile target_tile_arg,
const struct city target_city,
const struct unit target_unit 
)
static

Returns the target tile for actions that may block the specified action. This is needed because some actions can be blocked by an action with a different target kind. The target tile could therefore be missing.

Example: The ATK_SELF action ACTION_DISBAND_UNIT can be blocked by the ATK_CITY action ACTION_DISBAND_UNIT_RECOVER.

Definition at line 2167 of file actions.c.

Referenced by action_is_blocked_by().

◆ enabler_first_clarification()

static struct req_vec_problem * enabler_first_clarification ( const struct action_enabler enabler)
static

Returns the first action enabler specific clarification possibility in the specified enabler or NULL if no enabler specific contradiction is found.

Parameters
enablerthe enabler to look at
Returns
the first problem and maybe a suggested fix

Definition at line 1970 of file actions.c.

Referenced by action_enabler_suggest_improvement().

◆ enabler_first_self_contradiction()

static struct req_vec_problem * enabler_first_self_contradiction ( const struct action_enabler enabler)
static

Returns the first action enabler specific contradiction in the specified enabler or NULL if no enabler specific contradiction is found.

Parameters
enablerthe enabler to look at
Returns
the first problem and maybe a suggested fix

Definition at line 1850 of file actions.c.

Referenced by action_enabler_suggest_repair().

◆ enabler_tile_tgt_local_diplrel_implies_claimed()

static struct req_vec_problem * enabler_tile_tgt_local_diplrel_implies_claimed ( const struct action_enabler enabler)
static

Detects a local DiplRel requirement in a tile targeted action without an explicit claimed requirement in the target reqs.

Parameters
enablerthe enabler to look at
Returns
the problem or NULL if no problem was found

Definition at line 1777 of file actions.c.

Referenced by action_enabler_suggest_repair().

◆ FC_STATIC_ASSERT()

FC_STATIC_ASSERT ( MAP_DISTANCE_MAX<=  ACTION_DISTANCE_LAST_NON_SIGNAL,
action_range_can_not_cover_the_whole_map   
)

◆ gen_action_name_update_cb()

const char * gen_action_name_update_cb ( const char old_name)

Specenum callback to update old enum names to current ones.

Definition at line 7558 of file actions.c.

◆ hard_code_actions()

static void hard_code_actions ( void  )
static

Hard code the actions.

Definition at line 107 of file actions.c.

Referenced by actions_init().

◆ is_action_enabled()

static bool is_action_enabled ( const struct civ_map nmap,
const action_id  wanted_action,
const struct req_context actor,
const struct req_context target,
const struct extra_type target_extra,
const struct city actor_home 
)
static

Returns TRUE if the wanted action is enabled.

Note that the action may disable it self because of hard requirements even if an action enabler returns TRUE.

Passing NULL for actor or target is equivalent to passing an empty context. This may or may not be legal depending on the action.

Definition at line 2987 of file actions.c.

Referenced by is_action_enabled_player(), is_action_enabled_unit_on_city_full(), is_action_enabled_unit_on_extras_full(), is_action_enabled_unit_on_self_full(), is_action_enabled_unit_on_stack_full(), is_action_enabled_unit_on_tile_full(), and is_action_enabled_unit_on_unit_full().

◆ is_action_enabled_player()

bool is_action_enabled_player ( const struct civ_map nmap,
const action_id  wanted_action,
const struct player actor_plr 
)

Returns TRUE if actor_plr can do wanted_action as far as action enablers are concerned.

Definition at line 3494 of file actions.c.

Referenced by civil_war_possible().

◆ is_action_enabled_unit_on_city()

bool is_action_enabled_unit_on_city ( const struct civ_map nmap,
const action_id  wanted_action,
const struct unit actor_unit,
const struct city target_city 
)

◆ is_action_enabled_unit_on_city_full()

static bool is_action_enabled_unit_on_city_full ( const struct civ_map nmap,
const action_id  wanted_action,
const struct unit actor_unit,
const struct city actor_home,
const struct tile actor_tile,
const struct city target_city 
)
static

Returns TRUE if actor_unit can do wanted_action to target_city as far as action enablers are concerned.

See note in is_action_enabled() for why the action may still be disabled.

Definition at line 3026 of file actions.c.

Referenced by action_speculate_unit_on_city(), and is_action_enabled_unit_on_city().

◆ is_action_enabled_unit_on_extras()

bool is_action_enabled_unit_on_extras ( const struct civ_map nmap,
const action_id  wanted_action,
const struct unit actor_unit,
const struct tile target_tile,
const struct extra_type target_extra 
)

Returns TRUE if actor_unit can do wanted_action to the extras at target_tile as far as action enablers are concerned.

See note in is_action_enabled() for why the action may still be disabled.

Definition at line 3409 of file actions.c.

Referenced by action_auto_perf_unit_do(), action_auto_perf_unit_prob(), action_is_blocked_by(), api_edit_perform_action_unit_vs_tile(), api_edit_perform_action_unit_vs_tile_extra(), and dai_unit_attack().

◆ is_action_enabled_unit_on_extras_full()

static bool is_action_enabled_unit_on_extras_full ( const struct civ_map nmap,
const action_id  wanted_action,
const struct unit actor_unit,
const struct city actor_home,
const struct tile actor_tile,
const struct tile target_tile,
const struct extra_type target_extra 
)
static

Returns TRUE if actor_unit can do wanted_action to the extras at target_tile as far as action enablers are concerned.

See note in is_action_enabled() for why the action may still be disabled.

Definition at line 3351 of file actions.c.

Referenced by action_speculate_unit_on_extras(), and is_action_enabled_unit_on_extras().

◆ is_action_enabled_unit_on_self()

bool is_action_enabled_unit_on_self ( const struct civ_map nmap,
const action_id  wanted_action,
const struct unit actor_unit 
)

Returns TRUE if actor_unit can do wanted_action to itself as far as action enablers are concerned.

See note in is_action_enabled() for why the action still may be disabled.

Definition at line 3481 of file actions.c.

Referenced by action_auto_perf_unit_do(), action_auto_perf_unit_prob(), action_is_blocked_by(), api_edit_perform_action_unit_vs_self(), can_unit_do_activity_targeted_at(), kill_unit(), maybe_become_veteran_real(), and unit_do_disband_trad().

◆ is_action_enabled_unit_on_self_full()

static bool is_action_enabled_unit_on_self_full ( const struct civ_map nmap,
const action_id  wanted_action,
const struct unit actor_unit,
const struct city actor_home,
const struct tile actor_tile 
)
static

Returns TRUE if actor_unit can do wanted_action to itself as far as action enablers are concerned.

See note in is_action_enabled() for why the action still may be disabled.

Definition at line 3429 of file actions.c.

Referenced by action_speculate_unit_on_self(), and is_action_enabled_unit_on_self().

◆ is_action_enabled_unit_on_stack()

bool is_action_enabled_unit_on_stack ( const struct civ_map nmap,
const action_id  wanted_action,
const struct unit actor_unit,
const struct tile target_tile 
)

Returns TRUE if actor_unit can do wanted_action to all units on the target_tile as far as action enablers are concerned.

See note in is_action_enabled() for why the action may still be disabled.

Definition at line 3256 of file actions.c.

Referenced by action_auto_perf_unit_do(), action_auto_perf_unit_prob(), action_is_blocked_by(), api_edit_perform_action_unit_vs_tile(), api_edit_perform_action_unit_vs_tile_extra(), dai_unit_attack(), and handle_unit_action_query().

◆ is_action_enabled_unit_on_stack_full()

static bool is_action_enabled_unit_on_stack_full ( const struct civ_map nmap,
const action_id  wanted_action,
const struct unit actor_unit,
const struct city actor_home,
const struct tile actor_tile,
const struct tile target_tile 
)
static

Returns TRUE if actor_unit can do wanted_action to all units on the target_tile as far as action enablers are concerned.

See note in is_action_enabled() for why the action may still be disabled.

Definition at line 3186 of file actions.c.

Referenced by action_speculate_unit_on_stack(), and is_action_enabled_unit_on_stack().

◆ is_action_enabled_unit_on_tile()

bool is_action_enabled_unit_on_tile ( const struct civ_map nmap,
const action_id  wanted_action,
const struct unit actor_unit,
const struct tile target_tile,
const struct extra_type target_extra 
)

Returns TRUE if actor_unit can do wanted_action to the target_tile as far as action enablers are concerned.

See note in is_action_enabled() for why the action may still be disabled.

Definition at line 3332 of file actions.c.

Referenced by action_auto_perf_unit_do(), action_auto_perf_unit_prob(), action_is_blocked_by(), adv_unit_move(), api_edit_perform_action_unit_vs_tile(), api_edit_perform_action_unit_vs_tile_extra(), can_unit_do_activity_targeted_at(), dai_manage_paratrooper(), dai_unit_attack(), dai_unit_move(), random_movements(), and unit_move_handling().

◆ is_action_enabled_unit_on_tile_full()

static bool is_action_enabled_unit_on_tile_full ( const struct civ_map nmap,
const action_id  wanted_action,
const struct unit actor_unit,
const struct city actor_home,
const struct tile actor_tile,
const struct tile target_tile,
const struct extra_type target_extra 
)
static

Returns TRUE if actor_unit can do wanted_action to the target_tile as far as action enablers are concerned.

See note in is_action_enabled() for why the action may still be disabled.

Definition at line 3274 of file actions.c.

Referenced by action_speculate_unit_on_tile(), and is_action_enabled_unit_on_tile().

◆ is_action_enabled_unit_on_unit()

bool is_action_enabled_unit_on_unit ( const struct civ_map nmap,
const action_id  wanted_action,
const struct unit actor_unit,
const struct unit target_unit 
)

Returns TRUE if actor_unit can do wanted_action to target_unit as far as action enablers are concerned.

See note in is_action_enabled() for why the action may still be disabled.

Definition at line 3168 of file actions.c.

Referenced by action_auto_perf_unit_do(), action_auto_perf_unit_prob(), action_is_blocked_by(), adv_unit_move(), api_edit_perform_action_unit_vs_unit(), can_unit_deboard_or_be_unloaded(), dai_diplomat_bribe_nearby(), dai_hunter_try_launch(), dai_unit_attack(), dai_unit_move(), handle_unit_action_query(), unit_move_handling(), and unleash_barbarians().

◆ is_action_enabled_unit_on_unit_full()

static bool is_action_enabled_unit_on_unit_full ( const struct civ_map nmap,
const action_id  wanted_action,
const struct unit actor_unit,
const struct city actor_home,
const struct tile actor_tile,
const struct unit target_unit 
)
static

Returns TRUE if actor_unit can do wanted_action to target_unit as far as action enablers are concerned.

See note in is_action_enabled() for why the action may still be disabled.

Definition at line 3109 of file actions.c.

Referenced by action_speculate_unit_on_unit(), and is_action_enabled_unit_on_unit().

◆ is_action_possible()

static enum fc_tristate is_action_possible ( const struct civ_map nmap,
const action_id  wanted_action,
const struct req_context actor,
const struct req_context target,
const struct extra_type target_extra,
const bool  omniscient,
const struct city homecity 
)
static

Returns if the wanted action is possible given that an action enabler later will enable it.

Can return maybe when not omniscient. Should always return yes or no when omniscient.

This is done by checking the action's hard requirements. Hard requirements must be fulfilled before an action can be done. The reason why is usually that code dealing with the action assumes that requirements are true. A requirement may also end up here if it can't be expressed in a requirement vector or if its absence makes the action pointless.

When adding a new hard requirement here: explain why it is a hard requirement in a comment. remember that this is called from action_prob(). Should information the player don't have access to be used in a test it must check if the evaluation can see the thing being tested.

Passing NULL for actor or target is equivalent to passing an empty context. This may or may not be legal depending on the action.

Definition at line 2814 of file actions.c.

Referenced by action_prob(), and is_action_enabled().

◆ is_action_possible_on_city()

bool is_action_possible_on_city ( action_id  act_id,
const struct player actor_player,
const struct city target_city 
)

Returns TRUE if the wanted action can be done to the target city.

Definition at line 5491 of file actions.c.

Referenced by adjust_improvement_wants_by_effects(), dai_choose_diplomat_offensive(), find_city_to_diplomat(), and impr_protects_vs_actions().

◆ is_effect_val_known()

static bool is_effect_val_known ( enum effect_type  effect_type,
const struct player pov_player,
const struct req_context context,
const struct req_context other_context 
)
static

Find out if the effect value is known

The knowledge of the actor is assumed to be given in the parameters.

If meta knowledge is missing TRI_MAYBE will be returned.

context and other_context may be NULL. This is equivalent to passing empty contexts.

Definition at line 3571 of file actions.c.

Referenced by action_prob_pre_action_dice_roll(), and ap_dipl_battle_win().

◆ is_enabler_active()

static bool is_enabler_active ( const struct action_enabler enabler,
const struct req_context actor,
const struct req_context target 
)
static

Return TRUE iff the action enabler is active

actor may be NULL. This is equivalent to passing an empty context. target may be NULL. This is equivalent to passing an empty context.

Definition at line 2970 of file actions.c.

Referenced by is_action_enabled().

◆ is_target_possible()

static bool is_target_possible ( const action_id  wanted_action,
const struct player actor_player,
const struct req_context target 
)
static

Returns TRUE if the wanted action can be done to the target.

target may be NULL. This is equivalent to passing an empty context.

Definition at line 5470 of file actions.c.

Referenced by is_action_possible_on_city().

◆ player_action_new()

static struct action * player_action_new ( action_id  id,
enum action_result  result 
)
static

Create a new action performed by a player actor.

Definition at line 1056 of file actions.c.

Referenced by hard_code_actions().

◆ req_vec_first_contradiction_in_vec()

static struct requirement * req_vec_first_contradiction_in_vec ( const struct requirement req,
const struct requirement_vector vec 
)
static

Returns the first requirement in the specified requirement vector that contradicts the specified requirement or NULL if no contradiction was detected.

Parameters
reqthe requirement that may contradict the vector
vecthe requirement vector to look in
Returns
the first local DiplRel requirement.

Definition at line 1754 of file actions.c.

Referenced by enabler_first_self_contradiction(), and enabler_tile_tgt_local_diplrel_implies_claimed().

◆ req_vec_first_local_diplrel()

static struct requirement * req_vec_first_local_diplrel ( const struct requirement_vector vec)
static

Returns the first local DiplRel requirement in the specified requirement vector or NULL if it doesn't have a local DiplRel requirement.

Parameters
vecthe requirement vector to look in
Returns
the first local DiplRel requirement.

Definition at line 1733 of file actions.c.

Referenced by enabler_first_self_contradiction(), and enabler_tile_tgt_local_diplrel_implies_claimed().

◆ tech_can_be_stolen()

static enum fc_tristate tech_can_be_stolen ( const struct player actor_player,
const struct player target_player 
)
static

Does the target has any techs the actor don't?

Definition at line 3590 of file actions.c.

Referenced by action_prob().

◆ tgt_city_local_building()

static const struct impr_type * tgt_city_local_building ( const struct city target_city)
static

Returns the local building type of a city target.

target_city can't be NULL

Definition at line 2119 of file actions.c.

Referenced by action_prob_vs_city_full(), and is_action_enabled_unit_on_city_full().

◆ tgt_city_local_utype()

static const struct unit_type * tgt_city_local_utype ( const struct city target_city)
static

Returns the local unit type of a city target.

target_city can't be NULL

Definition at line 2142 of file actions.c.

Referenced by action_prob_vs_city_full(), and is_action_enabled_unit_on_city_full().

◆ unit_action_new()

static struct action * unit_action_new ( action_id  id,
enum action_result  result,
bool  rare_pop_up,
bool  unitwaittime_controlled,
enum moves_actor_kind  moves_actor,
const int  min_distance,
const int  max_distance,
bool  actor_consuming_always 
)
static

Create a new action performed by a unit actor.

Definition at line 1030 of file actions.c.

Referenced by hard_code_actions().

Variable Documentation

◆ _actions

struct action** _actions = actions

Definition at line 58 of file actions.c.

Referenced by action_by_number().

◆ action_enablers_by_action

struct action_enabler_list* action_enablers_by_action[MAX_NUM_ACTIONS]
static

Definition at line 62 of file actions.c.

Referenced by action_enablers_for_action(), actions_free(), and actions_init().

◆ actions

struct action* actions[MAX_NUM_ACTIONS]
static

◆ actions_initialized

bool actions_initialized = FALSE
static

Definition at line 60 of file actions.c.

Referenced by actions_are_ready(), actions_free(), and actions_init().

◆ actlist_by_activity

struct action_list* actlist_by_activity[ACTIVITY_LAST]
static

Definition at line 101 of file actions.c.

Referenced by action_list_by_activity(), action_new(), actions_free(), and actions_init().

◆ actlist_by_result

struct action_list* actlist_by_result[ACTRES_LAST]
static

Definition at line 100 of file actions.c.

Referenced by action_list_by_result(), action_new(), actions_free(), and actions_init().

◆ atk_helpnames

const char* atk_helpnames[ATK_COUNT]
Initial value:
=
{
N_("individual cities"),
N_("individual units"),
N_("unit stacks"),
N_("tiles"),
N_("tile extras"),
}
#define N_(String)
Definition fcintl.h:69

Definition at line 7578 of file actions.c.

Referenced by action_target_kind_help().

◆ auto_perfs

Definition at line 59 of file actions.c.

Referenced by action_auto_perf_slot_number(), actions_free(), and actions_init().

◆ ui_name_str

struct astring ui_name_str = ASTRING_INIT
static

Definition at line 64 of file actions.c.

Referenced by action_prepare_ui_name(), and actions_free().