Freeciv-3.3: /fast/freeciv/nightly/main/common/actions.h File Reference

Freeciv-3.3

Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
actions.h File Reference
`#include "actres.h"`
`#include "fc_types.h"`
`#include "map_types.h"`
`#include "requirements.h"`
`#include "specenum_gen.h"`
`#include "actions_enums_gen.h"`
`#include "speclist.h"`

Go to the source code of this file.

## Data Structures

struct | action
struct | action_enabler
struct | action_auto_perf

## Macros

#define | ASSERT_UNUSED_ACTION_CASES \
#define | SPECENUM_NAME action_actor_kind
#define | SPECENUM_VALUE0 AAK_UNIT
#define | SPECENUM_VALUE0NAME N_("a unit")
#define | SPECENUM_COUNT AAK_COUNT
#define | ACTION_ANY ACTION_COUNT
#define | ACTION_NONE ACTION_COUNT
#define | MAX_NUM_ACTIONS ACTION_COUNT
#define | NUM_ACTIONS MAX_NUM_ACTIONS
#define | SPECENUM_NAME moves_actor_kind
#define | SPECENUM_VALUE0 MAK_STAYS
#define | SPECENUM_VALUE0NAME N_("stays")
#define | SPECENUM_VALUE1 MAK_REGULAR
#define | SPECENUM_VALUE1NAME N_("regular")
#define | SPECENUM_VALUE2 MAK_TELEPORT
#define | SPECENUM_VALUE2NAME N_("teleport")
#define | SPECENUM_VALUE3 MAK_ESCAPE
#define | SPECENUM_VALUE3NAME N_("escape")
#define | SPECENUM_VALUE4 MAK_FORCED
#define | SPECENUM_VALUE4NAME N_("forced")
#define | SPECENUM_VALUE5 MAK_UNREPRESENTABLE
#define | SPECENUM_VALUE5NAME N_("unrepresentable")
#define | SPECENUM_NAME action_requester
#define | SPECENUM_VALUE0 ACT_REQ_PLAYER
#define | SPECENUM_VALUE0NAME N_("the player")
#define | SPECENUM_VALUE1 ACT_REQ_RULES
#define | SPECENUM_VALUE1NAME N_("the game rules")
#define | SPECENUM_VALUE2 ACT_REQ_SS_AGENT
#define | SPECENUM_VALUE2NAME N_("a server agent")
#define | SPECENUM_COUNT ACT_REQ_COUNT
#define | ACTION_DISTANCE_LAST_NON_SIGNAL 128016
#define | ACTION_DISTANCE_UNLIMITED (ACTION_DISTANCE_LAST_NON_SIGNAL + 1)
#define | ACTION_DISTANCE_MAX ACTION_DISTANCE_UNLIMITED
#define | action_has_result(_act_, _res_) ((_act_)->result == (_res_))
#define | enabler_get_action(_enabler_) action_by_number(_enabler_->action)
#define | enabler_get_action_id(_enabler_) (_enabler_->action)
#define | SPECLIST_TAG action_enabler
#define | SPECLIST_TYPE struct action_enabler
#define | action_enabler_list_iterate(action_enabler_list, aenabler) TYPED_LIST_ITERATE(struct action_enabler, action_enabler_list, aenabler)
#define | action_enabler_list_iterate_end LIST_ITERATE_END
#define | action_enabler_list_re_iterate(action_enabler_list, aenabler)
#define | action_enabler_list_re_iterate_end
#define | action_iterate_all(_act_)
#define | action_iterate_all_end
#define | action_iterate(_act_)
#define | action_iterate_end
#define | SPECLIST_TAG action
#define | SPECLIST_TYPE struct action
#define | action_list_iterate(_list_, _act_) TYPED_LIST_ITERATE(struct action, _list_, _act_)
#define | action_list_iterate_end LIST_ITERATE_END
#define | action_noninternal_iterate(_act_)
#define | action_noninternal_iterate_end
#define | action_by_result_iterate(_paction_, _result_)
#define | action_by_result_iterate_end
#define | action_by_activity_iterate(_paction_, _activity_)
#define | action_by_activity_iterate_end
#define | action_array_iterate(_act_array_, _act_id_)
#define | action_array_iterate_end
#define | action_enablers_iterate(_enabler_)
#define | action_enablers_iterate_end
#define | SPECENUM_NAME action_auto_perf_cause
#define | SPECENUM_VALUE0 AAPC_UNIT_UPKEEP
#define | SPECENUM_VALUE0NAME "Unit Upkeep"
#define | SPECENUM_VALUE1 AAPC_UNIT_MOVED_ADJ
#define | SPECENUM_VALUE1NAME "Moved Adjacent"
#define | SPECENUM_VALUE2 AAPC_POST_ACTION
#define | SPECENUM_VALUE2NAME "After Successful Action"
#define | SPECENUM_VALUE3 AAPC_CITY_GONE
#define | SPECENUM_VALUE3NAME "City Gone"
#define | SPECENUM_VALUE4 AAPC_UNIT_STACK_DEATH
#define | SPECENUM_VALUE4NAME "Unit Stack Dead"
#define | SPECENUM_COUNT AAPC_COUNT
#define | action_auto_perf_iterate(_act_perf_)
#define | action_auto_perf_iterate_end
#define | action_auto_perf_by_cause_iterate(_cause_, _act_perf_)
#define | action_auto_perf_by_cause_iterate_end } action_auto_perf_iterate_end
#define | action_auto_perf_actions_iterate(_autoperf_, _act_id_) action_array_iterate(_autoperf_->alternatives, _act_id_)
#define | action_auto_perf_actions_iterate_end action_array_iterate_end
#define | ACTION_AUTO_UPKEEP_FOOD 0
#define | ACTION_AUTO_UPKEEP_GOLD 1
#define | ACTION_AUTO_UPKEEP_SHIELD 2
#define | ACTION_AUTO_MOVED_ADJ 3
#define | ACTION_AUTO_POST_BRIBE 4
#define | ACTION_AUTO_POST_ATTACK 5
#define | ACTION_AUTO_POST_ATTACK2 6
#define | ACTION_AUTO_POST_COLLECT_RANSOM 7
#define | ACTION_AUTO_ESCAPE_CITY 8
#define | ACTION_AUTO_ESCAPE_STACK 9
#define | ACTION_AUTO_POST_WIPE_UNITS 10
#define | action_id_get_actor_kind(act_id) action_get_actor_kind(action_by_number(act_id))
#define | action_id_get_target_kind(act_id) action_get_target_kind(action_by_number(act_id))
#define | action_id_get_sub_target_kind(act_id) action_get_sub_target_kind(action_by_number(act_id))
#define | action_id(_act_) (_act_->id)
#define | action_has_result_safe(paction, result) (paction && action_has_result(paction, result))
#define | action_id_has_result_safe(act_id, result)
#define | action_id_has_complex_target(act_id) action_has_complex_target(action_by_number(act_id))
#define | action_id_requires_details(act_id) action_requires_details(action_by_number(act_id))
#define | action_id_get_act_time(act_id, actor_unit, tgt_tile, tgt_extra)
#define | action_id_distance_accepted(act_id, distance) action_distance_accepted(action_by_number(act_id), distance)
#define | action_id_distance_inside_max(act_id, distance) action_distance_inside_max(action_by_number(act_id), distance)
#define | action_id_get_role(act_id) action_get_role(action_by_number(act_id))
#define | action_get_activity(_pact_) actres_activity_result(_pact_->result)
#define | action_id_get_activity(act_id) action_get_activity(action_by_number(act_id))
#define | ACTPROB_IMPOSSIBLE action_prob_new_impossible()
#define | ACTPROB_CERTAIN action_prob_new_certain()
#define | ACTPROB_NA action_prob_new_not_relevant()
#define | ACTPROB_NOT_IMPLEMENTED action_prob_new_not_impl()
#define | ACTPROB_NOT_KNOWN action_prob_new_unknown()
#define | ACTION_ODDS_PCT_DICE_ROLL_NA 110
#define | action_id_univs_not_blocking(act_id, act_uni, tgt_uni) action_univs_not_blocking(action_by_number(act_id), act_uni, tgt_uni)

