13#ifndef FC__PATH_FINDING_H
14#define FC__PATH_FINDING_H
266#define PF_IMPOSSIBLE_MC -1
272#define PF_TURN_FACTOR 65536
518#define pf_path_print(path, level) \
519 if (log_do_output_for_level(level)) { \
520 pf_path_print_real(path, level, __FILE__, __FUNCTION__, __FC_LINE__); \
526 const struct player *pplayer,
527 struct tile *start_tile,
532 const struct player *attacker,
560#define pf_map_tiles_iterate(ARG_pfm, NAME_tile, COND_from_start) \
561if (COND_from_start || pf_map_iterate((ARG_pfm))) { \
562 struct pf_map *_MY_pf_map_ = (ARG_pfm); \
563 struct tile *NAME_tile; \
565 NAME_tile = pf_map_iter(_MY_pf_map_);
567#define pf_map_tiles_iterate_end \
568 } while (pf_map_iterate(_MY_pf_map_)); \
581#define pf_map_move_costs_iterate(ARG_pfm, NAME_tile, NAME_cost, \
583if (COND_from_start || pf_map_iterate((ARG_pfm))) { \
584 struct pf_map *_MY_pf_map_ = (ARG_pfm); \
585 struct tile *NAME_tile; \
588 NAME_tile = pf_map_iter(_MY_pf_map_); \
589 NAME_cost = pf_map_iter_move_cost(_MY_pf_map_);
591#define pf_map_move_costs_iterate_end \
592 } while (pf_map_iterate(_MY_pf_map_)); \
604#define pf_map_positions_iterate(ARG_pfm, NAME_pos, COND_from_start) \
605if (COND_from_start || pf_map_iterate((ARG_pfm))) { \
606 struct pf_map *_MY_pf_map_ = (ARG_pfm); \
607 struct pf_position NAME_pos; \
609 pf_map_iter_position(_MY_pf_map_, &NAME_pos);
611#define pf_map_positions_iterate_end \
612 } while (pf_map_iterate(_MY_pf_map_)); \
624#define pf_map_paths_iterate(ARG_pfm, NAME_path, COND_from_start) \
625if (COND_from_start || pf_map_iterate((ARG_pfm))) { \
626 struct pf_map *_MY_pf_map_ = (ARG_pfm); \
627 struct pf_path *NAME_path;\
629 NAME_path = pf_map_iter_path(_MY_pf_map_);
631#define pf_map_paths_iterate_end \
632 } while (pf_map_iterate(_MY_pf_map_)); \
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
bool pf_reverse_map_unit_position(struct pf_reverse_map *pfrm, const struct unit *punit, struct pf_position *pos)
struct pf_path * pf_path_concat(struct pf_path *dest_path, const struct pf_path *src_path)
bool pf_map_position(struct pf_map *pfm, struct tile *ptile, struct pf_position *pos) fc__warn_unused_result
const struct pf_parameter * pf_map_parameter(const struct pf_map *pfm)
void pf_path_print_real(const struct pf_path *path, enum log_level level, const char *file, const char *function, int line)
struct pf_path * pf_map_path(struct pf_map *pfm, struct tile *ptile) fc__warn_unused_result
const struct pf_position * pf_path_last_position(const struct pf_path *path)
void pf_path_destroy(struct pf_path *path)
bool pf_path_backtrack(struct pf_path *path, struct tile *ptile)
bool pf_map_iterate(struct pf_map *pfm)
void pf_map_iter_position(struct pf_map *pfm, struct pf_position *pos)
int pf_map_iter_move_cost(struct pf_map *pfm)
struct pf_reverse_map * pf_reverse_map_new(const struct civ_map *nmap, const struct player *pplayer, struct tile *start_tile, int max_turns, bool omniscient) fc__warn_unused_result
struct pf_map * pf_map_new(const struct pf_parameter *parameter) fc__warn_unused_result
struct pf_reverse_map * pf_reverse_map_new_for_city(const struct civ_map *nmap, const struct city *pcity, const struct player *attacker, int max_turns, bool omniscient) fc__warn_unused_result
void pf_reverse_map_destroy(struct pf_reverse_map *prfm)
int pf_reverse_map_unit_move_cost(struct pf_reverse_map *pfrm, const struct unit *punit)
void pf_map_destroy(struct pf_map *pfm)
struct tile * pf_map_iter(struct pf_map *pfm)
struct pf_path * pf_map_iter_path(struct pf_map *pfm) fc__warn_unused_result
int pf_map_move_cost(struct pf_map *pfm, struct tile *ptile)
bool pf_path_advance(struct pf_path *path, struct tile *ptile)
int pf_reverse_map_utype_move_cost(struct pf_reverse_map *pfrm, const struct unit_type *punittype, struct tile *ptile)
bool pf_reverse_map_utype_position(struct pf_reverse_map *pfrm, const struct unit_type *punittype, struct tile *ptile, struct pf_position *pos)
struct setting_list * level[OLEVELS_NUM]
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)
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)
unsigned(* 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, unsigned *to_cost, unsigned *to_extra, const struct pf_parameter *param)
unsigned(* get_EC)(const struct tile *ptile, enum known_type known, 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_position * positions
enum direction8 dir_to_here
enum direction8 dir_to_next_pos
#define fc__warn_unused_result