|
Freeciv-3.1
|
#include <string.h>#include <math.h>#include "astring.h"#include "fcintl.h"#include "log.h"#include "mem.h"#include "shared.h"#include "string_vector.h"#include "support.h"#include "ai.h"#include "combat.h"#include "game.h"#include "government.h"#include "movement.h"#include "player.h"#include "research.h"#include "unitlist.h"#include "unittype.h"Go to the source code of this file.
Data Structures | |
| struct | range |
Macros | |
| #define | MAX_UNIT_ROLES L_LAST + ACTION_COUNT |
| #define | ACTION_HOSTILE ACTION_COUNT + 1 |
| #define | ACTION_AND_FAKES ACTION_HOSTILE + 1 |
| #define | requirement_unit_state_ereq(_id_, _present_) requirement_kind_ereq(_id_, REQ_RANGE_LOCAL, _present_, USP_COUNT) |
| #define | requirement_citytile_ereq(_id_, _present_) requirement_kind_ereq(_id_, REQ_RANGE_LOCAL, _present_, CITYT_LAST) |
| #define | MOVES_LEFT_INFINITY -1 |
Functions | |
| struct unit_type * | unit_type_array_first (void) |
| const struct unit_type * | unit_type_array_last (void) |
| Unit_type_id | utype_count (void) |
| Unit_type_id | utype_index (const struct unit_type *punittype) |
| Unit_type_id | utype_number (const struct unit_type *punittype) |
| struct unit_type * | utype_by_number (const Unit_type_id id) |
| const struct unit_type * | unit_type_get (const struct unit *punit) |
| int | utype_upkeep_cost (const struct unit_type *ut, struct player *pplayer, Output_type_id otype) |
| int | utype_happy_cost (const struct unit_type *ut, const struct player *pplayer) |
| bool | unit_has_type_flag (const struct unit *punit, enum unit_type_flag_id flag) |
| bool | utype_has_role (const struct unit_type *punittype, int role) |
| bool | unit_has_type_role (const struct unit *punit, enum unit_role_id role) |
| bool | utype_can_create_extra (const struct unit_type *putype, const struct extra_type *pextra) |
| bool | utype_can_remove_extra (const struct unit_type *putype, const struct extra_type *pextra) |
| bool | unit_can_take_over (const struct unit *punit) |
| bool | utype_can_take_over (const struct unit_type *punittype) |
| bool | utype_can_freely_load (const struct unit_type *pcargotype, const struct unit_type *ptranstype) |
| bool | utype_can_freely_unload (const struct unit_type *pcargotype, const struct unit_type *ptranstype) |
| static bool | action_is_hostile (action_id act_id) |
| static void | unit_can_act_cache_set (struct unit_type *putype) |
| bool | utype_may_act_at_all (const struct unit_type *putype) |
| bool | utype_can_do_action (const struct unit_type *putype, const action_id act_id) |
| bool | utype_can_do_action_result (const struct unit_type *putype, enum action_result result) |
| bool | utype_can_do_action_sub_result (const struct unit_type *putype, enum action_sub_result sub_result) |
| static bool | utype_can_do_action_role (const struct unit_type *putype, const int role) |
| bool | utype_acts_hostile (const struct unit_type *putype) |
| static void | utype_act_takes_all_mp_cache_set (struct unit_type *putype) |
| static void | utype_act_takes_all_mp_ustate_cache_set (struct unit_type *putype) |
| BV_DEFINE (bv_ustate_act_cache, USP_COUNT *2) | |
| BV_DEFINE (bv_citytile_cache, CITYT_LAST *2) | |
| static void | unit_state_action_cache_set (struct unit_type *putype) |
| static void | local_dipl_rel_action_cache_set (struct unit_type *putype) |
| static void | local_dipl_rel_tile_other_tgt_action_cache_set (struct unit_type *putype) |
| static void | tgt_citytile_act_cache_set (struct unit_type *putype) |
| static struct range * | moves_left_range (struct requirement_vector *reqs) |
| void | unit_type_action_cache_set (struct unit_type *ptype) |
| void | unit_type_action_cache_init (void) |
| bool | can_unit_act_when_ustate_is (const struct unit_type *punit_type, const enum ustate_prop prop, const bool is_there) |
| bool | utype_can_do_act_when_ustate (const struct unit_type *punit_type, const action_id act_id, const enum ustate_prop prop, const bool is_there) |
| bool | utype_can_do_action_result_when_ustate (const struct unit_type *putype, enum action_result result, const enum ustate_prop prop, const bool is_there) |
| bool | utype_can_do_act_if_tgt_citytile (const struct unit_type *punit_type, const action_id act_id, const enum citytile_type prop, const bool is_there) |
| bool | can_utype_do_act_if_tgt_diplrel (const struct unit_type *punit_type, const action_id act_id, const int prop, const bool is_there) |
| bool | utype_can_act_if_tgt_diplrel_tile_other (const struct unit_type *punit_type, const action_id act_id, const int prop, const bool is_there) |
| bool | utype_may_act_move_frags (const struct unit_type *punit_type, const action_id act_id, const int move_fragments) |
| bool | utype_may_act_tgt_city_tile (const struct unit_type *punit_type, const action_id act_id, const enum citytile_type prop, const bool is_there) |
| bool | utype_action_takes_all_mp (const struct unit_type *putype, struct action *paction) |
| bool | utype_action_takes_all_mp_if_ustate_is (const struct unit_type *putype, struct action *paction, const enum ustate_prop prop) |
| bool | utype_is_consumed_by_action (const struct action *paction, const struct unit_type *utype) |
| bool | utype_is_consumed_by_action_result (enum action_result result, const struct unit_type *utype) |
| bool | utype_is_moved_to_tgt_by_action (const struct action *paction, const struct unit_type *utype) |
| bool | utype_is_unmoved_by_action (const struct action *paction, const struct unit_type *utype) |
| bool | utype_pays_for_regular_move_to_tgt (const struct action *paction, const struct unit_type *utype) |
| int | utype_pays_mp_for_action_base (const struct action *paction, const struct unit_type *putype) |
| int | utype_pays_mp_for_action_estimate (const struct civ_map *nmap, const struct action *paction, const struct unit_type *putype, const struct player *act_player, const struct tile *act_tile, const struct tile *tgt_tile) |
| int | utype_build_shield_cost (const struct city *pcity, const struct player *pplayer, const struct unit_type *punittype) |
| int | utype_build_shield_cost_base (const struct unit_type *punittype) |
| int | unit_build_shield_cost (const struct city *pcity, const struct unit *punit) |
| int | unit_build_shield_cost_base (const struct unit *punit) |
| int | utype_buy_gold_cost (const struct city *pcity, const struct unit_type *punittype, int shields_in_stock) |
| int | utype_pop_value (const struct unit_type *punittype, const struct city *pcity) |
| int | unit_pop_value (const struct unit *punit) |
| enum unit_move_type | utype_move_type (const struct unit_type *punittype) |
| const char * | utype_name_translation (const struct unit_type *punittype) |
| const char * | unit_name_translation (const struct unit *punit) |
| const char * | utype_rule_name (const struct unit_type *punittype) |
| const char * | unit_rule_name (const struct unit *punit) |
| const char * | utype_values_string (const struct unit_type *punittype) |
| const char * | utype_values_translation (const struct unit_type *punittype) |
| const char * | uclass_name_translation (const struct unit_class *pclass) |
| const char * | uclass_rule_name (const struct unit_class *pclass) |
| bool | unit_has_class_flag (const struct unit *punit, enum unit_class_flag_id flag) |
| bool | utype_has_class_flag (const struct unit_type *ptype, enum unit_class_flag_id flag) |
| bool | role_units_translations (struct astring *astr, int flag, bool alts) |
| const struct unit_type * | can_upgrade_unittype (const struct player *pplayer, const struct unit_type *punittype) |
| int | unit_upgrade_price (const struct player *pplayer, const struct unit_type *from, const struct unit_type *to) |
| struct unit_type * | unit_type_by_translated_name (const char *name) |
| struct unit_type * | unit_type_by_rule_name (const char *name) |
| struct unit_class * | unit_class_by_rule_name (const char *s) |
| void | user_unit_class_flags_init (void) |
| void | set_user_unit_class_flag_name (enum unit_class_flag_id id, const char *name, const char *helptxt) |
| const char * | unit_class_flag_id_name_cb (enum unit_class_flag_id flag) |
| const char * | unit_class_flag_helptxt (enum unit_class_flag_id id) |
| void | user_unit_type_flags_init (void) |
| void | set_user_unit_type_flag_name (enum unit_type_flag_id id, const char *name, const char *helptxt) |
| const char * | unit_type_flag_id_name_cb (enum unit_type_flag_id flag) |
| const char * | unit_type_flag_helptxt (enum unit_type_flag_id id) |
| bool | utype_player_already_has_this_unique (const struct player *pplayer, const struct unit_type *putype) |
| bool | utype_player_already_has_this (const struct player *pplayer, const struct unit_type *putype) |
| bool | can_player_build_unit_direct (const struct player *p, const struct unit_type *punittype) |
| bool | can_player_build_unit_now (const struct player *p, const struct unit_type *punittype) |
| bool | can_player_build_unit_later (const struct player *p, const struct unit_type *punittype) |
| static void | precalc_one (int i, bool(*func_has)(const struct unit_type *, int)) |
| void | role_unit_precalcs_free (void) |
| void | role_unit_precalcs (void) |
| int | num_role_units (int role) |
| struct unit_type * | role_units_iterate (int role, role_unit_callback cb, void *data) |
| struct unit_type * | role_units_iterate_backwards (int role, role_unit_callback cb, void *data) |
| struct unit_type * | get_role_unit (int role, int role_index) |
| struct unit_type * | best_role_unit (const struct city *pcity, int role) |
| struct unit_type * | best_role_unit_for_player (const struct player *pplayer, int role) |
| struct unit_type * | first_role_unit_for_player (const struct player *pplayer, int role) |
| void | unit_types_init (void) |
| static void | unit_type_free (struct unit_type *punittype) |
| void | unit_types_free (void) |
| void | unit_type_flags_free (void) |
| void | unit_class_flags_free (void) |
| struct unit_class * | unit_class_array_first (void) |
| const struct unit_class * | unit_class_array_last (void) |
| Unit_Class_id | uclass_count (void) |
| Unit_Class_id | uclass_number (const struct unit_class *pclass) |
| struct unit_class * | uclass_by_number (const Unit_Class_id id) |
| struct unit_class * | unit_class_get (const struct unit *punit) |
| void | unit_classes_init (void) |
| void | unit_classes_free (void) |
| const struct veteran_system * | utype_veteran_system (const struct unit_type *punittype) |
| const struct veteran_level * | utype_veteran_level (const struct unit_type *punittype, int level) |
| const char * | utype_veteran_name_translation (const struct unit_type *punittype, int level) |
| int | utype_veteran_levels (const struct unit_type *punittype) |
| bool | utype_veteran_has_power_bonus (const struct unit_type *punittype) |
| struct veteran_system * | veteran_system_new (int count) |
| void | veteran_system_destroy (struct veteran_system *vsystem) |
| void | veteran_system_definition (struct veteran_system *vsystem, int level, const char *vlist_name, int vlist_power, int vlist_move, int vlist_raise, int vlist_wraise) |
| void * | utype_ai_data (const struct unit_type *ptype, const struct ai_type *ai) |
| void | utype_set_ai_data (struct unit_type *ptype, const struct ai_type *ai, void *data) |
| void | set_unit_class_caches (struct unit_class *pclass) |
| void | set_unit_type_caches (struct unit_type *ptype) |
| static enum unit_move_type | move_type_from_extra (struct extra_type *pextra, struct unit_class *puc) |
| void | set_unit_move_type (struct unit_class *puclass) |
| bool | utype_is_cityfounder (const struct unit_type *utype) |
| bool | uclass_flag_is_in_use (enum unit_class_flag_id ucflag) |
| bool | utype_flag_is_in_use (enum unit_type_flag_id uflag) |
Variables | |
| static struct unit_type | unit_types [U_LAST] |
| static struct unit_class | unit_classes [UCL_LAST] |
| static struct user_flag | user_type_flags [MAX_NUM_USER_UNIT_FLAGS] |
| static struct user_flag | user_class_flags [MAX_NUM_USER_UCLASS_FLAGS] |
| static bv_unit_types | unit_can_act_cache [ACTION_AND_FAKES] |
| static bv_unit_types | utype_act_takes_all_mp_cache [ACTION_COUNT] |
| static bv_unit_types | utype_act_takes_all_mp_ustate_cache [ACTION_COUNT][USP_COUNT] |
| static bv_ustate_act_cache | ustate_act_cache [U_LAST][ACTION_AND_FAKES] |
| static bv_diplrel_all_reqs | dipl_rel_action_cache [U_LAST][ACTION_AND_FAKES] |
| static bv_diplrel_all_reqs | dipl_rel_tile_other_tgt_a_cache [U_LAST][ACTION_AND_FAKES] |
| static bv_citytile_cache | ctile_tgt_act_cache [U_LAST][ACTION_AND_FAKES] |
| static bool | first_init = TRUE |
| static int | n_with_role [MAX_UNIT_ROLES] |
| static struct unit_type ** | with_role [MAX_UNIT_ROLES] |
| #define ACTION_AND_FAKES ACTION_HOSTILE + 1 |
Definition at line 386 of file unittype.c.
| #define ACTION_HOSTILE ACTION_COUNT + 1 |
Definition at line 383 of file unittype.c.
| #define MAX_UNIT_ROLES L_LAST + ACTION_COUNT |
Definition at line 42 of file unittype.c.
| #define MOVES_LEFT_INFINITY -1 |
Definition at line 936 of file unittype.c.
| #define requirement_citytile_ereq | ( | _id_, | |
| _present_ | |||
| ) | requirement_kind_ereq(_id_, REQ_RANGE_LOCAL, _present_, CITYT_LAST) |
Definition at line 633 of file unittype.c.
| #define requirement_unit_state_ereq | ( | _id_, | |
| _present_ | |||
| ) | requirement_kind_ereq(_id_, REQ_RANGE_LOCAL, _present_, USP_COUNT) |
Definition at line 631 of file unittype.c.
Returns TRUE iff the specified action is hostile.
Definition at line 304 of file unittype.c.
Referenced by local_dipl_rel_action_cache_set(), local_dipl_rel_tile_other_tgt_action_cache_set(), tgt_citytile_act_cache_set(), unit_can_act_cache_set(), and unit_state_action_cache_set().
Return "best" unit this city can build, with given role/flag. Returns NULL if none match. "Best" means highest unit type id.
Definition at line 2319 of file unittype.c.
Referenced by city_choose_build_default(), contemplate_new_city(), dai_choose_diplomat_defensive(), dai_choose_diplomat_offensive(), dai_choose_help_wonder(), dai_choose_trade_route(), dai_city_choose_build(), and domestic_advisor_choose_build().
Return "best" unit the player can build, with given role/flag. Returns NULL if none match. "Best" means highest unit type id.
TODO: Cache the result per player?
Definition at line 2345 of file unittype.c.
Referenced by api_find_role_unit_type(), calculate_city_clusters(), city_gold_worth(), dai_wonder_city_distance(), find_best_city_placement(), and find_something_to_kill().
| BV_DEFINE | ( | bv_citytile_cache | , |
| CITYT_LAST * | 2 | ||
| ) |
| BV_DEFINE | ( | bv_ustate_act_cache | , |
| USP_COUNT * | 2 | ||
| ) |
Whether player can build given unit somewhere, ignoring whether unit is obsolete and assuming the player has a coastal city.
Definition at line 2015 of file unittype.c.
Referenced by adv_data_phase_init(), api_methods_player_can_build_unit_direct(), can_city_build_unit_direct(), can_city_build_unit_now(), can_player_build_unit_later(), can_player_build_unit_now(), can_upgrade_unittype(), clipboard_copy_production(), and find_a_unit_type().
Whether player can eventually build given unit somewhere – ie, returns TRUE if unit is available with current tech OR will be available with future tech. Returns FALSE if unit is obsolete.
Definition at line 2150 of file unittype.c.
Referenced by can_city_build_unit_later(), collect_eventually_buildable_targets(), and popup_worklist_editor().
Whether player can build given unit somewhere; returns FALSE if unit is obsolete.
Definition at line 2131 of file unittype.c.
Referenced by best_role_unit_for_player(), collect_buildable_targets(), collect_eventually_buildable_targets(), first_role_unit_for_player(), popup_worklist_editor(), and mr_menu::update_airlift_menu().
| bool can_unit_act_when_ustate_is | ( | const struct unit_type * | punit_type, |
| const enum ustate_prop | prop, | ||
| const bool | is_there | ||
| ) |
Return TRUE iff there exists an (action enabler controlled) action that a unit of the type punit_type can perform while its unit state property prop has the value is_there.
Definition at line 995 of file unittype.c.
Referenced by pf_action_possible().
| const struct unit_type * can_upgrade_unittype | ( | const struct player * | pplayer, |
| const struct unit_type * | punittype | ||
| ) |
Return whether this player can upgrade this unit type (to any other unit type). Returns NULL if no upgrade is possible.
Definition at line 1755 of file unittype.c.
Referenced by api_edit_unit_upgrade(), api_methods_player_can_upgrade(), count_my_units(), create_unit_menu(), dai_upgrade_units(), do_unit_upgrade(), do_upgrade_effects(), expl_act_not_enabl(), get_units_upgrade_info(), handle_unit_action_query(), handle_unit_type_upgrade(), popup_upgrade_unit_callback(), present_unit_callback(), real_activeunits_report_dialog_update(), real_menus_update(), real_units_report_dialog_update(), unit_upgrade_info(), unit_upgrade_test(), units_orders_city_dlg_callback(), units_report_command_callback(), units_report_selection_callback(), units_report_update(), units_reports::update_units(), upgrade_canvas_clipboard(), and unittype_item::upgrade_units().
| bool can_utype_do_act_if_tgt_diplrel | ( | const struct unit_type * | punit_type, |
| const action_id | act_id, | ||
| const int | prop, | ||
| const bool | is_there | ||
| ) |
Return TRUE iff the given (action enabler controlled) action can be performed by a unit of the given type while the given property of its owner's diplomatic relationship to the target's owner has the given value.
Note: since this only supports the local range no information for other ranges are stored in dipl_rel_action_cache.
Definition at line 1069 of file unittype.c.
Referenced by city_can_be_built_here(), expl_act_not_enabl(), helptext_unit(), need_war_player_hlp(), and send_goto_route().
Return first unit the player can build, with given role/flag. Returns NULL if none match. Used eg when placing starting units.
Definition at line 2370 of file unittype.c.
Referenced by building_advisor(), and crole_to_unit_type().
| struct unit_type * get_role_unit | ( | int | role, |
| int | role_index | ||
| ) |
Return index-th unit with specified role/flag. Index -1 means (n-1), ie last one.
Definition at line 2301 of file unittype.c.
Referenced by adv_data_phase_init(), api_find_role_unit_type(), calculate_city_clusters(), crole_to_unit_type(), dai_barbarian_choose_build(), dai_choose_diplomat_defensive(), dai_choose_help_wonder(), dai_choose_trade_route(), dai_wants_role_unit(), find_a_unit_type(), find_best_city_placement(), find_something_to_kill(), get_tile_value(), helptext_building(), place_partisans(), role_units_translations(), rs_barbarian_units(), rs_common_units(), srv_ready(), startunits_callback(), and try_summon_barbarians().
|
static |
Cache what actions may be possible for a unit of the type putype for each local DiplRel variation. Since a diplomatic relationship could be ignored both present and !present must be checked.
Note: since can_unit_act_when_local_diplrel_is() only supports querying the local range no values for the other ranges are set.
Definition at line 716 of file unittype.c.
Referenced by unit_type_action_cache_set().
|
static |
Cache what actions may be possible for a unit of the type putype for each local DiplRelTileOther variation. Since a diplomatic relationship could be ignored both present and !present must be checked.
Definition at line 796 of file unittype.c.
Referenced by unit_type_action_cache_set().
|
static |
What move types nativity of this extra will give?
Definition at line 2859 of file unittype.c.
Referenced by set_unit_move_type().
|
static |
Get the legal range of move fragments left of the specified requirement vector.
Definition at line 942 of file unittype.c.
Referenced by utype_may_act_move_frags().
| int num_role_units | ( | int | role | ) |
How many unit types have specified role/flag.
Definition at line 2251 of file unittype.c.
Referenced by adv_data_phase_init(), api_edit_place_partisans(), api_find_role_unit_type(), autolock_settings(), building_advisor(), calculate_city_clusters(), crole_to_unit_type(), dai_barbarian_choose_build(), dai_choose_diplomat_defensive(), dai_choose_help_wonder(), dai_choose_trade_route(), dai_wants_role_unit(), find_a_unit_type(), get_tile_value(), helptext_building(), role_units_translations(), rs_barbarian_units(), rs_common_units(), and unleash_barbarians().
Do the real work for role_unit_precalcs, for one role (or flag), given by i.
Definition at line 2180 of file unittype.c.
Referenced by role_unit_precalcs().
| void role_unit_precalcs | ( | void | ) |
Initialize; it is safe to call this multiple times (e.g., if units have changed due to rulesets in client).
Definition at line 2223 of file unittype.c.
Referenced by load_rulesetdir(), and set_client_state().
| void role_unit_precalcs_free | ( | void | ) |
Free memory allocated by role_unit_precalcs().
Definition at line 2208 of file unittype.c.
Referenced by game_ruleset_free(), and role_unit_precalcs().
| struct unit_type * role_units_iterate | ( | int | role, |
| role_unit_callback | cb, | ||
| void * | data | ||
| ) |
Iterate over all the role units and feed them to callback. Once callback returns TRUE, no further units are feeded to it and we return the unit that caused callback to return TRUE
Definition at line 2265 of file unittype.c.
| struct unit_type * role_units_iterate_backwards | ( | int | role, |
| role_unit_callback | cb, | ||
| void * | data | ||
| ) |
Iterate over all the role units and feed them to callback, starting from the last one. Once callback returns TRUE, no further units are feeded to it and we return the unit that caused callback to return TRUE
Definition at line 2284 of file unittype.c.
Referenced by dai_role_utype_for_terrain_class().
Return a string with all the names of units with this flag. If "alts" is set, separate with "or", otherwise "and". Return FALSE if no unit with this flag exists.
Definition at line 1720 of file unittype.c.
Referenced by illegal_action_msg(), req_text_insert(), and request_unit_goto().
| void set_unit_class_caches | ( | struct unit_class * | pclass | ) |
Set caches for unit class.
Definition at line 2758 of file unittype.c.
Referenced by handle_rulesets_ready(), and load_rulesetdir().
| void set_unit_move_type | ( | struct unit_class * | puclass | ) |
Set move_type for unit class.
Definition at line 2926 of file unittype.c.
Referenced by handle_rulesets_ready().
| void set_unit_type_caches | ( | struct unit_type * | ptype | ) |
Set caches for unit types.
Definition at line 2817 of file unittype.c.
Referenced by handle_rulesets_ready(), and load_rulesetdir().
| void set_user_unit_class_flag_name | ( | enum unit_class_flag_id | id, |
| const char * | name, | ||
| const char * | helptxt | ||
| ) |
Sets user defined name for unit class flag.
Definition at line 1864 of file unittype.c.
Referenced by handle_ruleset_unit_class_flag(), load_unit_names(), and rscompat_names().
| void set_user_unit_type_flag_name | ( | enum unit_type_flag_id | id, |
| const char * | name, | ||
| const char * | helptxt | ||
| ) |
Sets user defined name for unit flag.
Definition at line 1928 of file unittype.c.
Referenced by handle_ruleset_unit_flag(), load_unit_names(), and rscompat_names().
|
static |
Cache if any action may be possible for a unit of the type putype for each target local city tile property. Both present and !present must be checked since a city tile property could be ignored.
Definition at line 868 of file unittype.c.
Referenced by unit_type_action_cache_set().
| struct unit_class * uclass_by_number | ( | const Unit_Class_id | id | ) |
Returns unit class pointer for an ID value.
Definition at line 2524 of file unittype.c.
Referenced by edit_extra::edit_extra(), edit_terrain::edit_terrain(), handle_ruleset_unit(), handle_ruleset_unit_class(), universal_by_number(), and universal_value_initial().
| Unit_Class_id uclass_count | ( | void | ) |
Return the unit_class count.
Definition at line 2493 of file unittype.c.
Referenced by helptext_extra(), helptext_terrain(), helptext_unit(), and req_text_insert().
| bool uclass_flag_is_in_use | ( | enum unit_class_flag_id | ucflag | ) |
Returns TRUE iff the specified unit class flag is in use by any unit class.
| ucflag | the unit class flag to check if is in use. |
Definition at line 2983 of file unittype.c.
Referenced by universal_never_there().
| const char * uclass_name_translation | ( | const struct unit_class * | pclass | ) |
Return the (translated) name of the unit class. You don't have to free the return pointer.
Definition at line 1684 of file unittype.c.
Referenced by can_unit_move_to_tile_with_notify(), helptext_extra(), helptext_government(), helptext_terrain(), helptext_unit(), req_text_insert(), and universal_name_translation().
| Unit_Class_id uclass_number | ( | const struct unit_class * | pclass | ) |
Return the unit_class index.
Definition at line 2515 of file unittype.c.
Referenced by pf_pos_hash_val(), send_ruleset_unit_classes(), send_ruleset_units(), and universal_number().
| const char * uclass_rule_name | ( | const struct unit_class * | pclass | ) |
Return the (untranslated) rule name of the unit class. You don't have to free the return pointer.
Definition at line 1693 of file unittype.c.
Referenced by edit_extra::edit_extra(), edit_terrain::edit_terrain(), edit_utype::edit_utype(), load_ruleset_units(), edit_utype::refresh(), rscompat_postprocess(), sanity_check_ruleset_data(), save_terrain_ruleset(), save_uclass_vec(), save_units_ruleset(), unit_class_by_rule_name(), universal_kind_values(), and universal_rule_name().
Returns the number of shields it takes to build this unit.
Definition at line 1528 of file unittype.c.
Referenced by city_gold_worth(), city_incite_cost(), and get_discounted_reward().
| int unit_build_shield_cost_base | ( | const struct unit * | punit | ) |
Returns the number of shields this unit represents
Definition at line 1536 of file unittype.c.
Referenced by adv_avoid_risks(), dai_action_value_unit_vs_city(), dai_evaluate_tile_for_air_attack(), dai_hunter_juiciness(), dai_hunter_manage(), dai_rampage_want(), find_best_city_placement(), find_something_to_kill(), get_attacker(), get_defender(), kill_something_with(), reinforcements_cost_and_value(), settler_map_iterate(), stack_cost(), stack_value(), unit_bribe_cost(), and wonder_benefit().
|
static |
Cache what generalized (ruleset defined) action enabler controlled actions a unit of the given type can perform.
Definition at line 398 of file unittype.c.
Referenced by unit_type_action_cache_set().
Return whether the unit can take over enemy cities.
Definition at line 258 of file unittype.c.
Referenced by adv_data_phase_init(), assess_danger(), dai_rampage_want(), dai_should_we_air_attack_tile(), find_something_to_kill(), invasion_funct(), kill_something_with(), and unit_conquer_city().
| struct unit_class * unit_class_array_first | ( | void | ) |
Return the first item of unit_classes.
Definition at line 2471 of file unittype.c.
| const struct unit_class * unit_class_array_last | ( | void | ) |
Return the last item of unit_classes.
Definition at line 2482 of file unittype.c.
| struct unit_class * unit_class_by_rule_name | ( | const char * | s | ) |
Returns the unit class that has the given (untranslated) rule name. Returns NULL if none match.
Definition at line 1836 of file unittype.c.
Referenced by edit_utype::class_menu(), load_ruleset_terrain(), load_ruleset_units(), and universal_value_from_str().
| const char * unit_class_flag_helptxt | ( | enum unit_class_flag_id | id | ) |
Return the (untranslated) help text of the user unit class flag.
Definition at line 1906 of file unittype.c.
Referenced by helptext_unit(), save_units_ruleset(), and send_ruleset_unit_classes().
| const char * unit_class_flag_id_name_cb | ( | enum unit_class_flag_id | flag | ) |
Unit class flag name callback, called from specenum code.
Definition at line 1894 of file unittype.c.
Referenced by first_free_unit_class_user_flag(), and save_units_ruleset().
| void unit_class_flags_free | ( | void | ) |
Frees the memory associated with all unit class flags
Definition at line 2459 of file unittype.c.
Referenced by game_ruleset_free().
| struct unit_class * unit_class_get | ( | const struct unit * | punit | ) |
Returns unit class pointer for a unit.
Definition at line 2546 of file unittype.c.
Referenced by adv_data_phase_init(), api_edit_unit_move_old(), api_edit_unit_teleport_old(), assess_danger_unit(), can_player_see_unit_at(), can_type_transport_units_cargo(), can_unit_move_to_tile_with_notify(), can_unit_transport(), count_my_units(), dai_caravan_can_trade_cities_diff_cont(), dai_caravan_goto(), dai_fill_unit_param(), dai_manage_caravan(), dai_military_defend(), do_paradrop(), editor_grab_tool(), explorer_desirable(), find_something_to_kill(), get_defense_power(), has_defense(), is_plr_zoc_srv(), is_square_threatened(), is_unit_reachable_by_unit(), kill_something_with(), kill_unit(), kills_citizen_after_attack(), pf_attack_possible(), request_unit_return(), settler_map_iterate(), unit_gain_hitpoints(), unit_has_class_flag(), and unit_occupies_tile().
| void unit_classes_free | ( | void | ) |
Free resources allocated for unit classes.
Definition at line 2576 of file unittype.c.
Referenced by game_ruleset_free().
| void unit_classes_init | ( | void | ) |
Initialize unit_class structures.
Definition at line 2554 of file unittype.c.
Referenced by game_ruleset_init().
Return whether the unit has the class flag.
Definition at line 1701 of file unittype.c.
Return whether the unit has the given flag.
Definition at line 184 of file unittype.c.
Referenced by adv_could_unit_move_to_tile(), ap_dipl_battle_win(), api_edit_unit_move_old(), api_edit_unit_teleport_old(), assess_danger(), auto_settler_findwork(), base_assess_defense_unit(), can_unit_do_connect(), civil_war(), count_diplomats_on_tile(), count_my_units(), dai_auto_settler_run(), dai_data_phase_begin(), dai_fill_unit_param(), dai_gothere_bodyguard(), dai_hunter_juiciness(), dai_hunter_manage(), dai_upgrade_units(), diplomat_escape_full(), diplomat_success_vs_defender(), get_defender(), get_diplomatic_defender(), get_modified_firepower(), get_unit_info_label_text2(), hut_get_limited(), is_action_possible(), is_field_unit(), is_military_unit(), is_plr_zoc_client(), is_plr_zoc_srv(), kill_unit(), manage_auto_explorer(), maybe_become_veteran_real(), place_unit(), popup_advanced_terrain_dialog(), server_remove_unit_full(), settler_evaluate_city_requests(), settler_evaluate_improvements(), tai_tile_worker_task_select(), texai_tile_worker_task_select(), unit_attack_all_at_tile_result(), unit_gain_hitpoints(), unit_survive_autoattack(), units_have_type_flag(), and wipe_unit_full().
Return whether the unit has the given role.
Definition at line 202 of file unittype.c.
Referenced by dai_fill_unit_param(), dai_hunter_qualify(), dai_manage_barbarian_leader(), dai_manage_unit(), dai_spend_gold(), dai_unit_make_homecity(), and kill_unit().
| const char * unit_name_translation | ( | const struct unit * | punit | ) |
Return the (translated) name of the unit. You don't have to free the return pointer.
Definition at line 1621 of file unittype.c.
Referenced by clipboard_copy_production(), create_advances_list(), create_improvements_list(), debug_command(), diplomat_sabotage(), do_disband_alternative(), do_paradrop(), explain_why_no_action_enabled(), get_unit_info_label_text1(), get_units_disband_info(), handle_unit_packet_common(), illegal_action_msg(), illegal_action_pay_price(), popup_action_selection(), popup_sabotage_dialog(), popup_sabotage_dialog(), redraw_unit_info_label(), request_unit_goto(), spy_steal_popup_shared(), spy_steal_shared(), text_tag_initv(), text_tag_replace_text(), text_tag_start_sequence(), unit_bombard(), unit_link(), unit_tile_link(), unit_upgrade_info(), hud_units::update_actions(), and usdlg_get_unit_descr().
| int unit_pop_value | ( | const struct unit * | punit | ) |
How much population this unit contains. This can be different from what it originally cost, i.e., from what utype_pop_cost() for the unit type returns.
Definition at line 1595 of file unittype.c.
Referenced by city_add_unit(), city_desirability(), expl_act_not_enabl(), and is_action_possible().
| const char * unit_rule_name | ( | const struct unit * | punit | ) |
Return the (untranslated) rule name of the unit. You don't have to free the return pointer.
Definition at line 1639 of file unittype.c.
Referenced by adv_unit_execute_path(), agents_unit_changed(), agents_unit_new(), agents_unit_remove(), auto_settlers_player(), caravan_optimize_callback(), check_units_single_tile(), client_remove_unit(), dai_caravan_goto(), dai_diplomat_city(), dai_evaluate_tile_for_air_attack(), dai_find_strategic_airbase(), dai_hunter_manage(), dai_manage_airunit(), dai_manage_caravan(), dai_rampage_want(), dai_spend_gold(), dai_unit_new_task(), dai_upgrade_units(), do_attack(), execute_orders(), find_something_to_bomb(), find_something_to_kill(), game_remove_unit(), handle_tile_info(), handle_unit_orders(), handle_unit_packet_common(), handle_unit_sscs_set(), idex_register_unit(), idex_unregister_unit(), immediate_destination(), look_for_charge(), make_path_orders(), real_bodyguard_log(), real_unit_log(), select_tgt_unit(), sell_random_unit(), sg_load_player_unit(), sg_load_player_unit(), sg_load_players(), sg_load_players(), sg_load_sanitycheck(), sg_load_sanitycheck(), sg_save_player_units(), teleport_unit_to_city(), terrain_change_bounce_single_unit(), throw_units_from_illegal_cities(), transfer_city_units(), transfer_unit(), uk_rem_gold_callback(), unit_activity_astr(), unit_bombard(), unit_nuke(), unit_survive_autoattack(), and upgrade_unit_order_targets().
|
static |
Cache if any action may be possible for a unit of the type putype for each unit state property. Since a unit state property could be ignored both present and !present must be checked.
Definition at line 648 of file unittype.c.
Referenced by unit_type_action_cache_set().
| void unit_type_action_cache_init | ( | void | ) |
Cache what unit types may be allowed do what actions, both at all and when certain properties are true.
Definition at line 983 of file unittype.c.
Referenced by load_rulesetdir().
| void unit_type_action_cache_set | ( | struct unit_type * | ptype | ) |
Cache if any action may be possible for a unit of the type putype given the property tested for. Since a it could be ignored both present and !present must be checked.
Definition at line 967 of file unittype.c.
Referenced by handle_rulesets_ready(), and unit_type_action_cache_init().
| struct unit_type * unit_type_array_first | ( | void | ) |
Return the first item of unit_types.
Definition at line 58 of file unittype.c.
Referenced by api_edit_create_unit_full().
| const struct unit_type * unit_type_array_last | ( | void | ) |
Return the last item of unit_types.
Definition at line 69 of file unittype.c.
Referenced by api_edit_create_unit_full().
| struct unit_type * unit_type_by_rule_name | ( | const char * | name | ) |
Returns the unit type that has the given (untranslated) rule name. Returns NULL if none match.
Definition at line 1819 of file unittype.c.
Referenced by api_find_unit_type_by_name(), tab_unit::initialize_new_utype(), lookup_unit_list(), lookup_unit_type(), tab_unit::select_unit(), sg_load_player_units(), sg_load_player_units(), and universal_value_from_str().
| struct unit_type * unit_type_by_translated_name | ( | const char * | name | ) |
Returns the unit type that has the given (translated) name. Returns NULL if none match.
Definition at line 1804 of file unittype.c.
Referenced by help_update_unit_type(), help_dialog::make_tree(), and help_widget::set_topic_unit().
| const char * unit_type_flag_helptxt | ( | enum unit_type_flag_id | id | ) |
Return the (untranslated) helptxt of the user unit flag.
Definition at line 1969 of file unittype.c.
Referenced by helptext_unit(), save_units_ruleset(), and send_ruleset_units().
| const char * unit_type_flag_id_name_cb | ( | enum unit_type_flag_id | flag | ) |
Unit type flag name callback, called from specenum code.
Definition at line 1957 of file unittype.c.
Referenced by first_free_unit_type_user_flag(), and save_units_ruleset().
| void unit_type_flags_free | ( | void | ) |
Frees the memory associated with all unit type flags
Definition at line 2447 of file unittype.c.
Referenced by game_ruleset_free().
|
static |
Frees the memory associated with this unit type.
Definition at line 2414 of file unittype.c.
Referenced by unit_types_free().
Return the unit type for this unit.
Definition at line 123 of file unittype.c.
Referenced by act_sel_new_extra_tgt_callback(), action_auto_perf_unit_sel(), action_decision_handle(), action_dice_roll_odds(), action_get_act_time(), action_may_happen_unit_on_city(), action_maybe_possible_actor_unit(), action_mp_full_makes_legal(), action_prob_pre_action_dice_roll(), action_prob_self_full(), action_prob_vs_city_full(), action_prob_vs_extras_full(), action_prob_vs_tile_full(), action_prob_vs_unit_full(), action_prob_vs_units_full(), action_success_actor_consume(), action_success_target_pay_mp(), adv_danger_at(), adv_data_phase_init(), adv_unit_att_rating(), adv_unit_def_rating_basic(), adv_unit_execute_path(), adv_unit_move(), ap_dipl_battle_win(), api_edit_create_unit_full(), api_edit_unit_move_old(), api_edit_unit_teleport_old(), api_edit_unit_upgrade(), api_effects_unit_bonus(), are_road_reqs_fulfilled(), assess_danger(), assess_danger_unit(), auto_settlers_player(), base_assess_defense_unit(), base_get_defense_power(), base_transporter_for_unit(), build_city_callback(), build_city_callback(), calculate_want_for_paratrooper(), can_be_irrigated(), can_build_base(), can_build_extra(), can_player_see_hypotetic_units_at(), can_player_see_unit_at(), can_remove_extra(), can_unit_do_activity_targeted_at(), can_unit_do_autosettlers(), can_unit_do_connect(), can_unit_exist_at_tile(), can_unit_move_to_tile_with_notify(), can_unit_survive_at_tile(), can_unit_transport(), can_unit_unload(), city_add_unit(), city_build(), city_can_be_built_here(), city_distribute_surplus_shields(), city_gold_worth(), city_unit_present(), city_unit_slots_available(), city_unit_supported(), city_unit_unhappiness(), city_units_upkeep(), clipboard_copy_production(), contemplate_terrain_improvements(), could_unit_load(), count_my_units(), cr_entry_attack(), cr_entry_defense(), create_extra(), units_select::create_pixmap(), create_present_supported_units_widget_list(), create_unit_menu(), dai_action_value_unit_vs_city(), dai_airlift(), dai_choose_defender_versus(), dai_consider_tile_dangerous(), dai_data_phase_begin(), dai_diplomat_bribe_nearby(), dai_evaluate_tile_for_air_attack(), dai_fill_unit_param(), dai_find_strategic_airbase(), dai_gothere_bodyguard(), dai_hunter_juiciness(), dai_hunter_manage(), dai_hunter_missile_want(), dai_hunter_try_launch(), dai_manage_airunit(), dai_manage_diplomat(), dai_manage_hitpoint_recovery(), dai_manage_military(), dai_manage_paratrooper(), dai_manage_unit(), dai_military_attack(), dai_military_findjob(), dai_rampage_want(), dai_set_defenders(), dai_unit_attack(), dai_unit_make_homecity(), dai_unit_move(), dai_unit_new_task(), dai_upgrade_units(), dai_war_desire(), decrease_unit_hp_smooth(), defense_multiplication(), destroy_extra(), diplomat_bribe(), diplomat_embassy(), diplomat_escape_full(), diplomat_get_tech(), diplomat_incite(), diplomat_infiltrate_tile(), diplomat_investigate(), diplomat_sabotage(), diplomat_success_vs_defender(), disband_all_units(), do_attack(), do_capture_units(), do_conquer_extras(), do_expel_unit(), do_heal_unit(), do_move_unit(), do_paradrop(), do_unit_act_sel_vs(), do_unit_conquer_city(), do_unit_establish_trade(), do_unit_upgrade(), do_upgrade_effects(), does_nation_block_action(), does_terrain_block_action(), edit_buffer_copy(), editor_grab_tool(), expl_act_not_enabl(), explain_why_no_action_enabled(), explorer_desirable(), fill_grid_sprite_array(), fill_parameter_part(), fill_unit_sprite_array(), find_best_focus_candidate(), find_best_tile_to_paradrop_to(), find_nearest_airbase(), find_nearest_safe_city(), find_nearest_unit(), find_something_to_kill(), get_activity_rate(), get_attack_power(), get_economy_report_units_data(), get_fortified_defense_power(), get_modified_firepower(), get_total_attack_power(), get_total_defense_power(), get_transporter_capacity(), get_unit_bonus(), get_unit_info_label_text2(), get_unit_vs_tile_bonus(), get_units_report_data(), get_units_upgrade_info(), goods_can_be_provided(), goto_fill_parameter_base(), handle_edit_unit(), handle_edit_unit_remove(), handle_unit_action_query(), handle_unit_combat_info(), handle_unit_packet_common(), handle_unit_type_upgrade(), hp_gain_coord(), illegal_action_msg(), illegal_action_pay_price(), immediate_destination(), invasion_funct(), 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_tile_full(), is_action_enabled_unit_on_unit_full(), is_action_enabled_unit_on_units_full(), is_action_possible(), is_attack_unit(), is_city_surrounded_by_our_spies(), is_hiding_unit(), is_losing_hp(), is_my_turn(), is_possible_base_fuel(), is_refuel_tile(), is_square_threatened(), is_unit_reachable_at(), is_unit_reachable_by_unit(), is_unitstate_req_active(), key_unit_action_select(), kill_something_with(), look_for_charge(), map_move_cost_unit(), maybe_become_veteran_real(), maybe_claim_base(), mr_menu::menus_sensitive(), move_unit_map_canvas(), need_war_player_hlp(), notify_unit_experience(), objbind_get_allowed_value_span(), objbind_get_value_from_object(), package_short_unit(), package_unit(), units_select::paint(), paste_tile(), pf_attack_possible(), pf_get_move_scope(), pf_reverse_map_unit_pos(), pf_transport_check(), pft_fill_unit_attack_param(), pft_fill_unit_default_parameter(), pft_fill_unit_overlap_param(), pft_fill_unit_parameter(), player_restore_units(), popup_advanced_terrain_dialog(), popup_info_text(), present_unit_callback(), quickselect(), real_menus_update(), redraw_unit_info_label(), remove_city(), request_unit_return(), request_unit_select(), resolve_city_emergency(), select_tgt_extra(), select_tgt_unit(), send_goto_route(), sg_load_player_unit(), sg_load_player_unit(), sg_load_player_units(), sg_load_sanitycheck(), sg_load_sanitycheck(), mr_menu::slot_build_city(), spy_attack(), spy_nuke_city(), spy_poison(), spy_sabotage_unit(), spy_spread_plague(), spy_steal_gold(), spy_steal_popup_shared(), spy_steal_some_maps(), tai_tile_worker_task_select(), test_unit_can_airlift_to(), texai_tile_worker_task_select(), texai_unit_update(), transfer_unit(), transform_unit(), unit_activity_astr(), unit_activity_targeted_internal(), unit_att_rating_now(), unit_attack_unit_at_tile_result(), unit_being_aggressive(), unit_bombard(), unit_bombard_rate(), unit_bribe_cost(), unit_build_shield_cost(), unit_build_shield_cost_base(), unit_can_convert(), unit_can_defend_here(), unit_can_do_action(), unit_can_do_action_result(), unit_can_do_action_sub_result(), unit_can_est_trade_route_here(), unit_can_help_build_wonder_here(), unit_can_take_over(), unit_change_homecity_handling(), unit_change_owner(), unit_class_get(), unit_conquer_city(), unit_convert(), unit_def_rating(), unit_description(), unit_do_destroy_city(), unit_do_help_build(), unit_do_regular_move(), unit_food_upkeep(), unit_foodbox_cost(), unit_gain_hitpoints(), unit_has_type_flag(), unit_has_type_role(), unit_is_cityfounder(), unit_is_on_layer(), unit_move(), unit_move_consequences(), unit_move_rate(), unit_move_to_tile_test(), unit_name_translation(), unit_nuke(), unit_pays_mp_for_action(), unit_pop_value(), unit_restore_hitpoints(), unit_rule_name(), unit_select_dialog_popup(), unit_shield_value(), unit_teleport_to_tile_test(), unit_transform_result(), unit_transport_check(), unit_upgrade_info(), unit_upgrade_test(), unit_veteran_level_string(), unit_virtual_create(), unit_vision_range_modifiers(), units_can_convert(), units_orders_city_dlg_callback(), units_report_update(), hud_units::update_actions(), update_unit_activity(), units_reports::update_units(), upgrade_unit_order_targets(), usdlg_check_unit_location(), usdlg_data_add_unit(), usdlg_data_new(), usdlg_tab_append_units(), utype_player_already_has_this(), and wipe_unit_full().
| void unit_types_free | ( | void | ) |
Frees the memory associated with all unit types.
Definition at line 2433 of file unittype.c.
Referenced by game_ruleset_free().
| void unit_types_init | ( | void | ) |
Inialize unit-type structures.
Definition at line 2394 of file unittype.c.
Referenced by game_ruleset_init().
| int unit_upgrade_price | ( | const struct player * | pplayer, |
| const struct unit_type * | from, | ||
| const struct unit_type * | to | ||
| ) |
Return the cost (gold) of upgrading a single unit of the specified type to the new type. This price could (but currently does not) depend on other attributes (like nation or government type) of the player the unit belongs to.
Definition at line 1783 of file unittype.c.
Referenced by dai_upgrade_units(), do_unit_upgrade(), expl_act_not_enabl(), get_units_upgrade_info(), handle_unit_action_query(), handle_unit_type_upgrade(), popup_upgrade_unit_callback(), unit_upgrade_info(), unit_upgrade_test(), units_report_command_callback(), and unittype_item::upgrade_units().
| void user_unit_class_flags_init | ( | void | ) |
Initialize user unit class flags.
Definition at line 1852 of file unittype.c.
Referenced by game_ruleset_init().
| void user_unit_type_flags_init | ( | void | ) |
Initialize user unit type flags.
Definition at line 1916 of file unittype.c.
Referenced by game_ruleset_init().
|
static |
Cache what generalized (ruleset defined) action enabler controlled actions spends all remaining MP for a given unit type.
Definition at line 529 of file unittype.c.
Referenced by unit_type_action_cache_set().
|
static |
Cache what generalized (ruleset defined) action enabler controlled actions spends all remaining MP for a given unit type given the specified unit state property.
Definition at line 572 of file unittype.c.
Referenced by unit_type_action_cache_set().
Returns TRUE iff performing the specified action always will consume all remaining MP of an actor unit of the specified type.
| putype | the unit type performing the action |
| paction | the action that is performed |
Definition at line 1243 of file unittype.c.
Referenced by find_something_to_kill(), helptext_unit(), pf_danger_map_iterate(), pf_fuel_map_attack_is_possible(), pf_fuel_map_iterate(), pf_normal_map_iterate(), and single_invader().
| bool utype_action_takes_all_mp_if_ustate_is | ( | const struct unit_type * | putype, |
| struct action * | paction, | ||
| const enum ustate_prop | prop | ||
| ) |
Returns TRUE iff performing the specified action always will consume all remaining MP of an actor unit of the specified type when the specified unit state property is true after the action has been performed.
| putype | the unit type performing the action |
| paction | the action that is performed |
| prop | the unit state property |
Definition at line 1259 of file unittype.c.
Referenced by helptext_unit().
Return TRUE iff units of this type can do hostile actions controlled by generalized (ruleset defined) action enablers.
Definition at line 515 of file unittype.c.
Referenced by assess_danger(), dai_hunter_juiciness(), dai_hunter_manage(), find_something_to_kill(), goto_fill_parameter_base(), and is_square_threatened().
Return pointer to ai data of given unit type and ai type.
Definition at line 2741 of file unittype.c.
Referenced by assess_danger(), dai_can_unit_type_follow_unit_type(), dai_hunter_guess_best(), dai_unit_defense_desirability(), dai_units_ruleset_close(), and dai_units_ruleset_init().
| int utype_build_shield_cost | ( | const struct city * | pcity, |
| const struct player * | pplayer, | ||
| const struct unit_type * | punittype | ||
| ) |
Returns the number of shields it takes to build this unit type. If pplayer is NULL, owner of the pcity is used instead.
Definition at line 1490 of file unittype.c.
Referenced by city_build_unit(), city_production_build_units(), dai_choose_attacker(), dai_choose_bodyguard(), dai_choose_defender_versus(), dai_choose_diplomat_offensive(), dai_choose_trade_route(), dai_hunter_guess_best(), dai_hunter_missile_want(), dai_process_defender_want(), dai_spend_gold(), find_something_to_kill(), get_city_dialog_production_row(), name_and_sort_items(), popup_worklist_editor(), process_attacker_want(), real_city_report_dialog_update_city(), real_info_city_report_dialog_update(), redraw_city_dialog(), unit_build_shield_cost(), universal_build_shield_cost(), city_dialog::update_improvements(), and utype_buy_gold_cost().
| int utype_build_shield_cost_base | ( | const struct unit_type * | punittype | ) |
Returns the number of shields this unit type represents.
Definition at line 1520 of file unittype.c.
Referenced by build_cost_balanced(), dai_choose_help_wonder(), get_tooltip_unit(), help_update_unit_type(), helptext_unit(), kill_something_with(), manual_command(), popup_unit_info(), help_widget::set_topic_unit(), unit_build_shield_cost_base(), unit_shield_value(), and unit_upgrade_price().
| int utype_buy_gold_cost | ( | const struct city * | pcity, |
| const struct unit_type * | punittype, | ||
| int | shields_in_stock | ||
| ) |
Returns the amount of gold it takes to rush this unit.
Definition at line 1544 of file unittype.c.
Referenced by city_gold_worth(), and city_production_buy_gold_cost().
| struct unit_type * utype_by_number | ( | const Unit_type_id | id | ) |
Return a pointer for the unit type struct for the given unit type id.
This function returns NULL for invalid unit pointers (some callers rely on this).
Definition at line 112 of file unittype.c.
Referenced by tab_unit::add_now(), api_find_unit_type(), cid_decode(), city_choose_build_default(), eco_report::disband_units(), editor_tool_get_value_name(), editor_unit_virtual_create(), get_tool_value_pixbuf(), handle_edit_unit_create(), handle_edit_unit_remove(), handle_ruleset_nation(), handle_ruleset_terrain(), handle_ruleset_unit(), handle_ruleset_unit_bonus(), handle_unit_type_upgrade(), multiairlift(), popup_unit_info(), popup_upgrade_unit_callback(), texai_unit_info_recv(), units_report_command_callback(), units_report_selection_callback(), universal_by_number(), universal_value_initial(), unpackage_short_unit(), and unpackage_unit().
| bool utype_can_act_if_tgt_diplrel_tile_other | ( | const struct unit_type * | punit_type, |
| const action_id | act_id, | ||
| const int | prop, | ||
| const bool | is_there | ||
| ) |
Return TRUE iff the given (action enabler controlled) action can be performed by a unit of the given type while the given property of its owner's diplomatic relationship to the target tile's owner has the given value.
Definition at line 1088 of file unittype.c.
Referenced by need_war_player_hlp().
| bool utype_can_create_extra | ( | const struct unit_type * | putype, |
| const struct extra_type * | pextra | ||
| ) |
Return whether the unit can do an action that creates the specified extra kind.
Definition at line 211 of file unittype.c.
Referenced by act_sel_new_extra_tgt_callback().
| bool utype_can_do_act_if_tgt_citytile | ( | const struct unit_type * | punit_type, |
| const action_id | act_id, | ||
| const enum citytile_type | prop, | ||
| const bool | is_there | ||
| ) |
Returns TRUE iff the unit type can do the specified (action enabler controlled) action while its target's CityTile property state has the value is_there.
Definition at line 1048 of file unittype.c.
Referenced by action_prob_vs_units_full().
| bool utype_can_do_act_when_ustate | ( | const struct unit_type * | punit_type, |
| const action_id | act_id, | ||
| const enum ustate_prop | prop, | ||
| const bool | is_there | ||
| ) |
Return TRUE iff the unit type can do the specified (action enabler controlled) action while its unit state property prop has the value is_there.
Definition at line 1007 of file unittype.c.
Referenced by can_unit_act_when_ustate_is(), city_can_be_built_here(), expl_act_not_enabl(), explain_why_no_action_enabled(), illegal_action_msg(), unit_attack_unit_at_tile_result(), and utype_can_do_action_result_when_ustate().
Return TRUE iff units of the given type can do the specified generalized (ruleset defined) action enabler controlled action.
Note that a specific unit in a specific situation still may be unable to perform the specified action.
Definition at line 443 of file unittype.c.
Referenced by action_decision_handle(), action_may_happen_unit_on_city(), action_maybe_possible_actor_unit(), adv_data_phase_init(), build_city_callback(), build_city_callback(), calculate_city_clusters(), city_can_be_built_here(), count_my_units(), dai_choose_diplomat_offensive(), dai_choose_help_wonder(), dai_choose_paratrooper(), dai_choose_trade_route(), dai_evaluate_tile_for_air_attack(), dai_hunter_missile_want(), dai_hunter_try_launch(), dai_unit_new_task(), dai_units_ruleset_init(), dai_wonder_city_distance(), disband_all_units(), does_nation_block_action(), does_terrain_block_action(), expl_act_not_enabl(), helptext_unit(), impr_allows_actions(), pf_danger_map_iterate(), pf_fuel_map_attack_is_possible(), pf_fuel_map_iterate(), pf_normal_map_iterate(), popup_info_text(), real_menus_update(), rscompat_postprocess(), send_ruleset_units(), mr_menu::slot_build_city(), unit_attack_unit_at_tile_result(), unit_can_do_action(), unit_can_est_trade_route_here(), unit_can_help_build_wonder_here(), unit_conquer_city(), units_can_convert(), mr_menu::update_airlift_menu(), update_simple_ai_types(), utype_act_takes_all_mp_cache_set(), utype_act_takes_all_mp_ustate_cache_set(), utype_acts_hostile(), utype_can_create_extra(), utype_can_do_action_result(), utype_can_do_action_role(), utype_can_do_action_sub_result(), utype_can_remove_extra(), utype_is_consumed_by_action_result(), utype_may_act_at_all(), utype_may_do_escape_action(), and utype_unknown_move_cost().
Return TRUE iff units of the given type can do any enabler controlled action with the specified action result.
Note that a specific unit in a specific situation still may be unable to perform the specified action.
Definition at line 459 of file unittype.c.
Referenced by aia_utype_is_considered_caravan(), aia_utype_is_considered_caravan_trade(), aia_utype_is_considered_spy(), aia_utype_is_considered_spy_vs_city(), aia_utype_is_considered_worker(), assess_danger_unit(), can_attack_non_native(), can_player_build_unit_direct(), dai_fill_unit_param(), get_fortified_defense_power(), helptext_extra(), helptext_unit(), look_for_charge(), city_production_delegate::paint(), unit_can_do_action_result(), utype_can_take_over(), and utype_is_cityfounder().
| bool utype_can_do_action_result_when_ustate | ( | const struct unit_type * | putype, |
| enum action_result | result, | ||
| const enum ustate_prop | prop, | ||
| const bool | is_there | ||
| ) |
Return TRUE iff units of the given type can do any enabler controlled action with the specified action result while its unit state property prop has the value is_there.
Note that a specific unit in a specific situation still may be unable to perform the specified action.
Definition at line 1027 of file unittype.c.
Referenced by can_attack_from_non_native().
Return TRUE iff the unit type can perform the action corresponding to the unit type role.
Definition at line 505 of file unittype.c.
Referenced by role_unit_precalcs().
| bool utype_can_do_action_sub_result | ( | const struct unit_type * | putype, |
| enum action_sub_result | sub_result | ||
| ) |
Return TRUE iff units of the given type can do any enabler controlled action with the specified action sub result.
Note that a specific unit in a specific situation still may be unable to perform the specified action.
Definition at line 480 of file unittype.c.
Referenced by unit_can_do_action_sub_result().
| bool utype_can_freely_load | ( | const struct unit_type * | pcargotype, |
| const struct unit_type * | ptranstype | ||
| ) |
Return TRUE iff the given cargo type has no restrictions on when it can load onto the given transporter. (Does not check that cargo is valid for transport!)
Definition at line 282 of file unittype.c.
Referenced by could_unit_load(), helptext_unit(), is_possible_base_fuel(), and pf_get_move_scope().
| bool utype_can_freely_unload | ( | const struct unit_type * | pcargotype, |
| const struct unit_type * | ptranstype | ||
| ) |
Return TRUE iff the given cargo type has no restrictions on when it can unload from the given transporter. (Does not check that cargo is valid for transport!)
Definition at line 294 of file unittype.c.
Referenced by amphibious_move_scope(), base_transporter_for_unit(), can_unit_unload(), helptext_unit(), pf_danger_map_iterate(), pf_fuel_map_iterate(), pf_get_move_scope(), and pf_normal_map_new().
| bool utype_can_remove_extra | ( | const struct unit_type * | putype, |
| const struct extra_type * | pextra | ||
| ) |
Return whether the unit can do an action that removes the specified extra kind.
Definition at line 235 of file unittype.c.
Referenced by act_sel_new_extra_tgt_callback().
Return whether the unit type can take over enemy cities.
Definition at line 270 of file unittype.c.
Referenced by adv_data_phase_init(), dai_units_ruleset_init(), pf_get_action(), pf_get_move_scope(), process_attacker_want(), and unit_can_take_over().
| Unit_type_id utype_count | ( | void | ) |
Return the number of unit types.
Definition at line 80 of file unittype.c.
Referenced by collect_production_targets(), editor_tool_is_usable(), explain_why_no_action_enabled(), helptext_extra(), helptext_unit(), illegal_action_msg(), popup_unit_info(), send_ruleset_units(), units_report_update(), and units_reports::update_units().
| bool utype_flag_is_in_use | ( | enum unit_type_flag_id | uflag | ) |
Returns TRUE iff the specified unit type flag is in use by any unit type.
| uflag | the unit type flag to check if is in use. |
Definition at line 3002 of file unittype.c.
Referenced by universal_never_there().
Return the "happy cost" (the number of citizens who are discontented) for this unit.
Definition at line 175 of file unittype.c.
Referenced by city_unit_unhappiness(), and resolve_city_emergency().
Return whether the unit type has the class flag.
Definition at line 1709 of file unittype.c.
Referenced by get_modified_firepower().
Return whether the given unit type has the role. Roles are like flags but have no meaning except to the AI.
Definition at line 193 of file unittype.c.
Referenced by adv_units_ruleset_init(), api_methods_unit_type_has_role(), can_player_build_unit_direct(), dai_choose_bodyguard(), dai_process_defender_want(), load_ruleset_units(), role_unit_precalcs(), rs_barbarian_units(), save_units_ruleset(), unit_has_type_role(), and unit_role_defender().
| Unit_type_id utype_index | ( | const struct unit_type * | punittype | ) |
Return the unit type index.
Currently same as utype_number(), paired with utype_count() indicates use as an array index.
Definition at line 91 of file unittype.c.
Referenced by assess_danger(), can_utype_do_act_if_tgt_diplrel(), city_production_build_units(), city_production_caravan_shields_init(), city_production_gets_caravan_shields(), dai_process_defender_want(), dai_wants_defender_against(), defense_multiplication(), do_capture_units(), get_unit_info_label_text2(), get_units_report_data(), get_unittype_sprite(), load_ruleset_units(), load_unit_names(), local_dipl_rel_action_cache_set(), local_dipl_rel_tile_other_tgt_action_cache_set(), pf_transport_check(), pft_fill_amphibious_parameter(), pft_fill_unit_default_parameter(), real_activeunits_report_dialog_update(), real_units_report_dialog_update(), tab_unit::refresh(), set_unit_type_caches(), sg_load_sanitycheck(), sg_load_sanitycheck(), tai_tile_worker_task_select(), texai_city_worker_wants(), texai_tile_worker_task_select(), tgt_citytile_act_cache_set(), tileset_setup_unit_type(), unit_hud_selector::type_filter(), unit_can_act_cache_set(), unit_hud_selector::unit_hud_selector(), unit_state_action_cache_set(), units_report_update(), mr_menu::update_airlift_menu(), units_reports::update_units(), usdlg_data_add_unit(), usdlg_data_new(), usdlg_tab_append_activity(), usdlg_tab_append_units(), usdlg_tab_append_utype(), usdlg_tab_update(), utype_act_takes_all_mp_cache_set(), utype_act_takes_all_mp_ustate_cache_set(), utype_action_takes_all_mp(), utype_action_takes_all_mp_if_ustate_is(), utype_can_act_if_tgt_diplrel_tile_other(), utype_can_do_act_if_tgt_citytile(), utype_can_do_act_when_ustate(), and utype_can_do_action().
Is cityfounder type
Definition at line 2967 of file unittype.c.
Referenced by dai_spend_gold(), dai_war_desire(), sanity_check_ruleset_data(), and unit_is_cityfounder().
Returns TRUE iff performing the specified action will consume an actor unit of the specified type.
Definition at line 1271 of file unittype.c.
Referenced by action_success_actor_consume(), dai_action_value_unit_vs_city(), diplomat_embassy(), diplomat_escape_full(), diplomat_get_tech(), diplomat_investigate(), do_attack(), helptext_unit(), spy_nuke_city(), unit_order_list_is_sane(), utype_is_consumed_by_action_result(), and utype_may_do_escape_action().
| bool utype_is_consumed_by_action_result | ( | enum action_result | result, |
| const struct unit_type * | utype | ||
| ) |
Returns TRUE iff performing an action with the specified action result will consume an actor unit of the specified type.
Definition at line 1281 of file unittype.c.
Referenced by dai_choose_paratrooper(), and city_production_delegate::paint().
| bool utype_is_moved_to_tgt_by_action | ( | const struct action * | paction, |
| const struct unit_type * | utype | ||
| ) |
Returns TRUE iff successfully performing the specified action always will move the actor unit of the specified type to the target's tile.
Definition at line 1301 of file unittype.c.
Referenced by adv_unit_move(), dai_action_value_unit_vs_city(), dai_unit_move(), illegal_action_pay_price(), unit_order_list_is_sane(), upgrade_unit_order_targets(), utype_pays_for_regular_move_to_tgt(), and utype_pays_mp_for_action_estimate().
Returns TRUE iff successfully performing the specified action never will move the actor unit from its current tile.
Definition at line 1340 of file unittype.c.
Referenced by dai_action_value_unit_vs_city(), unit_order_list_is_sane(), and upgrade_unit_order_targets().
Return TRUE iff units of this type can do actions controlled by generalized (ruleset defined) action enablers.
Definition at line 431 of file unittype.c.
Referenced by dai_fill_unit_param(), do_unit_act_sel_vs(), goto_fill_parameter_base(), key_unit_action_select(), local_dipl_rel_action_cache_set(), pft_enable_default_actions(), tgt_citytile_act_cache_set(), unit_state_action_cache_set(), utype_may_act_move_frags(), and utype_may_act_tgt_city_tile().
| bool utype_may_act_move_frags | ( | const struct unit_type * | punit_type, |
| const action_id | act_id, | ||
| const int | move_fragments | ||
| ) |
Return TRUE iff the given (action enabler controlled) action may be performed by a unit of the given type that has the given number of move fragments left.
Note: Values aren't cached. If a performance critical user appears it would be a good idea to cache the (merged) ranges of move fragments where a unit of the given type can perform the specified action.
Definition at line 1110 of file unittype.c.
Referenced by action_mp_full_makes_legal(), test_unit_can_airlift_to(), and utype_may_act_move_frags().
| bool utype_may_act_tgt_city_tile | ( | const struct unit_type * | punit_type, |
| const action_id | act_id, | ||
| const enum citytile_type | prop, | ||
| const bool | is_there | ||
| ) |
Return TRUE iff the given (action enabler controlled) action may be performed by a unit of the given type if the target tile has the given property.
Note: Values aren't cached. If a performance critical user appears it would be a good idea to cache the result.
Definition at line 1176 of file unittype.c.
Referenced by expl_act_not_enabl(), and utype_may_act_tgt_city_tile().
| enum unit_move_type utype_move_type | ( | const struct unit_type * | punittype | ) |
Return move type of the unit type
Definition at line 1603 of file unittype.c.
Referenced by editor_grab_tool(), quickselect(), and usdlg_check_unit_location().
| const char * utype_name_translation | ( | const struct unit_type * | punittype | ) |
Return the (translated) name of the unit type. You don't have to free the return pointer.
Definition at line 1612 of file unittype.c.
Referenced by add_global_worklist(), add_target_to_worklist(), api_methods_unit_type_name_translation(), boot_help_texts(), can_unit_move_to_tile_with_notify(), city_build_unit(), city_dialog_update_building(), client_change_all(), create_present_supported_units_widget_list(), create_tech_info(), diplomat_bribe(), disband_all_units(), disband_city(), eco_report::disband_units(), do_capture_units(), do_unit_upgrade(), do_upgrade_effects(), economy_report_command_callback(), economy_report_update(), editbar_reload_tileset(), editor_tool_get_value_name(), explain_why_no_action_enabled(), get_production_name(), get_tooltip_unit(), get_unit_info_label_text2(), handle_edit_unit_create(), handle_edit_unit_remove(), handle_unit_type_upgrade(), help_callback(), help_update_tech(), help_update_unit_type(), helptext_building(), helptext_extra(), helptext_government(), helptext_nation(), helptext_unit(), illegal_action_msg(), insert_allows(), manual_command(), research_diagram::mousePressEvent(), objbind_get_value_from_object(), city_production_delegate::paint(), city_production_model::populate(), popup_advanced_terrain_dialog(), popup_info_text(), popup_unit_info(), popup_upgrade_unit_callback(), popup_worklist_editor(), real_activeunits_report_dialog_update(), real_city_report_dialog_update_city(), real_info_city_report_dialog_update(), real_menus_update(), really_handle_city_buy(), redraw_city_dialog(), redraw_unit_info_label(), req_text_insert(), research_tech_lost(), role_units_translations(), select_tgt_extra(), select_tgt_unit(), set_global_worklist(), help_widget::set_topic_tech(), help_widget::set_topic_unit(), sg_load_sanitycheck(), sg_load_sanitycheck(), try_to_save_unit(), unit_convert(), unit_description(), unit_hud_selector::unit_hud_selector(), unit_lost_with_transport(), unit_name_translation(), unit_select_dialog_popup(), unit_type_by_translated_name(), unit_upgrade_info(), units_report_command_callback(), units_report_update(), universal_name_translation(), mr_menu::update_airlift_menu(), eco_report::update_report(), units_reports::update_units(), upgrade_unit_prod(), unittype_item::upgrade_units(), usdlg_tab_append_utype(), utype_values_translation(), wl_help_from_iter(), worklist_change_build_target(), and worklist_item_postpone_req_vec().
| Unit_type_id utype_number | ( | const struct unit_type * | punittype | ) |
Return the unit type index.
Definition at line 100 of file unittype.c.
Referenced by cid_encode(), create_tech_info(), eco_report::disband_units(), editbar_reload_tileset(), editor_grab_tool(), get_target_help_data(), has_player_unit_type(), lookup_unit_list(), package_short_unit(), package_unit(), paste_tile(), popup_advanced_terrain_dialog(), popup_unit_info(), real_activeunits_report_dialog_update(), real_units_report_dialog_update(), rscompat_postprocess(), send_ruleset_nations(), send_ruleset_terrain(), send_ruleset_units(), set_global_worklist(), texai_unit_update(), units_report_command_callback(), universal_number(), and unittype_item::upgrade_units().
| bool utype_pays_for_regular_move_to_tgt | ( | const struct action * | paction, |
| const struct unit_type * | utype | ||
| ) |
Returns TRUE iff successfully performing the specified action always will cost the actor unit of the specified type the move fragments it would take to perform a regular move to the target's tile. This cost is added to the cost of successfully performing the action.
Definition at line 1382 of file unittype.c.
Referenced by dai_action_value_unit_vs_city(), and utype_pays_mp_for_action_estimate().
| int utype_pays_mp_for_action_base | ( | const struct action * | paction, |
| const struct unit_type * | putype | ||
| ) |
Returns the amount of movement points successfully performing the specified action will consume in the actor unit type without taking effects or regular moves into account.
Definition at line 1433 of file unittype.c.
Referenced by unit_pays_mp_for_action(), and utype_pays_mp_for_action_estimate().
| int utype_pays_mp_for_action_estimate | ( | const struct civ_map * | nmap, |
| const struct action * | paction, | ||
| const struct unit_type * | putype, | ||
| const struct player * | act_player, | ||
| const struct tile * | act_tile, | ||
| const struct tile * | tgt_tile | ||
| ) |
Returns an estimate of the amount of movement points successfully performing the specified action will consume in the actor unit type.
Definition at line 1445 of file unittype.c.
Referenced by dai_evaluate_tile_for_air_attack().
| bool utype_player_already_has_this | ( | const struct player * | pplayer, |
| const struct unit_type * | putype | ||
| ) |
Returns TRUE iff the player already has a unit of this type.
Definition at line 1993 of file unittype.c.
Referenced by impr_allows_actions(), and utype_player_already_has_this_unique().
| bool utype_player_already_has_this_unique | ( | const struct player * | pplayer, |
| const struct unit_type * | putype | ||
| ) |
Returns TRUE iff the unit type is unique and the player already has one.
Definition at line 1979 of file unittype.c.
Referenced by api_edit_create_unit_full(), can_player_build_unit_direct(), crole_to_unit_type(), diplomat_bribe(), do_capture_units(), expl_act_not_enabl(), handle_edit_unit_create(), is_action_possible(), place_animal(), transfer_unit(), try_summon_barbarians(), unit_change_homecity_handling(), unit_change_owner(), and unleash_barbarians().
How much city shrinks when it builds unit of this type.
Definition at line 1580 of file unittype.c.
Referenced by city_build_unit(), city_create_unit(), and city_production_build_units().
| const char * utype_rule_name | ( | const struct unit_type * | punittype | ) |
Return the (untranslated) rule name of the unit type. You don't have to free the return pointer.
Definition at line 1630 of file unittype.c.
Referenced by adv_choice_rule_name(), api_edit_create_unit_full(), api_methods_unit_type_rule_name(), choose_build_target(), city_build_unit(), city_production_caravan_shields_init(), contemplate_terrain_improvements(), dai_choose_attacker_air(), dai_choose_diplomat_defensive(), dai_choose_diplomat_offensive(), dai_choose_help_wonder(), dai_choose_paratrooper(), dai_process_defender_want(), dai_upgrade_units(), dai_wants_defender_against(), dai_wants_role_unit(), tab_unit::delete_now(), diplomat_bribe(), tab_unit::edit_effects(), edit_utype::edit_utype(), find_best_city_placement(), is_tech_needed(), kill_something_with(), load_ruleset_units(), military_advisor_choose_build(), tab_unit::name_given(), paratroopers_mr_sub_to_effect(), process_attacker_want(), tab_unit::refresh(), rs_barbarian_units(), rs_common_units(), rscompat_postprocess(), sanity_check_ruleset_data(), save_terrain_ruleset(), save_unit_list(), save_units_ruleset(), hud_unit_loader::show_me(), tileset_setup_unit_type(), try_summon_barbarians(), unit_can_act_cache_set(), unit_rule_name(), unit_type_by_rule_name(), universal_kind_values(), universal_rule_name(), unleash_barbarians(), tab_unit::update_utype_info(), utype_act_takes_all_mp_cache_set(), and utype_act_takes_all_mp_ustate_cache_set().
Attach ai data to unit type
Definition at line 2749 of file unittype.c.
Referenced by dai_units_ruleset_close(), and dai_units_ruleset_init().
| int utype_upkeep_cost | ( | const struct unit_type * | ut, |
| struct player * | pplayer, | ||
| Output_type_id | otype | ||
| ) |
Returns the upkeep of a unit of this type under the given government.
Definition at line 132 of file unittype.c.
Referenced by city_distribute_surplus_shields(), city_units_upkeep(), dai_choose_attacker(), dai_choose_attacker_air(), dai_choose_bodyguard(), dai_choose_paratrooper(), dai_hunter_guess_best(), domestic_advisor_choose_build(), get_economy_report_units_data(), sg_load_player_unit(), sg_load_player_unit(), and unit_food_upkeep().
| const char * utype_values_string | ( | const struct unit_type * | punittype | ) |
Return string describing unit type values. String is static buffer that gets reused when function is called again.
Definition at line 1648 of file unittype.c.
Referenced by get_city_dialog_production_row(), and utype_values_translation().
| const char * utype_values_translation | ( | const struct unit_type * | punittype | ) |
Return string with translated unit name and list of its values. String is static buffer that gets reused when function is called again.
Definition at line 1669 of file unittype.c.
Referenced by name_and_sort_items(), and city_dialog::update_improvements().
Return whether this unit type's veteran system, if any, confers a power factor bonus at any level (it could just add extra moves).
Definition at line 2674 of file unittype.c.
Referenced by helptext_unit().
| const struct veteran_level * utype_veteran_level | ( | const struct unit_type * | punittype, |
| int | level | ||
| ) |
Return veteran level properties of given unit in given veterancy level.
Definition at line 2631 of file unittype.c.
Referenced by ap_dipl_battle_win(), base_get_attack_power(), base_get_defense_power(), dai_gothere_bodyguard(), diplomat_escape_full(), diplomat_success_vs_defender(), get_activity_rate(), get_virtual_defense_power(), handle_edit_unit(), helptext_government(), maybe_become_veteran_real(), notify_unit_experience(), send_ruleset_units(), unit_bribe_cost(), unit_veteran_level_string(), utype_move_rate(), utype_veteran_has_power_bonus(), and utype_veteran_name_translation().
| int utype_veteran_levels | ( | const struct unit_type * | punittype | ) |
Return veteran levels of the given unit type.
Definition at line 2661 of file unittype.c.
Referenced by city_production_unit_veteran_level(), helptext_unit(), objbind_get_allowed_value_span(), pf_reverse_map_utype_pos(), pft_fill_utype_default_parameter(), send_ruleset_units(), sg_load_player_unit(), sg_load_player_unit(), unit_virtual_create(), ur_transform_unit(), utype_veteran_has_power_bonus(), and utype_veteran_name_translation().
| const char * utype_veteran_name_translation | ( | const struct unit_type * | punittype, |
| int | level | ||
| ) |
Return translated name of the given veteran level. NULL if this unit type doesn't have different veteran levels.
Definition at line 2646 of file unittype.c.
Referenced by create_present_supported_units_widget_list(), popup_advanced_terrain_dialog(), popup_info_text(), redraw_unit_info_label(), unit_description(), and unit_select_dialog_popup().
| const struct veteran_system * utype_veteran_system | ( | const struct unit_type * | punittype | ) |
Return veteran system used for this unit type.
Definition at line 2615 of file unittype.c.
Referenced by helptext_government(), maybe_become_veteran_real(), notify_unit_experience(), transform_unit(), utype_veteran_level(), and utype_veteran_levels().
| void veteran_system_definition | ( | struct veteran_system * | vsystem, |
| int | level, | ||
| const char * | vlist_name, | ||
| int | vlist_power, | ||
| int | vlist_move, | ||
| int | vlist_raise, | ||
| int | vlist_wraise | ||
| ) |
Fill veteran level in given veteran system with given information.
Definition at line 2719 of file unittype.c.
Referenced by handle_ruleset_game(), handle_ruleset_unit(), and load_ruleset_veteran().
| void veteran_system_destroy | ( | struct veteran_system * | vsystem | ) |
Free veteran system
Definition at line 2706 of file unittype.c.
Referenced by game_ruleset_free(), and unit_type_free().
| struct veteran_system * veteran_system_new | ( | int | count | ) |
Allocate new veteran system structure with given veteran level count.
Definition at line 2688 of file unittype.c.
Referenced by handle_ruleset_game(), handle_ruleset_unit(), and load_ruleset_veteran().
|
static |
Definition at line 641 of file unittype.c.
Referenced by tgt_citytile_act_cache_set(), and utype_can_do_act_if_tgt_citytile().
|
static |
Definition at line 638 of file unittype.c.
Referenced by can_utype_do_act_if_tgt_diplrel(), and local_dipl_rel_action_cache_set().
|
static |
Definition at line 640 of file unittype.c.
Referenced by local_dipl_rel_tile_other_tgt_action_cache_set(), and utype_can_act_if_tgt_diplrel_tile_other().
Definition at line 2172 of file unittype.c.
Referenced by best_role_unit(), best_role_unit_for_player(), first_role_unit_for_player(), get_role_unit(), num_role_units(), and role_unit_precalcs().
|
static |
Definition at line 2173 of file unittype.c.
Referenced by best_role_unit(), best_role_unit_for_player(), first_role_unit_for_player(), get_role_unit(), num_role_units(), precalc_one(), role_unit_precalcs(), role_unit_precalcs_free(), role_units_iterate(), and role_units_iterate_backwards().
|
static |
Definition at line 392 of file unittype.c.
Referenced by unit_can_act_cache_set(), and utype_can_do_action().
|
static |
Definition at line 45 of file unittype.c.
Referenced by uclass_by_number(), unit_class_array_first(), unit_class_array_last(), unit_classes_free(), and unit_classes_init().
Definition at line 44 of file unittype.c.
Referenced by unit_type_array_first(), unit_type_array_last(), unit_types_free(), unit_types_init(), utype_by_number(), and utype_index().
|
static |
Definition at line 53 of file unittype.c.
Referenced by set_user_unit_class_flag_name(), unit_class_flag_helptxt(), unit_class_flag_id_name_cb(), unit_class_flags_free(), and user_unit_class_flags_init().
|
static |
Definition at line 51 of file unittype.c.
Referenced by set_user_unit_type_flag_name(), unit_type_flag_helptxt(), unit_type_flag_id_name_cb(), unit_type_flags_free(), and user_unit_type_flags_init().
|
static |
Definition at line 637 of file unittype.c.
Referenced by unit_state_action_cache_set(), and utype_can_do_act_when_ustate().
|
static |
Definition at line 523 of file unittype.c.
Referenced by utype_act_takes_all_mp_cache_set(), and utype_action_takes_all_mp().
|
static |
Definition at line 565 of file unittype.c.
Referenced by utype_act_takes_all_mp_ustate_cache_set(), and utype_action_takes_all_mp_if_ustate_is().
|
static |
Definition at line 2174 of file unittype.c.
Referenced by best_role_unit(), best_role_unit_for_player(), first_role_unit_for_player(), get_role_unit(), precalc_one(), role_unit_precalcs(), role_unit_precalcs_free(), role_units_iterate(), and role_units_iterate_backwards().