## Functions

const char * | gen_action_name_update_cb (const char *old_name)
struct action_list * | action_list_by_result (enum action_result result)
struct action_list * | action_list_by_activity (enum unit_activity activity)
void | actions_init (void)
void | actions_rs_pre_san_gen (void)
void | actions_free (void)
bool | actions_are_ready (void)
bool | action_id_exists (const action_id act_id)
static struct action * | action_by_number (action_id act_id)
struct action * | action_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)
int | action_number (const struct action *action)
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_accepted (const struct action *action, const int distance)
bool | action_distance_inside_max (const struct action *action, const int distance)
bool | action_would_be_blocked_by (const struct action *blocked, const struct action *blocker)
int | action_get_role (const struct action *paction)
const char * | action_rule_name (const struct action *action)
const char * | action_id_rule_name (action_id act_id)
const char * | action_name_translation (const struct action *paction)
const char * | action_id_name_translation (action_id act_id)
const char * | action_get_ui_name_mnemonic (action_id act_id, const char *mnemonic)
const char * | action_prepare_ui_name (action_id act_id, const char *mnemonic, const struct act_prob prob, const char *custom)
const char * | action_ui_name_ruleset_var_name (int act)
const char * | action_ui_name_default (int act)
const char * | action_min_range_ruleset_var_name (int act)
const char * | action_max_range_ruleset_var_name (int act)
const char * | action_target_kind_ruleset_var_name (int act)
const char * | action_target_kind_help (enum action_target_kind kind)
const char * | action_actor_consuming_always_ruleset_var_name (action_id act)
const char * | action_blocked_by_ruleset_var_name (const struct action *act)
const char * | action_post_success_forced_ruleset_var_name (const struct action *act)
bool | action_ever_possible (action_id action)
struct action_enabler_list * | action_enablers_for_action (action_id action)
struct action_enabler * | action_enabler_new (void)
void | action_enabler_free (struct action_enabler *enabler)
struct action_enabler * | action_enabler_copy (const struct action_enabler *original)
void | action_enabler_add (struct action_enabler *enabler)
bool | action_enabler_remove (struct action_enabler *enabler)
struct req_vec_problem * | action_enabler_suggest_repair_oblig (const struct action_enabler *enabler)
struct req_vec_problem * | action_enabler_suggest_repair (const struct action_enabler *enabler)
struct req_vec_problem * | action_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_vector * | action_enabler_vector_by_number (const void *enabler, req_vec_num_in_item vec)
const char * | action_enabler_vector_by_number_name (req_vec_num_in_item vec)
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)
struct action * | action_is_blocked_by (const struct action *act, const struct unit *actor_unit, const struct tile *target_tile, const struct city *target_city, const struct unit *target_unit)
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)
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)
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)
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)
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, const struct extra_type *tgt_extra)
bool | is_action_enabled_unit_on_self (const action_id wanted_action, const struct unit *actor_unit)
struct act_prob | action_prob_vs_city (const struct unit *actor, const action_id act_id, const struct city *victim)
struct act_prob | action_prob_vs_unit (const struct unit *actor, const action_id act_id, const struct unit *victim)
struct act_prob | action_prob_vs_stack (const struct unit *actor, const action_id act_id, const struct tile *victims)
struct act_prob | action_prob_vs_tile (const struct unit *actor, const action_id act_id, const struct tile *victims, const struct extra_type *target_extra)
struct act_prob | action_prob_vs_extras (const struct unit *actor, const action_id act_id, const struct tile *target, const struct extra_type *tgt_extra)
struct act_prob | action_prob_self (const struct unit *actor, const action_id act_id)
struct act_prob | action_prob_unit_vs_tgt (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 *sub_tgt)
struct act_prob | action_speculate_unit_on_city (action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat, const struct city *target)
struct act_prob | action_speculate_unit_on_unit (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 (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 (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 (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 (action_id act_id, const struct unit *actor, const struct city *actor_home, const struct tile *actor_tile, bool omniscient_cheat)
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)
const char * | action_prob_explain (const struct act_prob prob)
struct act_prob | action_prob_new_impossible (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)
struct act_prob | action_prob_new_certain (void)
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_actor_utype_hard_reqs_ok (const struct action *result, const struct unit_type *actor_unittype)
bool | action_univs_not_blocking (const struct action *paction, struct universal *actor_uni, struct universal *target_uni)
bool | action_immune_government (struct government *gov, action_id act)
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 wanted_action, const struct unit *actor_unit)
bool | action_mp_full_makes_legal (const struct unit *actor, const action_id act_id)
bool | action_is_in_use (struct action *paction)
bool | action_is_internal (struct action *paction)
bool | action_id_is_internal (action_id act)
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 struct action_auto_perf * | action_auto_perf_by_number (const int num)
struct action_auto_perf * | action_auto_perf_slot_number (const int num)

## Variables

struct action ** | _actions

## Macro Definition Documentation

## ◆ ACTION_ANY

#define ACTION_ANY ACTION_COUNT

Definition at line 52 of file actions.h.

## ◆ action_array_iterate

#define action_array_iterate | ( |  | _act_array_,
|  |  | _act_id_
| ) |  |

Value:
{ \
int _pos_; \
\
for (_pos_ = 0; _pos_ < NUM_ACTIONS; _pos_++) { \
const action_id _act_id_ = _act_array_[_pos_]; \
\
if (_act_id_ == ACTION_NONE) { \
/* No more actions in this list. */ \
break; \
}
NUM_ACTIONS
#define NUM_ACTIONS
Definition actions.h:59
ACTION_NONE
#define ACTION_NONE
Definition actions.h:55
incite_cost
char * incite_cost
Definition comments.c:74
action_id
int action_id
Definition fc_types.h:393

Definition at line 252 of file actions.h.

## ◆ action_array_iterate_end

#define action_array_iterate_end

Value:
} \
}

Definition at line 264 of file actions.h.

## ◆ ACTION_AUTO_ESCAPE_CITY

#define ACTION_AUTO_ESCAPE_CITY 8

Definition at line 371 of file actions.h.

## ◆ ACTION_AUTO_ESCAPE_STACK

#define ACTION_AUTO_ESCAPE_STACK 9

Definition at line 372 of file actions.h.

## ◆ ACTION_AUTO_MOVED_ADJ

#define ACTION_AUTO_MOVED_ADJ 3

Definition at line 366 of file actions.h.

## ◆ action_auto_perf_actions_iterate

#define action_auto_perf_actions_iterate | ( |  | _autoperf_,
|  |  | _act_id_
| ) |  | action_array_iterate(_autoperf_->alternatives, _act_id_)

