54#define CARGO_ITER(iter) ((struct cargo_iter *) (iter))
364 const struct player *pplayer)
368 if (pplayer ==
nullptr) {
413 const struct player *pplayer,
568 const struct tile *ptile,
650 return Q_(
"?act:Mine");
655 return _(
"Irrigate");
657 return _(
"Cultivate");
659 return _(
"Fortifying");
661 return _(
"Fortified");
671 return _(
"Transform");
910 if (
NULL == target) {
918 if (
NULL == target) {
948 const struct tile *ptile)
967#define RETURN_IS_ACTIVITY_ENABLED_UNIT_ON(paction) \
969 switch (action_get_target_kind(paction)) { \
971 return is_action_enabled_unit_on_tile(nmap, paction->id, \
972 punit, ptile, target); \
974 return is_action_enabled_unit_on_extras(nmap, paction->id, \
975 punit, ptile, target); \
984 fc_assert(action_target_kind_is_valid( \
985 action_get_target_kind(paction))); \
997 "Please use action_speculate_unit_on_tile()");
999 punit, ptile, target);
1004 "Please use action_speculate_unit_on_tile()");
1011 "Please use action_speculate_unit_on_tile()");
1018 "Please use action_speculate_unit_on_tile()");
1025 "Please use action_speculate_unit_on_tile()");
1032 "Please use action_speculate_unit_on_self()");
1042 "Please use action_speculate_unit_on_tile()");
1044 punit, ptile, target);
1049 "Please use action_speculate_unit_on_tile()");
1051 punit, ptile, target);
1064 "Please use action_speculate_unit_on_tile()");
1073 "Please use action_speculate_unit_on_tile()");
1080 "Please use action_speculate_unit_on_self()");
1087 log_error(
"can_unit_do_activity_targeted_at() unknown activity %d",
1091#undef RETURN_IS_ACTIVITY_ENABLED_UNIT_ON
1152 const struct tile *ptile)
1250 log_error(
"Unknown unit activity %d for %s (nb %d) in %s()",
1298 const struct player *pplayer)
1321 const struct player *pplayer)
1336 const struct player *pplayer,
1361 const struct player *pplayer)
1377 const struct player *pplayer)
1398 const struct player *pplayer)
1458 bool hidden =
FALSE;
1683 if (
pcity !=
nullptr) {
1831 const struct tile *ptile,
1852 cur.outermost_moves_left =
ptrans->moves_left;
1870 if (!
cur.has_orders && best.has_orders) {
1872 }
else if (
cur.has_orders && !best.has_orders) {
1882 if (
cur.is_idle && !best.is_idle) {
1884 }
else if (!
cur.is_idle && best.is_idle) {
1895 if (
cur.can_freely_unload && !best.can_freely_unload) {
1897 }
else if (!
cur.can_freely_unload && best.can_freely_unload) {
1905 if (
cur.depth < best.depth) {
1907 }
else if (
cur.depth > best.depth) {
1916 if (
cur.outermost_moves_left > best.outermost_moves_left) {
1918 }
else if (
cur.outermost_moves_left < best.outermost_moves_left) {
1930 if (
cur.total_moves > best.total_moves) {
1960 const struct tile *ptile)
2101 "Treasury contains %d gold.",
2111 "Upgrade %s to %s for %d gold?\n%s",
2119 _(
"Sorry, cannot upgrade %s (yet)."),
2126 "Upgrading %s to %s costs %d gold.\n%s",
2135 _(
"You can only upgrade units in your cities."));
2139 _(
"Upgrading this %s would strand units it transports."),
2144 _(
"Upgrading this %s would result in a %s which can not "
2145 "survive at this place."),
2151 _(
"Upgrading this %s would result in a %s which its "
2152 "current transport, %s, could not transport."),
2159 _(
"Cannot upgrade %s while doing '%s'."),
2358 if (
owner !=
nullptr) {
2411 if (
ptype->move_rate > 0) {
2484#ifndef FREECIV_NDEBUG
2522 return pcargo->transporter;
2533 return ptrans->transporting;
2618 if (
iter.depth > depth) {
2675 while (
iter->depth > 0) {
2731 for (
i = 0;
i < length;
i++) {
2736 log_error(
"invalid order %d at index %d", orders[
i].order,
i);
2739 switch (orders[
i].order) {
2743 log_error(
"in order %d, invalid move direction %d.",
i, orders[
i].dir);
2748 switch (orders[
i].activity) {
2750 if (
i != length - 1) {
2752 log_error(
"activity %d is not allowed at index %d.", orders[
i].activity,
2769 log_error(
"at index %d, use action rather than activity %d.",
2770 i, orders[
i].activity);
2780 log_error(
"at index %d, unsupported activity %d.",
i, orders[
i].activity);
2796 log_error(
"at index %d, invalid tile target %d for the action %d.",
2802 log_error(
"at index %d, the action %d sets the outdated target"
2803 " specification dir.",
2813 log_error(
"at index %d, cannot do %s without a target.",
i,
2820 if (orders[
i].sub_target ==
A_NONE
2824 log_error(
"at index %d, cannot do %s without a target.",
i,
2838 if (pextra ==
NULL) {
2841 log_error(
"at index %d, cannot do %s without a target.",
i,
2849 log_error(
"at index %d, cannot do %s to %s.",
i,
2864 "Bad action %d in order number %d.", orders[
i].
action,
i);
2868 if (
i != length - 1) {
2879 log_error(
"action %d is not allowed at index %d.",
bool action_prob_possible(const struct act_prob probability)
struct act_prob action_prob_vs_tile(const struct civ_map *nmap, const struct unit *actor_unit, const action_id act_id, const struct tile *target_tile, const struct extra_type *target_extra)
const char * action_id_rule_name(action_id act_id)
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_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)
struct act_prob action_prob_vs_city(const struct civ_map *nmap, const struct unit *actor_unit, const action_id act_id, const struct city *target_city)
bool action_maybe_possible_actor_unit(const struct civ_map *nmap, const action_id act_id, const struct unit *actor_unit)
bool action_id_exists(const action_id act_id)
bool is_action_enabled_unit_on_self(const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit)
struct act_prob action_prob_vs_unit(const struct civ_map *nmap, const struct unit *actor_unit, const action_id act_id, const struct unit *target_unit)
#define action_by_result_iterate(_paction_, _result_)
#define action_id_get_sub_target_kind(act_id)
static struct action * action_by_number(action_id act_id)
#define action_has_result(_act_, _res_)
#define action_by_result_iterate_end
bool actres_removes_extra(enum action_result result, const struct extra_type *pextra)
bool actres_creates_extra(enum action_result result, const struct extra_type *pextra)
int ai_type_number(const struct ai_type *ai)
#define CALL_FUNC_EACH_AI(_func,...)
void astr_add_line(struct astring *astr, const char *format,...)
void astr_add(struct astring *astr, const char *format,...)
bool is_capital(const struct city *pcity)
struct city * tile_non_allied_city(const struct tile *ptile, const struct player *pplayer)
bool is_unit_near_a_friendly_city(const struct civ_map *nmap, const struct unit *punit, int distance)
#define city_list_iterate(citylist, pcity)
#define city_tile(_pcity_)
#define city_owner(_pcity_)
#define city_list_iterate_end
static void base(QVariant data1, QVariant data2)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int cost
int get_unit_bonus(const struct unit *punit, enum effect_type effect_type)
int get_target_bonus_effects(struct effect_list *plist, const struct req_context *context, const struct req_context *other_context, enum effect_type effect_type)
int get_unittype_bonus(const struct player *pplayer, const struct tile *ptile, const struct unit_type *punittype, const struct action *paction, enum effect_type effect_type)
static bool is_server(void)
enum unit_activity Activity_type_id
#define IDENTITY_NUMBER_ZERO
#define PL_(String1, String2, n)
struct unit * game_unit_by_number(int id)
struct city * game_city_by_number(int id)
#define GAME_UNIT_BRIBE_DIST_MAX
#define GAME_TRANSPORT_MAX_RECURSIVE
struct impr_type * improvement_by_number(const Impr_type_id id)
static bool iterator_valid(const struct iterator *it)
static void iterator_next(struct iterator *it)
#define fc_assert_msg(condition, message,...)
#define fc_assert_ret(condition)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define log_error(message,...)
#define fc_assert_ret_val_msg(condition, val, message,...)
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
bool same_pos(const struct tile *tile1, const struct tile *tile2)
bool map_untrusted_dir_is_valid(enum direction8 dir)
enum direction8 rand_direction(void)
int map_distance(const struct tile *tile0, const struct tile *tile1)
#define square_iterate(nmap, center_tile, radius, tile_itr)
#define square_iterate_end
#define fc_calloc(n, esz)
const char * move_points_text(int mp, bool reduce)
bool can_exist_at_tile(const struct civ_map *nmap, const struct unit_type *utype, const struct tile *ptile)
bool can_unit_exist_at_tile(const struct civ_map *nmap, const struct unit *punit, const struct tile *ptile)
bool is_native_tile(const struct unit_type *punittype, const struct tile *ptile)
bool can_unit_transport(const struct unit *transporter, const struct unit *transported)
int unit_move_rate(const struct unit *punit)
bool can_unit_survive_at_tile(const struct civ_map *nmap, const struct unit *punit, const struct tile *ptile)
bool is_native_near_tile(const struct civ_map *nmap, const struct unit_class *uclass, const struct tile *ptile)
bool can_unit_type_transport(const struct unit_type *transporter, const struct unit_class *transported)
bool can_attack_non_native(const struct unit_type *utype)
bool can_player_see_unit(const struct player *pplayer, const struct unit *punit)
bool pplayers_at_war(const struct player *pplayer, const struct player *pplayer2)
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
bool pplayers_non_attack(const struct player *pplayer, const struct player *pplayer2)
struct setting_list * level[OLEVELS_NUM]
const struct unit_list_link * links[GAME_TRANSPORT_MAX_RECURSIVE]
struct packet_ruleset_control control
struct packet_game_info info
struct civ_game::@32::@36 server
bool(* valid)(const struct iterator *it)
void *(* get)(const struct iterator *it)
void(* next)(struct iterator *it)
enum borders_mode borders
enum happyborders_type happyborders
enum airlifting_style airlifting_style
bool airlift_from_always_enabled
bool airlift_to_always_enabled
struct player_economic economic
struct unit_type::@90 adv
const struct unit_type * converted_to
enum action_decision action_decision_want
enum unit_activity activity
struct unit_list * transporting
struct extra_type * changed_from_target
struct unit::@84::@87 server
struct unit::@84::@86 client
struct extra_type * activity_target
struct act_prob * act_prob_cache
enum unit_activity changed_from
struct player * nationality
void(* removal_callback)(struct unit *punit)
void * ais[FREECIV_AI_MOD_LAST]
struct unit * transporter
struct goods_type * carrying
struct tile * action_decision_tile
const struct unit_type * utype
enum unit_focus_status focus_status
enum server_side_agent ssa_controller
int fc_snprintf(char *str, size_t n, const char *format,...)
struct advance * valid_advance_by_number(const Tech_type_id id)
#define terrain_has_flag(terr, flag)
bool tile_is_placing(const struct tile *ptile)
int tile_activity_time(enum unit_activity activity, const struct tile *ptile, const struct extra_type *tgt)
bool tile_has_native_base(const struct tile *ptile, const struct unit_type *punittype)
int tile_has_not_aggressive_extra_for_unit(const struct tile *ptile, const struct unit_type *punittype)
enum known_type tile_get_known(const struct tile *ptile, const struct player *pplayer)
struct city * tile_city(const struct tile *ptile)
#define tile_terrain(_tile)
#define tile_has_extra(ptile, pextra)
#define tile_owner(_tile)
bool can_cities_trade(const struct city *pc1, const struct city *pc2)
bool unit_can_do_action_sub_result(const struct unit *punit, enum action_sub_result sub_result)
size_t cargo_iter_sizeof(void)
bool can_unit_do_activity_targeted_at(const struct civ_map *nmap, const struct unit *punit, enum unit_activity activity, struct extra_type *target, const struct tile *ptile)
bool is_tile_activity(enum unit_activity activity)
struct unit_order * create_unit_orders(const struct civ_map *nmap, int length, const struct unit_order *orders)
enum unit_upgrade_result unit_transform_result(const struct civ_map *nmap, const struct unit *punit, const struct unit_type *to_unittype)
bool unit_type_really_ignores_zoc(const struct unit_type *punittype)
bool unit_type_is_losing_hp(const struct player *pplayer, const struct unit_type *punittype)
bool is_terrain_change_activity(enum unit_activity activity)
int unit_shield_value(const struct unit *punit, const struct unit_type *punittype, const struct action *paction)
int get_transporter_occupancy(const struct unit *ptrans)
static void cargo_iter_next(struct iterator *it)
bool can_unit_change_homecity_to(const struct civ_map *nmap, const struct unit *punit, const struct city *pcity)
void free_unit_orders(struct unit *punit)
void unit_set_ai_data(struct unit *punit, const struct ai_type *ai, void *data)
bool unit_is_alive(int id)
bool unit_can_est_trade_route_here(const struct unit *punit)
bool is_occupying_unit(const struct unit *punit)
bool is_hiding_unit(const struct unit *punit)
int get_activity_rate_this_turn(const struct unit *punit)
int unit_pays_mp_for_action(const struct action *paction, const struct unit *punit)
int get_turns_for_activity_at(const struct unit *punit, enum unit_activity activity, const struct tile *ptile, struct extra_type *tgt)
bool is_plr_zoc_client(const struct player *pplayer, const struct tile *ptile0, const struct civ_map *zmap)
bool unit_transport_load(struct unit *pcargo, struct unit *ptrans, bool force)
struct unit * transporter_for_unit_at(const struct unit *pcargo, const struct tile *ptile)
struct iterator * cargo_iter_init(struct cargo_iter *iter, const struct unit *ptrans)
enum unit_upgrade_result unit_upgrade_info(const struct civ_map *nmap, const struct unit *punit, char *buf, size_t bufsz)
int unit_transport_depth(const struct unit *pcargo)
bool is_losing_hp(const struct unit *punit)
bool is_targeted_activity(enum unit_activity activity)
bool can_unit_load(const struct unit *pcargo, const struct unit *ptrans)
bool unit_can_add_or_build_city(const struct civ_map *nmap, const struct unit *punit)
struct unit * tile_non_attack_unit(const struct tile *ptile, const struct player *pplayer)
int hp_gain_coord(const struct unit *punit)
bool can_unit_change_homecity(const struct civ_map *nmap, const struct unit *punit)
static void * cargo_iter_get(const struct iterator *it)
struct player * unit_nationality(const struct unit *punit)
bool unit_being_aggressive(const struct civ_map *nmap, const struct unit *punit)
int get_activity_rate(const struct unit *punit)
bool can_unit_deboard_or_be_unloaded(const struct civ_map *nmap, const struct unit *pcargo, const struct unit *ptrans)
bool unit_transport_check(const struct unit *pcargo, const struct unit *ptrans)
bool is_attack_unit(const struct unit *punit)
bool unit_can_airlift_to(const struct civ_map *nmap, const struct unit *punit, const struct city *pdest_city)
const Activity_type_id tile_changing_activities[]
struct unit * unit_transport_get(const struct unit *pcargo)
bool unit_transport_unload(struct unit *pcargo)
bool is_build_activity(enum unit_activity activity)
bool unit_contained_in(const struct unit *pcargo, const struct unit *ptrans)
int unit_gain_hitpoints(const struct unit *punit)
int unit_bribe_cost(const struct unit *punit, const struct player *briber, const struct unit *briber_unit)
enum unit_airlift_result test_unit_can_airlift_to(const struct civ_map *nmap, const struct player *restriction, const struct unit *punit, const struct city *pdest_city)
bool can_unit_continue_current_activity(const struct civ_map *nmap, struct unit *punit)
static void set_unit_activity_internal(struct unit *punit, enum unit_activity new_activity, enum gen_action trigger_action)
void unit_upkeep_astr(const struct unit *punit, struct astring *astr)
bool could_unit_load(const struct unit *pcargo, const struct unit *ptrans)
bool unit_is_cityfounder(const struct unit *punit)
bool is_unit_activity_on_tile(enum unit_activity activity, const struct tile *ptile)
bool is_field_unit(const struct unit *punit)
static bool cargo_iter_valid(const struct iterator *it)
bool unit_can_do_action(const struct unit *punit, const action_id act_id)
bool unit_can_do_action_result(const struct unit *punit, enum action_result result)
enum gen_action activity_default_action(enum unit_activity act)
#define RETURN_IS_ACTIVITY_ENABLED_UNIT_ON(paction)
bool is_martial_law_unit(const struct unit *punit)
struct unit * unit_virtual_create(struct player *pplayer, struct city *pcity, const struct unit_type *punittype, int veteran_level)
int unit_cargo_depth(const struct unit *ptrans)
bool can_unit_do_autoworker(const struct unit *punit)
static bool unit_transport_check_one(const struct unit_type *cargo_utype, const struct unit_type *trans_utype)
bool can_unit_teleport(const struct civ_map *nmap, const struct unit *punit)
bool unit_order_list_is_sane(const struct civ_map *nmap, int length, const struct unit_order *orders)
const char * get_activity_text(enum unit_activity activity)
bv_extras get_unit_tile_pillage_set(const struct tile *ptile)
int get_transporter_capacity(const struct unit *punit)
bool is_plr_zoc_srv(const struct player *pplayer, const struct tile *ptile0, const struct civ_map *zmap)
void set_unit_activity_targeted(struct unit *punit, enum unit_activity new_activity, struct extra_type *new_target, enum gen_action trigger_action)
bool is_enter_borders_unit(const struct unit *punit)
bool is_clean_activity(enum unit_activity activity)
bool can_unit_paradrop(const struct civ_map *nmap, const struct unit *punit)
void unit_activity_astr(const struct unit *punit, struct astring *astr)
bool unit_can_help_build_wonder_here(const struct civ_map *nmap, const struct unit *punit)
bool can_unit_do_activity(const struct civ_map *nmap, const struct unit *punit, enum unit_activity activity)
struct unit * tile_other_players_unit(const struct tile *ptile, const struct player *pplayer)
bool is_special_unit(const struct unit *punit)
void unit_virtual_destroy(struct unit *punit)
int stack_bribe_cost(const struct tile *ptile, const struct player *briber, const struct unit *briber_unit)
struct unit * tile_enemy_unit(const struct tile *ptile, const struct player *pplayer)
void unit_tile_set(struct unit *punit, struct tile *ptile)
void set_unit_activity(struct unit *punit, enum unit_activity new_activity, enum gen_action trigger_action)
enum unit_upgrade_result unit_upgrade_test(const struct civ_map *nmap, const struct unit *punit, bool is_free)
bool unit_transported(const struct unit *pcargo)
bool are_unit_orders_equal(const struct unit_order *order1, const struct unit_order *order2)
bool unit_is_virtual(const struct unit *punit)
bool is_flagless_to_player(const struct unit *punit, const struct player *pplayer)
bool is_square_threatened(const struct civ_map *nmap, const struct player *pplayer, const struct tile *ptile, bool omniscient)
bool is_guard_unit(const struct unit *punit)
bool can_unit_unload(const struct unit *pcargo, const struct unit *ptrans)
struct unit * unit_occupies_tile(const struct tile *ptile, const struct player *pplayer)
struct unit_list * unit_transport_cargo(const struct unit *ptrans)
static bool can_type_transport_units_cargo(const struct unit_type *utype, const struct unit *punit)
void * unit_ai_data(const struct unit *punit, const struct ai_type *ai)
bool unit_has_orders(const struct unit *punit)
struct unit * tile_allied_unit(const struct tile *ptile, const struct player *pplayer)
struct unit * transporter_for_unit(const struct unit *pcargo)
static struct unit * base_transporter_for_unit(const struct unit *pcargo, const struct tile *ptile, bool(*unit_load_test)(const struct unit *pc, const struct unit *pt))
bool unit_can_convert(const struct civ_map *nmap, const struct unit *punit)
bool activity_requires_target(enum unit_activity activity)
bool could_unit_be_in_transport(const struct unit *pcargo, const struct unit *ptrans)
struct unit * tile_non_allied_unit(const struct tile *ptile, const struct player *pplayer, bool everyone_non_allied)
bool can_unit_do_activity_targeted(const struct civ_map *nmap, const struct unit *punit, enum unit_activity activity, struct extra_type *target)
#define unit_transports_iterate_end
#define unit_cargo_iterate_end
#define unit_transported_server(_pcargo_)
#define unit_cargo_iterate(_ptrans, _pcargo)
#define unit_transports_iterate(_pcargo, _ptrans)
@ UU_UNSUITABLE_TRANSPORT
#define unit_transported_client(_pcargo_)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_safe(unitlist, _unit)
#define unit_list_iterate_end
#define unit_list_iterate_safe_end
const struct unit_type * unit_type_get(const struct unit *punit)
int utype_pays_mp_for_action_base(const struct action *paction, const struct unit_type *putype)
bool utype_can_freely_unload(const struct unit_type *pcargotype, const struct unit_type *ptranstype)
const char * unit_name_translation(const struct unit *punit)
bool utype_is_moved_to_tgt_by_action(const struct action *paction, const struct unit_type *utype)
bool utype_is_cityfounder(const struct unit_type *utype)
const char * unit_rule_name(const struct unit *punit)
int utype_build_shield_cost_base(const struct unit_type *punittype)
bool utype_may_act_move_frags(const struct unit_type *punit_type, const action_id act_id, const int move_fragments)
int unit_build_shield_cost_base(const struct unit *punit)
const struct unit_type * can_upgrade_unittype(const struct player *pplayer, const struct unit_type *punittype)
bool utype_can_freely_load(const struct unit_type *pcargotype, const struct unit_type *ptranstype)
int utype_veteran_levels(const struct unit_type *punittype)
struct unit_class * unit_class_get(const struct unit *punit)
bool utype_can_do_action_result(const struct unit_type *putype, enum action_result result)
const struct veteran_level * utype_veteran_level(const struct unit_type *punittype, int level)
bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag)
bool utype_is_consumed_by_action(const struct action *paction, const struct unit_type *utype)
bool utype_can_do_action_sub_result(const struct unit_type *putype, enum action_sub_result sub_result)
bool utype_is_unmoved_by_action(const struct action *paction, const struct unit_type *utype)
bool utype_acts_hostile(const struct unit_type *putype)
const char * utype_name_translation(const struct unit_type *punittype)
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
int unit_upgrade_price(const struct player *pplayer, const struct unit_type *from, const struct unit_type *to)
static bool uclass_has_flag(const struct unit_class *punitclass, enum unit_class_flag_id flag)
#define utype_fuel(ptype)
static bool utype_has_flag(const struct unit_type *punittype, int flag)