64 }
else if (
game.
info.unreachable_protects) {
84 bool non_allied_city =
87 if (non_allied_city) {
167 const struct unit *ptrans,
183 && (cargo_utype == trans_utype
204 && (cargo_utype == trans_utype
251 bool allied_city_tile =
256 *can_disembark =
false;
268 *can_disembark =
true;
279 *can_disembark =
true;
298 int land_scope, sea_scope;
326 const struct tile *dst,
386 const struct tile *ptile1,
444 }
else if (ferry_move && amphibious->
sea.
get_EC) {
446 cost = amphibious->
sea.
get_EC(ptile, known, &hibious->
sea);
448 }
else if (!ferry_move && amphibious->land.get_EC) {
450 cost = amphibious->land.get_EC(ptile, known, &hibious->land);
522 if (ferry_move && amphibious->
sea.
get_TB) {
523 return amphibious->
sea.
get_TB(ptile, known, &hibious->
sea);
524 }
else if (!ferry_move && amphibious->land.get_TB) {
525 return amphibious->land.get_TB(ptile, known, &hibious->land);
652 }
else if (!ferry_move && amphibious->land.is_pos_dangerous) {
653 return amphibious->land.is_pos_dangerous(ptile, known, param);
668 parameter->
get_TB =
nullptr;
669 parameter->
get_EC =
nullptr;
679 parameter->
utype = punittype;
718 struct tile *pstart_tile,
struct player *powner)
743 parameter->
owner = powner;
753 const struct unit *punit)
811 struct tile *pstart_tile,
823 const struct unit *punit)
859 struct tile *pstart_tile,
872 const struct unit *punit)
914 const struct unit *punit)
924 struct tile *target_tile)
926 memset(parameter, 0,
sizeof(*parameter));
939 parameter->
data = target_tile;
971 if (
nullptr != parameter->land.is_pos_dangerous
980 }
else if (parameter->land.get_moves_left_req !=
nullptr) {
982 parameter->land.get_moves_left_req;
bool aia_utype_is_considered_caravan_trade(const struct unit_type *putype)
Returns TRUE if the specified unit type is able to perform trade caravan actions.
bool aia_utype_is_considered_spy(const struct unit_type *putype)
Returns TRUE if the specified unit type is able to perform diplomatic actions.
bool BV_ISSET(const BV &bv, int bit)
struct city * is_non_allied_city_tile(const struct tile *ptile, const struct player *pplayer)
Is there an non_allied city on this tile?
struct player * city_owner(const struct city *pcity)
Return the owner of the city.
struct city * is_allied_city_tile(const struct tile *ptile, const struct player *pplayer)
Is there an friendly city on this tile?
int get_unittype_bonus(const struct player *pplayer, const struct tile *ptile, const struct unit_type *punittype, enum effect_type effect_type, enum vision_layer vision_layer)
Returns the effect bonus that applies at a tile for a given unittype.
#define GAME_TRANSPORT_MAX_RECURSIVE
#define fc_assert(condition)
bool is_safe_ocean(const struct civ_map *nmap, const struct tile *ptile)
Return TRUE if this ocean terrain is adjacent to a safe coastline.
int map_vector_to_real_distance(int dx, int dy)
Return the "real" distance for a given vector.
#define iterate_outward_dxy_end
#define iterate_outward_dxy(nmap, start_tile, max_dist, _tile, _x, _y)
static int map_move_cost(const struct civ_map *nmap, const struct player *pplayer, const struct unit_type *punittype, const struct tile *src_tile, const struct tile *dst_tile)
bool is_city_channel_tile(const struct unit_class *punitclass, const struct tile *ptile, const struct tile *pexclude)
Check for a city channel.
bool is_native_tile(const struct unit_type *punittype, const struct tile *ptile)
This tile is native to unit.
int unit_move_rate(const struct unit *punit)
This function calculates the move rate of the unit.
bool can_attack_from_non_native(const struct unit_type *utype)
This unit can attack from non-native tiles (Marines can attack from transport, ships from harbour cit...
int utype_move_rate(const struct unit_type *utype, const struct tile *ptile, const struct player *pplayer, int veteran_level, int hitpoints)
This function calculates the move rate of the unit, taking into account the penalty for reduced hitpo...
bool is_native_near_tile(const struct civ_map *nmap, const struct unit_class *uclass, const struct tile *ptile)
Is there native tile adjacent to given tile.
bool can_unit_type_transport(const struct unit_type *transporter, const struct unit_class *transported)
Return TRUE iff transporter type has ability to transport transported class.
bool is_native_move(const struct unit_class *punitclass, const struct tile *src_tile, const struct tile *dst_tile)
Is the move under consideration a native move? Note that this function does not check for possible mo...
bool can_attack_non_native(const struct unit_type *utype)
This unit can attack non-native tiles (eg.
static bool is_native_tile_to_class(const struct unit_class *punitclass, const struct tile *ptile)
bool pplayers_at_war(const struct player *pplayer, const struct player *pplayer2)
Returns true iff players can attack each other.
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
Returns true iff players are allied.
struct packet_game_info info
const struct unit_type * transported_by_initially
enum pf_action(* get_action)(const struct tile *ptile, enum known_type known, const struct pf_parameter *param)
enum pf_move_scope(* get_move_scope)(const struct tile *ptile, bool *can_disembark, enum pf_move_scope previous_scope, const struct pf_parameter *param)
const struct civ_map * map
enum tile_behavior(* get_TB)(const struct tile *ptile, enum known_type known, const struct pf_parameter *param)
int(* get_EC)(const struct tile *ptile, enum known_type known, const struct pf_parameter *param)
enum pf_action_account actions
const struct player * owner
bool(* is_pos_dangerous)(const struct tile *ptile, enum known_type, const struct pf_parameter *param)
int(* get_moves_left_req)(const struct tile *ptile, enum known_type, const struct pf_parameter *param)
bool(* get_zoc)(const struct player *pplayer, const struct tile *ptile, const struct civ_map *zmap)
int(* get_MC)(const struct tile *from_tile, enum pf_move_scope src_move_scope, const struct tile *to_tile, enum pf_move_scope dst_move_scope, const struct pf_parameter *param)
int(* get_costs)(const struct tile *from_tile, enum direction8 dir, const struct tile *to_tile, int from_cost, int from_extra, int *to_cost, int *to_extra, const struct pf_parameter *param)
const struct unit_type * utype
bool(* is_action_possible)(const struct tile *from_tile, enum pf_move_scope src_move_scope, const struct tile *to_tile, enum pf_action action, const struct pf_parameter *param)
bv_unit_types cargo_types
struct pf_parameter combined
struct pf_parameter land sea
struct unit_class::@81 cache
struct extra_type_list * refuel_bases
bool tile_has_native_base(const struct tile *ptile, const struct unit_type *punittype)
Check if tile contains base native for unit.
enum known_type tile_get_known(const struct tile *ptile, const struct player *pplayer)
Return a known_type enumeration value for the tile.
struct city * tile_city(const struct tile *ptile)
Return the city on this tile (or nullptr), checking for city center.
#define tile_has_extra(ptile, pextra)
bool unit_type_really_ignores_zoc(const struct unit_type *punittype)
Takes into account unit class flag UCF_ZOC as well as IGZOC.
bool is_my_zoc(const struct player *pplayer, const struct tile *ptile0, const struct civ_map *zmap)
Is this square controlled by the pplayer?
int unit_transport_depth(const struct unit *pcargo)
Returns the number of unit transport layers which carry unit 'pcargo'.
struct unit * is_non_allied_unit_tile(const struct tile *ptile, const struct player *pplayer)
Is there an non-allied unit on this tile?
struct unit * unit_transport_get(const struct unit *pcargo)
Returns the transporter of the unit or nullptr if it is not transported.
int unit_cargo_depth(const struct unit *ptrans)
Returns the number of unit cargo layers within transport 'ptrans'.
bool unit_has_orders(const struct unit *punit)
Return TRUE iff the unit is following client-side orders.
#define unit_transports_iterate_end
#define unit_cargo_iterate_end
#define unit_cargo_iterate(_ptrans, _pcargo)
#define unit_transports_iterate(_pcargo, _ptrans)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
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...
const struct unit_type * unit_type_get(const struct unit *punit)
Return the unit type for this unit.
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 transpo...
bool utype_may_act_at_all(const struct unit_type *putype)
Return TRUE iff units of this type can do actions controlled by generalized (ruleset defined) action ...
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 transport...
struct unit_class * unit_class_get(const struct unit *punit)
Returns unit class pointer for a unit.
int utype_veteran_levels(const struct unit_type *punittype)
Return veteran levels of the given unit type.
Unit_type_id utype_index(const struct unit_type *punittype)
Return the unit type index.
bool utype_can_take_over(const struct unit_type *punittype)
Return whether the unit type can take over enemy cities.
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)
#define unit_type_iterate(_p)
#define uclass_index(_c_)
#define unit_type_iterate_end