Definition at line 354 of file actions.h.

## ◆ action_auto_perf_actions_iterate_end

#define action_auto_perf_actions_iterate_end action_array_iterate_end

Definition at line 357 of file actions.h.

## ◆ action_auto_perf_by_cause_iterate

#define action_auto_perf_by_cause_iterate | ( |  | _cause_,
|  |  | _act_perf_
| ) |  |

Value:
action_auto_perf_iterate(_act_perf_) { \
if (_act_perf_->cause != _cause_) { \
continue; \
}
action_auto_perf_iterate
#define action_auto_perf_iterate(_act_perf_)
Definition actions.h:329

Definition at line 345 of file actions.h.

## ◆ action_auto_perf_by_cause_iterate_end

#define action_auto_perf_by_cause_iterate_end } action_auto_perf_iterate_end

Definition at line 351 of file actions.h.

## ◆ action_auto_perf_iterate

#define action_auto_perf_iterate | ( |  | _act_perf_ | ) |

Value:
{ \
int _ap_num_; \
\
for (_ap_num_ = 0; \
_ap_num_ < MAX_NUM_ACTION_AUTO_PERFORMERS \
&& (action_auto_perf_by_number(_ap_num_)->cause \
!= AAPC_COUNT); \
_ap_num_++) { \
const struct action_auto_perf *_act_perf_ \
= action_auto_perf_by_number(_ap_num_);
action_auto_perf_by_number
const struct action_auto_perf * action_auto_perf_by_number(const int num)
Definition actions.c:5674
MAX_NUM_ACTION_AUTO_PERFORMERS
#define MAX_NUM_ACTION_AUTO_PERFORMERS
Definition fc_types.h:54
action_auto_perf
Definition actions.h:316
action_auto_perf::cause
enum action_auto_perf_cause cause
Definition actions.h:318

Definition at line 329 of file actions.h.

## ◆ action_auto_perf_iterate_end

#define action_auto_perf_iterate_end

Value:
} \
}

Definition at line 341 of file actions.h.

## ◆ ACTION_AUTO_POST_ATTACK

#define ACTION_AUTO_POST_ATTACK 5

Definition at line 368 of file actions.h.

## ◆ ACTION_AUTO_POST_ATTACK2

#define ACTION_AUTO_POST_ATTACK2 6

Definition at line 369 of file actions.h.

## ◆ ACTION_AUTO_POST_BRIBE

#define ACTION_AUTO_POST_BRIBE 4

Definition at line 367 of file actions.h.

## ◆ ACTION_AUTO_POST_COLLECT_RANSOM

#define ACTION_AUTO_POST_COLLECT_RANSOM 7

Definition at line 370 of file actions.h.

## ◆ ACTION_AUTO_POST_WIPE_UNITS

#define ACTION_AUTO_POST_WIPE_UNITS 10

Definition at line 373 of file actions.h.

## ◆ ACTION_AUTO_UPKEEP_FOOD

#define ACTION_AUTO_UPKEEP_FOOD 0

Definition at line 363 of file actions.h.

## ◆ ACTION_AUTO_UPKEEP_GOLD

#define ACTION_AUTO_UPKEEP_GOLD 1

Definition at line 364 of file actions.h.

## ◆ ACTION_AUTO_UPKEEP_SHIELD

#define ACTION_AUTO_UPKEEP_SHIELD 2

Definition at line 365 of file actions.h.

## ◆ action_by_activity_iterate

#define action_by_activity_iterate | ( |  | _paction_,
|  |  | _activity_
| ) |  |

Value:
{ \
action_list_iterate(action_list_by_activity(_activity_), _paction_) {
action_list_by_activity
struct action_list * action_list_by_activity(enum unit_activity activity)
Definition actions.c:7505

Definition at line 244 of file actions.h.

## ◆ action_by_activity_iterate_end

#define action_by_activity_iterate_end

Value:
} action_list_iterate_end; \
}
action_list_iterate_end
#define action_list_iterate_end
Definition actions.h:220

Definition at line 248 of file actions.h.

## ◆ action_by_result_iterate

#define action_by_result_iterate | ( |  | _paction_,
|  |  | _result_
| ) |  |

Value:
{ \
action_list_iterate(action_list_by_result(_result_), _paction_) { \
action_list_by_result
struct action_list * action_list_by_result(enum action_result result)
Definition actions.c:7495

Definition at line 236 of file actions.h.

## ◆ action_by_result_iterate_end

#define action_by_result_iterate_end

Value:
} action_list_iterate_end; \
}

Definition at line 240 of file actions.h.

## ◆ ACTION_DISTANCE_LAST_NON_SIGNAL

#define ACTION_DISTANCE_LAST_NON_SIGNAL 128016

Definition at line 99 of file actions.h.

## ◆ ACTION_DISTANCE_MAX

#define ACTION_DISTANCE_MAX ACTION_DISTANCE_UNLIMITED

Definition at line 103 of file actions.h.

## ◆ ACTION_DISTANCE_UNLIMITED

#define ACTION_DISTANCE_UNLIMITED (ACTION_DISTANCE_LAST_NON_SIGNAL + 1)

Definition at line 101 of file actions.h.

## ◆ action_enabler_list_iterate

#define action_enabler_list_iterate | ( |  | action_enabler_list,
|  |  | aenabler
| ) |  | TYPED_LIST_ITERATE(struct action_enabler, action_enabler_list, aenabler)

Definition at line 183 of file actions.h.

## ◆ action_enabler_list_iterate_end

#define action_enabler_list_iterate_end LIST_ITERATE_END

Definition at line 185 of file actions.h.

## ◆ action_enabler_list_re_iterate

#define action_enabler_list_re_iterate | ( |  | action_enabler_list,
|  |  | aenabler
| ) |  |

