43#define LOG_GOTO_PATH LOG_DEBUG
44#define log_goto_path log_debug
45#define log_goto_packet log_debug
75#define SPECLIST_TAG goto_map
76#define SPECLIST_TYPE struct goto_map
78#define goto_map_list_iterate(gotolist, pgoto) \
79 TYPED_LIST_ITERATE(struct goto_map, gotolist, pgoto)
80#define goto_map_list_iterate_end \
84#define goto_map_unit_iterate(gotolist, pgoto, punit) \
85 goto_map_list_iterate(gotolist, pgoto) { \
86 struct unit *punit = goto_map_unit(pgoto);
88#define goto_map_unit_iterate_end \
89 } goto_map_list_iterate_end;
98 const struct part *p);
270 log_debug(
"update_last_part(%d,%d) old (%d,%d)-(%d,%d)",
282 log_error(
"No path found to reach the start point.");
322 if (return_path ==
NULL) {
330 log_error(
"No path found to reach the start point.");
409 const struct part *p)
612 const struct player *pplayer)
668 const struct tile *ptile)
689 const struct tile *dest_tile,
743 total_cost += moves_left;
757 total_cost += moves_left;
769 if (
proad->move_cost > 0) {
787 return (
proad->move_cost > 0 ?
800 const struct tile *dest_tile,
837 total_cost += moves_left;
851 total_cost += moves_left;
980 "Path finding during target selection");
990 "Goto with HOVER_PARADROP?");
992 "Goto with HOVER_ACT_SEL_TGT?");
1098 if (!moved && path->
length > 1) {
1145 int *turns,
bool *waypoint)
1188 for (j = 0; j < path->
length; j++) {
1190 if (!moved && j > 0) {
1193 if (
pos->tile != ptile) {
1200 }
else if (
pos->moves_left == 0) {
1261 for (j = 0; j < path->
length; j++) {
1265 &&
pos->tile == ptile) {
1268 if (
pos->moves_left == 0 &&
last_pos->moves_left != 0
1269 &&
pos->tile == ptile) {
1272 if (
pos->tile == ptile
1274 && (
pos->moves_left == 0
1290 for (j = 0; j < path->
length; j++) {
1292 if (
pos->tile == ptile
1294 && (
pos->moves_left == 0
1330 return (*turns != -1 || *waypoint);
1341 if (
NULL == dest_tile) {
1396 "Unit %d has moved without goto cancellation.",
1401 *length = path->
length - 1;
1406 for (
i = 0;
i < path->
length - 1;
i++) {
1449 log_verbose(
"unit or city blocks the path of your %s",
1475 bool repeat,
bool vigilant,
1485 memset(&p, 0,
sizeof(p));
1513 memset(&p, 0,
sizeof(p));
1729 memset(&p, 0,
sizeof(p));
1763 log_error(
"Invalid connect activity: %d.", activity);
bool action_id_exists(const action_id act_id)
#define action_id_distance_accepted(act_id, distance)
#define action_id_has_result_safe(act_id, result)
#define BV_ISSET(bv, bit)
int city_production_unit_veteran_level(struct city *pcity, const struct unit_type *punittype)
static bool is_non_allied_city_tile(const struct tile *ptile, const struct player *pplayer)
static bool is_allied_city_tile(const struct tile *ptile, const struct player *pplayer)
bool can_client_issue_orders(void)
bool unit_is_in_focus(const struct unit *punit)
enum unit_orders goto_last_order
int check_recursive_road_connect(struct tile *ptile, const struct extra_type *pextra, const struct unit *punit, const struct player *pplayer, int rec)
struct extra_type * connect_tgt
struct unit_list * get_units_in_focus(void)
void request_unit_ssa_set(const struct unit *punit, enum server_side_agent agent)
enum unit_activity connect_activity
enum cursor_hover_state hover_state
void clear_unit_orders(struct unit *punit)
action_id goto_last_action
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
static bool is_non_allied_city_adjacent(const struct player *pplayer, const struct tile *ptile)
static int get_connect_irrig(const struct tile *src_tile, enum direction8 dir, const struct tile *dest_tile, int src_cost, int src_extra, unsigned *dest_cost, unsigned *dest_extra, const struct pf_parameter *param)
static void fill_parameter_part(struct pf_parameter *param, const struct goto_map *goto_map, const struct part *p)
#define goto_map_list_iterate_end
static int get_connect_road(const struct tile *src_tile, enum direction8 dir, const struct tile *dest_tile, int src_cost, int src_extra, unsigned *dest_cost, unsigned *dest_extra, const struct pf_parameter *param)
static void make_path_orders(struct unit *punit, struct pf_path *path, enum unit_orders orders, struct unit_order *final_order, struct unit_order *order_list, int *length, int *dest_tile)
static void goto_path_undraw(const struct pf_path *path)
static enum tile_behavior no_fights_or_unknown_goto(const struct tile *ptile, enum known_type known, const struct pf_parameter *p)
static bool order_recursive_roads(struct tile *ptile, struct extra_type *pextra, struct packet_unit_orders *p, int rec)
static void goto_fill_parameter_full(struct goto_map *goto_map, const struct unit *punit)
static struct tile * goto_destination
static unsigned get_EC(const struct tile *ptile, enum known_type known, const struct pf_parameter *param)
static enum tile_behavior get_TB_caravan(const struct tile *ptile, enum known_type known, const struct pf_parameter *param)
void exit_goto_state(void)
struct tile * tile_before_end_path(struct unit *punit, struct tile *ptile)
bool goto_is_active(void)
bool send_attack_tile(struct unit *punit, struct tile *ptile)
struct pf_path * path_to_nearest_allied_city(struct unit *punit)
static struct goto_map_list * goto_maps
static void goto_fill_parameter_base(struct pf_parameter *parameter, const struct unit *punit)
void init_client_goto(void)
#define goto_map_unit_iterate_end
void send_patrol_route(void)
bool send_rally_tile(struct city *pcity, struct tile *ptile, bool persistent)
static bool order_wants_direction(enum unit_orders order, action_id act_id, struct tile *tgt_tile)
static void remove_last_part(struct goto_map *goto_map)
static void send_rally_path_orders(struct city *pcity, struct unit *punit, struct pf_path *path, bool vigilant, bool persistent, enum unit_orders orders, struct unit_order *final_order)
bool is_valid_goto_draw_line(struct tile *dest_tile)
static void send_path_orders(struct unit *punit, struct pf_path *path, bool repeat, bool vigilant, enum unit_orders orders, struct unit_order *final_order)
static struct goto_map * goto_map_new(struct unit *punit)
static bool update_last_part(struct goto_map *goto_map, struct tile *ptile)
static enum tile_behavior get_TB_aggr(const struct tile *ptile, enum known_type known, const struct pf_parameter *param)
#define goto_map_list_iterate(gotolist, pgoto)
static void reset_last_part(struct goto_map *goto_map)
#define goto_map_unit_iterate(gotolist, pgoto, punit)
bool goto_add_waypoint(void)
bool send_goto_tile(struct unit *punit, struct tile *ptile)
static struct unit * goto_map_unit(const struct goto_map *goto_map)
bool goto_pop_waypoint(void)
void send_connect_route(enum unit_activity activity, struct extra_type *tgt)
void goto_unit_killed(struct unit *punit)
void free_client_goto(void)
void enter_goto_state(struct unit_list *punits)
void send_goto_route(void)
bool is_valid_goto_destination(const struct tile *ptile)
static void goto_path_redraw(const struct pf_path *new_path, const struct pf_path *old_path)
bool goto_get_turns(int *min, int *max)
static int get_activity_time(const struct tile *ptile, const struct player *pplayer)
static void goto_map_free(struct goto_map *goto_map)
void request_orders_cleared(struct unit *punit)
static void send_rally_path(struct city *pcity, struct unit *punit, bool persistent, struct pf_path *path, struct unit_order *final_order)
static bool order_demands_direction(enum unit_orders order, action_id act_id)
void send_goto_path(struct unit *punit, struct pf_path *path, struct unit_order *final_order)
static void add_part(struct goto_map *goto_map)
void update_unit_info_label(struct unit_list *punits)
static GtkWidget * persistent
#define fc_assert_msg(condition, message,...)
#define fc_assert_ret(condition)
#define log_verbose(message,...)
#define fc_assert(condition)
#define fc_assert_ret_msg(condition, message,...)
#define fc_assert_ret_val(condition, val)
#define log_debug(message,...)
#define log_error(message,...)
int get_direction_for_step(const struct civ_map *nmap, const struct tile *start_tile, const struct tile *end_tile)
const char * dir_get_name(enum direction8 dir)
bool is_cardinal_dir(enum direction8 dir)
bool same_pos(const struct tile *tile1, const struct tile *tile2)
bool is_valid_dir(enum direction8 dir)
#define adjc_iterate(nmap, center_tile, itr_tile)
void cancel_selection_rectangle(void)
void mapdeco_add_gotoline(const struct tile *ptile, enum direction8 dir)
void refresh_tile_mapcanvas(struct tile *ptile, bool full_refresh, bool write_to_screen)
void mapdeco_remove_gotoline(const struct tile *ptile, enum direction8 dir)
#define fc_realloc(ptr, sz)
bool can_exist_at_tile(const struct civ_map *nmap, const struct unit_type *utype, const struct tile *ptile)
struct client_options gui_options
int send_packet_city_rally_point(struct connection *pc, const struct packet_city_rally_point *packet, bool force_to_send)
int send_packet_unit_orders(struct connection *pc, const struct packet_unit_orders *packet)
struct pf_path * pf_path_concat(struct pf_path *dest_path, const struct pf_path *src_path)
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)
struct pf_map * pf_map_new(const struct pf_parameter *parameter)
struct pf_path * pf_map_path(struct pf_map *pfm, struct tile *ptile)
void pf_map_destroy(struct pf_map *pfm)
#define pf_path_print(path, level)
#define pf_map_tiles_iterate(ARG_pfm, NAME_tile, COND_from_start)
#define pf_map_tiles_iterate_end
struct unit * player_unit_by_number(const struct player *pplayer, int unit_id)
struct universal production
bool popup_last_move_to_allied
struct goto_map::@134::@137 patrol
struct pf_path * return_path
struct goto_map::@134::@136 connect
struct pf_parameter template
struct unit_order orders[MAX_LEN_ROUTE]
struct unit_order orders[MAX_LEN_ROUTE]
const struct unit_type * transported_by_initially
enum tile_behavior(* get_TB)(const struct tile *ptile, enum known_type known, const struct pf_parameter *param)
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)
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
struct pf_position * positions
enum unit_activity activity
struct unit * transporter
void tile_virtual_destroy(struct tile *vtile)
bool tile_has_road(const struct tile *ptile, const struct road_type *proad)
struct tile * tile_virtual_new(const struct tile *ptile)
enum known_type tile_get_known(const struct tile *ptile, const struct player *pplayer)
#define tile_terrain(_tile)
#define tile_has_extra(ptile, pextra)
const struct unit_type * utype
struct unit * transporter_for_unit_at(const struct unit *pcargo, const struct tile *ptile)
int get_activity_rate(const struct unit *punit)
struct unit * unit_virtual_create(struct player *pplayer, struct city *pcity, const struct unit_type *punittype, int veteran_level)
void unit_virtual_destroy(struct unit *punit)
static bool is_allied_unit_tile(const struct tile *ptile, const struct player *pplayer)
static bool is_non_allied_unit_tile(const struct tile *ptile, const struct player *pplayer)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
const struct unit_type * unit_type_get(const struct unit *punit)
const char * unit_rule_name(const struct unit *punit)
bool utype_may_act_at_all(const struct unit_type *putype)
bool utype_acts_hostile(const struct unit_type *putype)
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)