Value:
action_enabler_list_iterate(action_enabler_list, aenabler) { \
if (!aenabler->ruledit_disabled) {
action_enabler_list_iterate
#define action_enabler_list_iterate(action_enabler_list, aenabler)
Definition actions.h:183

Definition at line 187 of file actions.h.

## ◆ action_enabler_list_re_iterate_end

#define action_enabler_list_re_iterate_end

Value:
} \
} action_enabler_list_iterate_end
action_enabler_list_iterate_end
#define action_enabler_list_iterate_end
Definition actions.h:185

Definition at line 191 of file actions.h.

## ◆ action_enablers_iterate

#define action_enablers_iterate | ( |  | _enabler_ | ) |

Value:
{ \
action_iterate(_act_) { \
action_enabler_list_iterate( \
action_enablers_for_action(_act_), _enabler_) {
action_enablers_for_action
struct action_enabler_list * action_enablers_for_action(action_id action)
Definition actions.c:1519

Definition at line 268 of file actions.h.

## ◆ action_enablers_iterate_end

#define action_enablers_iterate_end

Value:
} action_enabler_list_iterate_end; \
} action_iterate_end; \
}
action_iterate_end
#define action_iterate_end
Definition actions.h:209

Definition at line 274 of file actions.h.

## ◆ action_get_activity

#define action_get_activity | ( |  | _pact_ | ) | actres_activity_result(_pact_->result)

Definition at line 454 of file actions.h.

## ◆ action_has_result

#define action_has_result | ( |  | _act_,
|  |  | _res_
| ) |  | ((_act_)->result == (_res_))

Definition at line 175 of file actions.h.

## ◆ action_has_result_safe

#define action_has_result_safe | ( |  | paction,
|  |  | result
| ) |  | (paction && action_has_result(paction, result))

Definition at line 418 of file actions.h.

## ◆ action_id

#define action_id | ( |  | _act_ | ) | (_act_->id)

Definition at line 416 of file actions.h.

## ◆ action_id_distance_accepted

#define action_id_distance_accepted | ( |  | act_id,
|  |  | distance
| ) |  | action_distance_accepted(action_by_number(act_id), distance)

Definition at line 439 of file actions.h.

## ◆ action_id_distance_inside_max

#define action_id_distance_inside_max | ( |  | act_id,
|  |  | distance
| ) |  | action_distance_inside_max(action_by_number(act_id), distance)

Definition at line 444 of file actions.h.

## ◆ action_id_get_act_time

#define action_id_get_act_time | ( |  | act_id,
|  |  | actor_unit,
|  |  | tgt_tile,
|  |  | tgt_extra
| ) |  |

Value:
actres_get_act_time(action_by_number(act_id)->result, \
actor_unit, tgt_tile, tgt_extra)
action_by_number
static struct action * action_by_number(action_id act_id)
Definition actions.h:390
actres_get_act_time
int actres_get_act_time(enum action_result result, const struct unit *actor_unit, const struct tile *tgt_tile, const struct extra_type *tgt_extra)
Definition actres.c:316
actor_unit
struct unit * actor_unit
Definition dialogs_g.h:55

Definition at line 431 of file actions.h.

## ◆ action_id_get_activity

#define action_id_get_activity | ( |  | act_id | ) | action_get_activity(action_by_number(act_id))

Definition at line 456 of file actions.h.

## ◆ action_id_get_actor_kind

#define action_id_get_actor_kind | ( |  | act_id | ) | action_get_actor_kind(action_by_number(act_id))

Definition at line 403 of file actions.h.

## ◆ action_id_get_role

#define action_id_get_role | ( |  | act_id | ) | action_get_role(action_by_number(act_id))

Definition at line 451 of file actions.h.

## ◆ action_id_get_sub_target_kind

#define action_id_get_sub_target_kind | ( |  | act_id | ) | action_get_sub_target_kind(action_by_number(act_id))

Definition at line 411 of file actions.h.

## ◆ action_id_get_target_kind

#define action_id_get_target_kind | ( |  | act_id | ) | action_get_target_kind(action_by_number(act_id))

Definition at line 407 of file actions.h.

## ◆ action_id_has_complex_target

#define action_id_has_complex_target | ( |  | act_id | ) | action_has_complex_target(action_by_number(act_id))

Definition at line 425 of file actions.h.

## ◆ action_id_has_result_safe

#define action_id_has_result_safe | ( |  | act_id,
|  |  | result
| ) |  |

Value:
(action_by_number(act_id) \
&& action_has_result(action_by_number(act_id), result))
action_has_result
#define action_has_result(_act_, _res_)
Definition actions.h:175

Definition at line 420 of file actions.h.

## ◆ action_id_requires_details

#define action_id_requires_details | ( |  | act_id | ) | action_requires_details(action_by_number(act_id))

Definition at line 428 of file actions.h.

## ◆ action_id_univs_not_blocking

#define action_id_univs_not_blocking | ( |  | act_id,
|  |  | act_uni,
|  |  | tgt_uni
| ) |  | action_univs_not_blocking(action_by_number(act_id), act_uni, tgt_uni)

Definition at line 685 of file actions.h.

## ◆ action_iterate

#define action_iterate | ( |  | _act_ | ) |

Value:
{ \
action_iterate_all(_act_) {

Definition at line 205 of file actions.h.

## ◆ action_iterate_all

#define action_iterate_all | ( |  | _act_ | ) |

Value:
{ \
action_id _act_; \
for (_act_ = 0; _act_ < NUM_ACTIONS; _act_++) {

Definition at line 195 of file actions.h.

## ◆ action_iterate_all_end

#define action_iterate_all_end

Value:
} \
}

Definition at line 200 of file actions.h.

## ◆ action_iterate_end

#define action_iterate_end

Value:
} action_iterate_all_end; \
}
action_iterate_all_end
#define action_iterate_all_end
Definition actions.h:200

Definition at line 209 of file actions.h.

## ◆ action_list_iterate

#define action_list_iterate | ( |  | _list_,
|  |  | _act_
| ) |  | TYPED_LIST_ITERATE(struct action, _list_, _act_)

Definition at line 218 of file actions.h.

## ◆ action_list_iterate_end

#define action_list_iterate_end LIST_ITERATE_END

Definition at line 220 of file actions.h.

## ◆ ACTION_NONE

#define ACTION_NONE ACTION_COUNT

Definition at line 55 of file actions.h.

## ◆ action_noninternal_iterate

#define action_noninternal_iterate | ( |  | _act_ | ) |

Value:
{ \
action_iterate(_act_) { \
if (!action_id_is_internal(_act_)) {
action_id_is_internal
bool action_id_is_internal(action_id act)
Definition actions.c:5650

Definition at line 226 of file actions.h.

## ◆ action_noninternal_iterate_end

#define action_noninternal_iterate_end

Value:
} \
} action_iterate_end; \
}

Definition at line 231 of file actions.h.

## ◆ ACTION_ODDS_PCT_DICE_ROLL_NA

#define ACTION_ODDS_PCT_DICE_ROLL_NA 110

Definition at line 669 of file actions.h.

## ◆ ACTPROB_CERTAIN

#define ACTPROB_CERTAIN action_prob_new_certain()

Definition at line 663 of file actions.h.

## ◆ ACTPROB_IMPOSSIBLE

#define ACTPROB_IMPOSSIBLE action_prob_new_impossible()

Definition at line 662 of file actions.h.

## ◆ ACTPROB_NA

#define ACTPROB_NA action_prob_new_not_relevant()

Definition at line 664 of file actions.h.

## ◆ ACTPROB_NOT_IMPLEMENTED

#define ACTPROB_NOT_IMPLEMENTED action_prob_new_not_impl()

Definition at line 665 of file actions.h.

## ◆ ACTPROB_NOT_KNOWN

#define ACTPROB_NOT_KNOWN action_prob_new_unknown()

Definition at line 666 of file actions.h.

## ◆ ASSERT_UNUSED_ACTION_CASES

#define ASSERT_UNUSED_ACTION_CASES \

Definition at line 38 of file actions.h.

## ◆ enabler_get_action

#define enabler_get_action | ( |  | _enabler_ | ) | action_by_number(_enabler_->action)

Definition at line 177 of file actions.h.

## ◆ enabler_get_action_id

#define enabler_get_action_id | ( |  | _enabler_ | ) | (_enabler_->action)

Definition at line 178 of file actions.h.

## ◆ MAX_NUM_ACTIONS

#define MAX_NUM_ACTIONS ACTION_COUNT

Definition at line 58 of file actions.h.

## ◆ NUM_ACTIONS

#define NUM_ACTIONS MAX_NUM_ACTIONS

Definition at line 59 of file actions.h.

## ◆ SPECENUM_COUNT [1/3]

#define SPECENUM_COUNT AAK_COUNT

Definition at line 44 of file actions.h.

## ◆ SPECENUM_COUNT [2/3]

#define SPECENUM_COUNT ACT_REQ_COUNT

Definition at line 44 of file actions.h.

## ◆ SPECENUM_COUNT [3/3]

#define SPECENUM_COUNT AAPC_COUNT

Definition at line 44 of file actions.h.

## ◆ SPECENUM_NAME [1/4]

#define SPECENUM_NAME action_actor_kind

Definition at line 41 of file actions.h.

## ◆ SPECENUM_NAME [2/4]

#define SPECENUM_NAME moves_actor_kind

Definition at line 41 of file actions.h.

## ◆ SPECENUM_NAME [3/4]

#define SPECENUM_NAME action_requester

Definition at line 41 of file actions.h.

## ◆ SPECENUM_NAME [4/4]

#define SPECENUM_NAME action_auto_perf_cause

Definition at line 41 of file actions.h.

## ◆ SPECENUM_VALUE0 [1/4]

#define SPECENUM_VALUE0 AAK_UNIT

Definition at line 42 of file actions.h.

## ◆ SPECENUM_VALUE0 [2/4]

#define SPECENUM_VALUE0 MAK_STAYS

Definition at line 42 of file actions.h.

## ◆ SPECENUM_VALUE0 [3/4]

#define SPECENUM_VALUE0 ACT_REQ_PLAYER

Definition at line 42 of file actions.h.

## ◆ SPECENUM_VALUE0 [4/4]

#define SPECENUM_VALUE0 AAPC_UNIT_UPKEEP

Definition at line 42 of file actions.h.

## ◆ SPECENUM_VALUE0NAME [1/4]

#define SPECENUM_VALUE0NAME N_("a unit")

Definition at line 43 of file actions.h.

## ◆ SPECENUM_VALUE0NAME [2/4]

#define SPECENUM_VALUE0NAME N_("stays")

Definition at line 43 of file actions.h.

## ◆ SPECENUM_VALUE0NAME [3/4]

#define SPECENUM_VALUE0NAME N_("the player")

Definition at line 43 of file actions.h.

## ◆ SPECENUM_VALUE0NAME [4/4]

#define SPECENUM_VALUE0NAME "Unit Upkeep"

Definition at line 43 of file actions.h.

## ◆ SPECENUM_VALUE1 [1/3]

#define SPECENUM_VALUE1 MAK_REGULAR

Definition at line 65 of file actions.h.

## ◆ SPECENUM_VALUE1 [2/3]

#define SPECENUM_VALUE1 ACT_REQ_RULES

Definition at line 65 of file actions.h.

## ◆ SPECENUM_VALUE1 [3/3]

#define SPECENUM_VALUE1 AAPC_UNIT_MOVED_ADJ

Definition at line 65 of file actions.h.

## ◆ SPECENUM_VALUE1NAME [1/3]

#define SPECENUM_VALUE1NAME N_("regular")

Definition at line 66 of file actions.h.

## ◆ SPECENUM_VALUE1NAME [2/3]

#define SPECENUM_VALUE1NAME N_("the game rules")

Definition at line 66 of file actions.h.

## ◆ SPECENUM_VALUE1NAME [3/3]

#define SPECENUM_VALUE1NAME "Moved Adjacent"

Definition at line 66 of file actions.h.

## ◆ SPECENUM_VALUE2 [1/3]

#define SPECENUM_VALUE2 MAK_TELEPORT

Definition at line 67 of file actions.h.

## ◆ SPECENUM_VALUE2 [2/3]

#define SPECENUM_VALUE2 ACT_REQ_SS_AGENT

Definition at line 67 of file actions.h.

## ◆ SPECENUM_VALUE2 [3/3]

#define SPECENUM_VALUE2 AAPC_POST_ACTION

Definition at line 67 of file actions.h.

## ◆ SPECENUM_VALUE2NAME [1/3]

#define SPECENUM_VALUE2NAME N_("teleport")

Definition at line 68 of file actions.h.

## ◆ SPECENUM_VALUE2NAME [2/3]

#define SPECENUM_VALUE2NAME N_("a server agent")

Definition at line 68 of file actions.h.

## ◆ SPECENUM_VALUE2NAME [3/3]

#define SPECENUM_VALUE2NAME "After Successful Action"

Definition at line 68 of file actions.h.

## ◆ SPECENUM_VALUE3 [1/2]

#define SPECENUM_VALUE3 MAK_ESCAPE

Definition at line 69 of file actions.h.

## ◆ SPECENUM_VALUE3 [2/2]

#define SPECENUM_VALUE3 AAPC_CITY_GONE

Definition at line 69 of file actions.h.

## ◆ SPECENUM_VALUE3NAME [1/2]

#define SPECENUM_VALUE3NAME N_("escape")

Definition at line 70 of file actions.h.

## ◆ SPECENUM_VALUE3NAME [2/2]

#define SPECENUM_VALUE3NAME "City Gone"

Definition at line 70 of file actions.h.

## ◆ SPECENUM_VALUE4 [1/2]

#define SPECENUM_VALUE4 MAK_FORCED

Definition at line 71 of file actions.h.

## ◆ SPECENUM_VALUE4 [2/2]

#define SPECENUM_VALUE4 AAPC_UNIT_STACK_DEATH

Definition at line 71 of file actions.h.

## ◆ SPECENUM_VALUE4NAME [1/2]

#define SPECENUM_VALUE4NAME N_("forced")

Definition at line 72 of file actions.h.

## ◆ SPECENUM_VALUE4NAME [2/2]

#define SPECENUM_VALUE4NAME "Unit Stack Dead"

Definition at line 72 of file actions.h.

## ◆ SPECENUM_VALUE5

#define SPECENUM_VALUE5 MAK_UNREPRESENTABLE

Definition at line 73 of file actions.h.

## ◆ SPECENUM_VALUE5NAME

#define SPECENUM_VALUE5NAME N_("unrepresentable")

Definition at line 74 of file actions.h.

## ◆ SPECLIST_TAG [1/2]

#define SPECLIST_TAG action_enabler

Definition at line 180 of file actions.h.

## ◆ SPECLIST_TAG [2/2]

#define SPECLIST_TAG action

Definition at line 180 of file actions.h.

## ◆ SPECLIST_TYPE [1/2]

#define SPECLIST_TYPE struct action_enabler

Definition at line 181 of file actions.h.

## ◆ SPECLIST_TYPE [2/2]

#define SPECLIST_TYPE struct action

Definition at line 181 of file actions.h.

## Function Documentation

## ◆ 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 6919 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

  paction | the action to check the hard reqs for
  actor_unittype | the 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 2559 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_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_array | the array to add the actions to
  position | index in act_array that is updated as action are added
  result | all actions with this result are added.

Definition at line 5723 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_array | the array to end
  size | the number of elements to include in the list

Definition at line 5706 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 5674 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 5658 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 7089 of file actions.c.

Referenced by load_action_blocked_by_list(), and save_action_blocked_by().

## ◆ action_by_number()

static struct action * action_by_number | ( | action_id | act_id | ) |

inlinestatic

Return the action with the given id.

Returns NULL if no action with the given id exists.

Definition at line 390 of file actions.h.

Referenced by action_array_add_all_by_result(), action_by_rule_name(), action_entry(), action_entry(), action_entry(), action_entry_update(), action_entry_update(), action_id_is_internal(), action_immune_government(), action_is_blocked_by(), action_maybe_possible_actor_unit(), action_prob(), action_prob_vs_city_full(), action_prob_vs_stack_full(), action_selection_refresh(), action_target_neg_util(), adv_gov_action_immunity_want(), adv_unit_move(), api_find_action(), api_find_action_type_by_id(), api_methods_action_target_kind(), can_unit_do_activity_targeted_at(), city_gold_worth(), go_act_menu::create(), dai_choose_trade_route(), dai_diplomat_city(), dai_evaluate_tile_for_air_attack(), dai_manage_paratrooper(), dai_unit_move(), dai_upgrade_units(), do_unit_paradrop_to(), do_unit_teleport_to(), execute_orders(), expl_act_not_enabl(), find_something_to_kill(), get_caravan_enter_city_trade_bonus(), handle_city_sabotage_list(), handle_ruleset_action(), handle_unit_action_answer(), handle_unit_action_query(), handle_unit_type_upgrade(), helptext_building(), helptext_government(), helptext_unit(), illegal_action(), is_action_possible(), key_unit_action_select_tgt(), load_action_actor_consuming_always(), load_action_kind(), load_action_range(), load_action_range_max(), load_action_ui_name(), load_ruleset_actions(), need_war_player_hlp(), pf_danger_map_iterate(), pf_fuel_map_attack_is_possible(), pf_fuel_map_iterate(), pf_normal_map_iterate(), popup_action_selection(), real_menus_init(), real_menus_update(), request_action_details_callback(), rscompat_enablers_add_obligatory_hard_reqs(), ruleset_purge_redundant_reqs_enablers(), ruleset_purge_unused_enablers(), sanity_check_ruleset_data(), save_action_actor_consuming_always(), save_action_auto_actions(), save_action_blocked_by(), save_action_kind(), save_action_max_range(), save_action_range(), save_action_ui_name(), save_actions_ruleset(), save_bv_actions(), save_game_ruleset(), send_ruleset_actions(), simple_action_callback(), simple_action_callback(), single_invader(), texai_tile_worker_task_select(), unit_activity_targeted_internal(), unit_order_activity_to_action(), unit_order_list_is_sane(), unit_perform_action(), unit_upgrade_price(), universal_by_number(), universal_kind_values(), universal_value_initial(), update_unit_activity(), upgrade_unit_order_targets(), utype_act_takes_all_mp_cache_set(), utype_act_takes_all_mp_ustate_cache_set(), utype_can_create_extra(), utype_can_do_action_sub_result(), utype_can_remove_extra(), utype_may_do_escape_action(), and worker_evaluate_improvements().

## ◆ 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 1044 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 5310 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 5334 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 1149 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 1138 of file actions.c.

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

## ◆ action_enabler_add()

void action_enabler_add | ( | struct action_enabler * | enabler | ) |

Add an action enabler to the current ruleset.

Definition at line 1486 of file actions.c.

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

## ◆ 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 1471 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 1459 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 1440 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

  ae | the action enabler to check

Returns
  TRUE if the enabler may be enabled at all

Definition at line 5555 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 1503 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

  enabler | the enabler to improve

Returns
  a suggestion to improve the specified action enabler

Definition at line 1948 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 1882 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

  enabler | the 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 1643 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

  ae | the action enabler to check
  act_utype | the candidate actor unit type

Returns
  TRUE if the enabler may be active for act_utype

Definition at line 5528 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

  enabler | the action enabler that may own the vector.
  number | the item's requirement vector number.

Returns
  a pointer to the specified requirement vector.

Definition at line 2035 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

  vec | the requirement vector to name

Returns
  the requirement vector name or NULL.

Definition at line 2059 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

  enabler | the action enabler that may own the vector.
  vec | the requirement vector to number.

Returns
  the requirement vector number the vector has in this enabler.

Definition at line 2012 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 | ) |

Get all enablers for an action in the current ruleset.

Definition at line 1519 of file actions.c.

Referenced by action_enabled_local(), action_enabler_add(), action_enabler_remove(), action_ever_possible(), action_immune_government(), action_is_in_use(), action_may_happen_unit_on_city(), action_maybe_possible_actor_unit(), action_univs_not_blocking(), adjust_improvement_wants_by_effects(), city_production_caravan_shields_init(), does_nation_block_action(), does_terrain_block_action(), helptext_building(), helptext_unit(), is_action_enabled(), is_target_possible(), is_universal_needed(), tab_misc::refresh_stats(), rscompat_enablers_add_obligatory_hard_reqs(), ruleset_purge_redundant_reqs_enablers(), ruleset_purge_unused_enablers(), sanity_check_ruleset_data(), utype_may_act_move_frags(), and utype_may_act_tgt_city_tile().

## ◆ 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 7451 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 | ) |

Get the actor kind of an action.

Definition at line 1063 of file actions.c.

Referenced by action_enabler_possible_actor(), action_enabler_suggest_improvement(), action_enabler_utype_possible_actor(), action_get_role(), action_has_possible_actor_hard_reqs(), action_is_blocked_by(), api_edit_perform_action_unit_vs_city(), api_edit_perform_action_unit_vs_city_impr(), api_edit_perform_action_unit_vs_city_tech(), api_edit_perform_action_unit_vs_self(), api_edit_perform_action_unit_vs_tile(), api_edit_perform_action_unit_vs_tile_extra(), api_edit_perform_action_unit_vs_unit(), auto_workers_speculate_can_act_at(), dai_action_choose_sub_tgt_unit_vs_city(), dai_action_value_unit_vs_city(), dai_diplomat_city(), effect_list_sanity_cb(), local_dipl_rel_action_cache_set(), local_dipl_rel_tile_other_tgt_action_cache_set(), request_action_details_callback(), simple_action_callback(), simple_action_callback(), tgt_citytile_act_cache_set(), unit_can_act_cache_set(), unit_state_action_cache_set(), utype_is_moved_to_tgt_by_action(), utype_is_unmoved_by_action(), and utype_may_do_escape_action().

## ◆ 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 1428 of file actions.c.

## ◆ action_get_sub_target_kind()

enum action_sub_target_kind action_get_sub_target_kind | ( | const struct action * | paction | ) |

Get the sub target kind of an action.

Definition at line 1084 of file actions.c.

Referenced by action_sub_target_id_for_action(), go_act_menu::create(), execute_orders(), helptext_unit(), real_menus_init(), real_menus_update(), simple_action_callback(), simple_action_callback(), unit_goto_and_callback(), and unit_goto_and_callback().

## ◆ action_get_target_kind()

enum action_target_kind action_get_target_kind | ( | const struct action * | paction | ) |

Get the target kind of an action.

Definition at line 1073 of file actions.c.

Referenced by action_is_blocked_by(), action_prob_unit_vs_tgt(), action_target_neg_util(), api_edit_perform_action_unit_vs_city(), api_edit_perform_action_unit_vs_city_impr(), api_edit_perform_action_unit_vs_city_tech(), api_edit_perform_action_unit_vs_self(), api_edit_perform_action_unit_vs_tile(), api_edit_perform_action_unit_vs_tile_extra(), api_edit_perform_action_unit_vs_unit(), api_methods_action_target_kind(), auto_workers_speculate_can_act_at(), blocked_find_target_city(), blocked_find_target_tile(), dai_action_choose_sub_tgt_unit_vs_city(), dai_action_value_unit_vs_city(), dai_diplomat_city(), diplomat_infiltrate_tile(), effect_list_sanity_cb(), enabler_first_self_contradiction(), enabler_tile_tgt_local_diplrel_implies_claimed(), expl_act_not_enabl(), get_act_sel_action_custom_text(), helptext_unit(), is_action_possible(), local_dipl_rel_action_cache_set(), need_war_player_hlp(), notify_actor_caught(), notify_actor_success(), notify_victim_caught(), notify_victim_success(), request_action_details_callback(), sanity_check_ruleset_data(), simple_action_callback(), simple_action_callback(), texai_tile_worker_task_select(), and unit_perform_action().

## ◆ 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 1223 of file actions.c.

Referenced by real_menus_init(), and real_menus_update().

## ◆ 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 1097 of file actions.c.

## ◆ action_id_exists()

bool action_id_exists | ( | const action_id | act_id | ) |

Returns TRUE iff the specified action ID refers to a valid action.

Definition at line 1033 of file actions.c.

Referenced by action_by_rule_name(), action_enabler_add(), action_enabler_remove(), action_enabler_suggest_repair_oblig(), action_enablers_for_action(), action_id_is_rare_pop_up(), action_mp_full_makes_legal(), action_prepare_ui_name(), action_target_neg_util(), tab_enabler::add_now(), ae_suggest_repair_if_no_oblig(), do_map_click(), does_nation_block_action(), does_terrain_block_action(), execute_orders(), handle_ruleset_action(), handle_ruleset_action_enabler(), handle_unit_action_answer(), key_unit_action_select_tgt(), request_unit_goto(), send_goto_route(), sg_load_player_unit(), unit_order_list_is_sane(), unit_perform_action(), unpackage_unit(), and utype_may_act_move_frags().

## ◆ action_id_is_internal()

bool action_id_is_internal | ( | action_id | act | ) |

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

Parameters

  act | Id of the action to check

Returns
  Whether action is for internal use only

Definition at line 5650 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 1125 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 | ) |

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

Definition at line 1215 of file actions.c.

Referenced by action_name_translation(), api_methods_action_name_translation(), unit_item::create_actions(), create_unit_menu(), create_units_order_widgets(), execute_orders(), helptext_building(), helptext_government(), helptext_unit(), illegal_action(), illegal_action_msg(), mr_menu::menus_sensitive(), popup_newcity_dialog(), present_unit_callback(), qtg_request_action_confirmation(), real_menus_update(), request_action_confirmation(), request_unit_goto(), mr_menu::setup_menus(), sg_load_player_unit(), and units_orders_city_dlg_callback().

## ◆ action_id_rule_name()

const char * action_id_rule_name | ( | action_id | act_id | ) |

Get the rule name of the action.

Definition at line 1204 of file actions.c.

Referenced by action_prepare_ui_name(), action_prob_self_full(), action_prob_vs_city_full(), action_prob_vs_extras_full(), action_prob_vs_stack_full(), action_prob_vs_tile_full(), action_prob_vs_unit_full(), action_rule_name(), api_methods_action_rule_name(), handle_unit_orders(), 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(), is_action_enabled_unit_on_unit_full(), is_action_possible_on_city(), is_action_req_active(), menu_unit_goto_and_add_accel(), sanity_check_ruleset_data(), sg_save_savefile(), tab_enabler::tab_enabler(), and unit_order_list_is_sane().

## ◆ 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 5386 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 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 2239 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

  paction | the action to check if is in use.

Returns
  TRUE if the action could be enabled in the current ruleset.

Definition at line 5612 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_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

  paction | The action to check

Returns
  Whether action is for internal use only

Definition at line 5638 of file actions.c.

Referenced by action_id_is_internal(), and save_action_ui_name().

## ◆ action_list_by_activity()

struct action_list * action_list_by_activity | ( | enum unit_activity | activity | ) |

Returns action list by activity.

Definition at line 7505 of file actions.c.

## ◆ action_list_by_result()

struct action_list * action_list_by_result | ( | enum action_result | result | ) |

Returns action list by result.

Definition at line 7495 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 6567 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 5450 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 6392 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 5505 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 1195 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_number()

int action_number | ( | const struct action * | action | ) |

Get the universal number of the action.

Definition at line 1173 of file actions.c.

Referenced by action_blocked_by_ruleset_var_name(), action_post_success_forced_ruleset_var_name(), action_would_be_blocked_by(), adv_unit_move(), are_universals_equal(), dai_diplomat_city(), dai_unit_move(), is_action_req_active(), unit_order_activity_to_action(), and universal_number().

## ◆ 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 7279 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 1277 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_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 5172 of file actions.c.

Referenced by action_prob_battle_then_dice_roll().

## ◆ 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 5044 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 5094 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 1388 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 5242 of file actions.c.

Referenced by action_auto_perf_unit_prob().

## ◆ action_prob_new_certain()

struct act_prob action_prob_new_certain | ( | void |  | ) |

Returns the certain action probability.

Definition at line 4993 of file actions.c.

## ◆ action_prob_new_impossible()

struct act_prob action_prob_new_impossible | ( | void |  | ) |

Returns the impossible action probability.

Definition at line 4983 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 5013 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 5003 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 5023 of file actions.c.

## ◆ action_prob_possible()

bool action_prob_possible | ( | const struct act_prob | probability | ) |

Returns TRUE iff the given action probability belongs to an action that may be possible.

Definition at line 5034 of file actions.c.

Referenced by action_entry(), action_entry(), action_entry(), action_entry_update(), action_entry_update(), action_prob_vs_stack_full(), action_selection_refresh(), action_sub_target_id_for_action(), action_tgt_tile(), auto_attack_act(), auto_workers_speculate_can_act_at(), can_unit_change_homecity_to(), can_unit_deboard_or_be_unloaded(), create_advances_list(), create_improvements_list(), dai_diplomat_bribe_nearby(), dai_diplomat_city(), dai_manage_paratrooper(), do_disband_alternative(), do_unit_paradrop_to(), do_unit_teleport_to(), execute_orders(), get_act_sel_action_custom_text(), get_discounted_reward(), handle_city_name_suggestion_req(), handle_unit_actions(), handle_unit_get_actions(), illegal_action(), may_unit_act_vs_city(), may_unit_act_vs_tile_extra(), may_unit_act_vs_unit(), popup_action_selection(), popup_sabotage_dialog(), popup_sabotage_dialog(), random_movements(), request_unit_load(), spy_steal_popup_shared(), spy_steal_shared(), texai_tile_worker_task_select(), unit_can_add_or_build_city(), unit_can_airlift_to(), unit_can_help_build_wonder_here(), unit_survive_autoattack(), and worker_evaluate_improvements().

## ◆ action_prob_self()

struct act_prob action_prob_self | ( | 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 4708 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_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 5145 of file actions.c.

Referenced by unit_survive_autoattack().

## ◆ action_prob_unit_vs_tgt()

struct act_prob action_prob_unit_vs_tgt | ( | 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

  paction | the action to perform
  act_unit | the actor unit
  tgt_city | the target for city targeted actions
  tgt_unit | the target for unit targeted actions
  tgt_tile | the target for tile and unit stack targeted actions
  extra_tgt | the target for extra sub targeted actions

Returns
  the action probability of performing the action

Definition at line 4730 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 unit * | actor_unit,
|  | const action_id | act_id,
|  | const struct city * | target_city
| ) |  |

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

Definition at line 4192 of file actions.c.

Referenced by action_auto_perf_unit_prob(), action_prob_unit_vs_tgt(), can_unit_change_homecity_to(), dai_diplomat_city(), do_disband_alternative(), execute_orders(), handle_unit_get_actions(), may_unit_act_vs_city(), unit_can_add_or_build_city(), unit_can_airlift_to(), and unit_can_help_build_wonder_here().

## ◆ action_prob_vs_extras()

struct act_prob action_prob_vs_extras | ( | 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 4637 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_stack()

struct act_prob action_prob_vs_stack | ( | 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 4469 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_tile()

struct act_prob action_prob_vs_tile | ( | 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 target tile.

Definition at line 4553 of file actions.c.

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

## ◆ action_prob_vs_unit()

struct act_prob action_prob_vs_unit | ( | 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 4276 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_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 1110 of file actions.c.

## ◆ action_rule_name()

const char * action_rule_name | ( | const struct action * | action | ) |

Get the rule name of the action.

Definition at line 1181 of file actions.c.

Referenced by action_enabler_suggest_improvement(), action_get_role(), action_new(), ae_suggest_repair_if_no_oblig(), autoadjust_ruleset_data(), blocked_find_target_city(), blocked_find_target_tile(), dai_diplomat_city(), enabler_first_self_contradiction(), enabler_tile_tgt_local_diplrel_implies_claimed(), execute_orders(), fix_enabler_item::fix_enabler_item(), is_universal_needed(), tab_enabler::refresh(), rscompat_enabler_add_obligatory_hard_reqs(), ruleset_purge_redundant_reqs_enablers(), ruleset_purge_unused_enablers(), sanity_check_ruleset_data(), save_action_blocked_by(), save_actions_ruleset(), unit_can_act_cache_set(), universal_kind_values(), universal_rule_name(), tab_enabler::update_enabler_info(), utype_act_takes_all_mp_cache_set(), and utype_act_takes_all_mp_ustate_cache_set().

## ◆ action_speculate_unit_on_city()

struct act_prob action_speculate_unit_on_city | ( | 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 4786 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 | ( | 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 4921 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 | ( | 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 4955 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 | ( | 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 4854 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 | ( | 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 4887 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 | ( | 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 4821 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 7485 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 6750 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 6036 of file actions.c.

Referenced by load_action_ui_name(), and save_action_ui_name().

## ◆ 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 5743 of file actions.c.

Referenced by load_ruleset_actions(), and save_actions_ruleset().

## ◆ 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 5682 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 1161 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 921 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 879 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 820 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 869 of file actions.c.

Referenced by handle_rulesets_ready(), and load_rulesetdir().

## ◆ 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 5085 of file actions.c.

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

## ◆ 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 7459 of file actions.c.

## ◆ 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
| ) |  |

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 3044 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_city(), api_edit_perform_action_unit_vs_city_impr(), api_edit_perform_action_unit_vs_city_tech(), dai_caravan_goto(), dai_manage_caravan(), dai_unit_attack(), handle_unit_action_query(), handle_unit_type_upgrade(), unit_can_airlift_to(), and unit_do_disband_trad().

## ◆ 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 3362 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_self()

bool is_action_enabled_unit_on_self | ( | 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 3434 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_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 3209 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_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 3285 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_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 3121 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_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 5427 of file actions.c.

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

## Variable Documentation

## ◆ _actions

struct action** _actions

extern

Definition at line 58 of file actions.c.

Referenced by action_by_number().