Classes | |
struct | cost_calculator |
struct | paths |
Object which contains all the possible locations a unit can move to, with associated best routes to those locations. More... | |
struct | vision_path |
A refinement of paths for use when calculating vision. More... | |
struct | jamming_path |
A refinement of paths for use when calculating jamming. More... | |
struct | plain_route |
Structure which holds a single route between one location and another. More... | |
struct | marked_route |
Structure which holds a single route and marks for special events. More... | |
struct | shortest_path_calculator |
struct | move_type_path_calculator |
struct | emergency_path_calculator |
Function which only uses terrain, ignoring shroud, enemies, etc. More... | |
struct | dummy_path_calculator |
Function which doesn't take anything into account. More... | |
struct | full_cost_map |
Structure which uses find_routes() to build a cost map This maps each hex to a the movements a unit will need to reach this hex. More... | |
class | ignore_units_display_context |
class | ignore_units_filter_context |
class | teleport_group |
class | teleport_map |
class | manager |
Typedefs | |
typedef std::pair< std::set< map_location >, std::set< map_location > > | teleport_pair |
Enumerations | |
enum | VACANT_TILE_TYPE { VACANT_CASTLE , VACANT_ANY } |
Functions | |
plain_route | a_star_search (const map_location &src, const map_location &dst, double stop_at, const cost_calculator &calc, const std::size_t width, const std::size_t height, const teleport_map *teleports, bool border) |
map_location | find_vacant_tile (const map_location &loc, VACANT_TILE_TYPE vacancy, const unit *pass_check, const team *shroud_check, const game_board *board) |
Function that will find a location on the board that is as near to loc as possible, but which is unoccupied by any units. More... | |
map_location | find_vacant_castle (const unit &leader) |
Wrapper for find_vacant_tile() when looking for a vacant castle tile near a leader. More... | |
bool | enemy_zoc (const team ¤t_team, const map_location &loc, const team &viewing_team, bool see_all) |
Determines if a given location is in an enemy zone of control. More... | |
static void | find_routes (const map_location &origin, const movetype::terrain_costs &costs, bool slowed, int moves_left, int max_moves, int turns_left, paths::dest_vect &destinations, std::set< map_location > *edges, const unit *teleporter, const team *current_team, const unit *skirmisher, const team *viewing_team, const std::map< map_location, int > *jamming_map=nullptr, std::vector< std::pair< int, int >> *full_cost_map=nullptr, bool check_vision=false) |
Creates a list of routes that a unit can traverse from the provided location. More... | |
static bool | step_compare (const paths::step &a, const map_location &b) |
marked_route | mark_route (const plain_route &rt, bool update_move_cost=false) |
Add marks on a route rt assuming that the unit located at the first hex of rt travels along it. More... | |
const teleport_map | get_teleport_locations (const unit &u, const team &viewing_team, bool see_all, bool ignore_units, bool check_vision) |
typedef std::pair<std::set<map_location>, std::set<map_location> > pathfind::teleport_pair |
Definition at line 32 of file teleport.hpp.
Enumerator | |
---|---|
VACANT_CASTLE | |
VACANT_ANY |
Definition at line 39 of file pathfind.hpp.
plain_route pathfind::a_star_search | ( | const map_location & | src, |
const map_location & | dst, | ||
double | stop_at, | ||
const cost_calculator & | calc, | ||
const std::size_t | width, | ||
const std::size_t | height, | ||
const teleport_map * | teleports, | ||
bool | border | ||
) |
Definition at line 129 of file astarsearch.cpp.
References border, pathfind::cost_calculator::cost(), curr, DBG_PF, dst, pathfind::teleport_map::empty(), get_adjacent_tiles(), pathfind::teleport_map::get_adjacents(), pathfind::teleport_map::get_targets(), pathfind::cost_calculator::getNoPathValue(), i, utf8::index(), LOG_PF, pathfind::plain_route::move_cost, n, nodes, map_location::null_location(), src, srch, pathfind::plain_route::steps, and map_location::valid().
Referenced by ai::ai_default_rca::move_to_targets_phase::access_points(), wb::move::calculate_new_route(), game_state::can_recruit_on(), ai::ai_default_rca::move_to_targets_phase::choose_move(), default_map_generator_job::default_generate_map(), ai::ai_default_rca::goto_phase::evaluate(), ai::ai_default_rca::move_leader_to_goals_phase::evaluate(), ai::ai_default_rca::move_leader_to_keep_phase::evaluate(), events::mouse_handler::get_route(), game_lua_kernel::intf_find_path(), intf_find_path(), cave_map_generator::cave_map_generator_job::place_passage(), ai::formula_ai::shortest_path_calculator(), and ai::move_result::test_route().
bool pathfind::enemy_zoc | ( | const team & | current_team, |
const map_location & | loc, | ||
const team & | viewing_team, | ||
bool | see_all | ||
) |
Determines if a given location is in an enemy zone of control.
current_team | The moving team (only ZoC of enemies of this team are considered). |
loc | The location to check. |
viewing_team | Only units visible to this team are considered. |
see_all | If true, all units are considered (and viewing_team is ignored). |
Definition at line 134 of file pathfind.cpp.
References unit::emits_zoc(), resources::gameboard, get_adjacent_tiles(), game_board::get_visible_unit(), team::is_enemy(), and unit::side().
Referenced by pathfind::shortest_path_calculator::cost(), find_routes(), mark_route(), and wb::path_cost().
|
static |
Creates a list of routes that a unit can traverse from the provided location.
(This is called when creating pathfind::paths and descendant classes.)
[in] | origin | The location at which to begin the routes. |
[in] | costs | The costs to use for route finding. |
[in] | slowed | Whether or not to use the slowed costs. |
[in] | moves_left | The number of movement points left for the current turn. |
[in] | max_moves | The number of movement points in each future turn. |
[in] | turns_left | The number of future turns of movement to calculate. |
[out] | destinations | The traversable routes. |
[out] | edges | The hexes (possibly off-map) adjacent to those in destinations. (It is permissible for this to contain some hexes that are also in destinations.) |
[in] | teleporter | If not nullptr, teleportation will be considered, using this unit's abilities. |
[in] | current_team | If not nullptr, enemies of this team can obstruct routes both by occupying hexes and by exerting zones of control. In addition, the presence of units can affect teleportation options. |
[in] | skirmisher | If not nullptr, use this to determine where ZoC can and cannot be ignored (due to this unit having or not having the skirmisher ability). If nullptr, then ignore all zones of control. (No effect if current_team is nullptr). |
[in] | viewing_team | If not nullptr, use this team's vision when detecting enemy units and teleport destinations. If nullptr, then "see all". (No effect if teleporter and current_team are both nullptr.) |
[in] | jamming_map | The relevant "jamming" of the costs being used (currently only used with vision costs). |
[out] | full_cost_map | If not nullptr, build a cost_map instead of destinations. Destinations is ignored. full_cost_map is a vector of pairs. The first entry is the cost itself, the second how many units already visited this hex |
[in] | check_vision | If true, use vision check for teleports, that is, ignore units potentially blocking the teleport exit |
Definition at line 270 of file pathfind.cpp.
References movetype::terrain_costs::cost(), enemy_zoc(), resources::gameboard, unit::get_ability_bool(), get_adjacent_tiles(), pathfind::teleport_map::get_adjacents(), get_teleport_locations(), game_board::get_visible_unit(), gamemap_base::h(), i, utf8::index(), team::is_enemy(), game_board::map(), moves_left, n, nodes, map_location::null_location(), s, team::shrouded(), unit::side(), game_config::sounds::status::slowed, game_board::teams(), turns_left, gamemap_base::w(), map_location::x, and map_location::y.
Referenced by pathfind::full_cost_map::add_unit(), pathfind::jamming_path::jamming_path(), pathfind::paths::paths(), and pathfind::vision_path::vision_path().
map_location pathfind::find_vacant_castle | ( | const unit & | leader | ) |
Wrapper for find_vacant_tile() when looking for a vacant castle tile near a leader.
If no valid location can be found, it will return a null location.
Definition at line 117 of file pathfind.cpp.
References find_vacant_tile(), resources::gameboard, unit::get_location(), game_board::get_team(), unit::side(), and VACANT_CASTLE.
Referenced by ai::default_recruitment::recruitment::evaluate(), ai::ai_default_rca::leader_shares_keep_phase::execute(), and ai::default_recruitment::recruitment::execute().
map_location pathfind::find_vacant_tile | ( | const map_location & | loc, |
VACANT_TILE_TYPE | vacancy, | ||
const unit * | pass_check, | ||
const team * | shroud_check, | ||
const game_board * | board | ||
) |
Function that will find a location on the board that is as near to loc as possible, but which is unoccupied by any units.
If no valid location can be found, it will return a null location. If pass_check is provided, the found location must have a terrain that this unit can enter. If shroud_check is provided, only locations not covered by this team's shroud will be considered.
Definition at line 54 of file pathfind.cpp.
References unit_map::end(), unit_map::find(), resources::gameboard, get_adjacent_tiles(), gamemap::is_castle(), game_board::map(), unit::movement_cost(), gamemap_base::on_board(), team::shrouded(), game_board::units(), movetype::UNREACHABLE, team::uses_shroud(), and VACANT_CASTLE.
Referenced by game_state::can_recruit_from(), unit_creator::find_location(), find_vacant_castle(), game_lua_kernel::intf_find_vacant_tile(), game_lua_kernel::intf_teleport(), and game_events::WML_HANDLER_FUNCTION().
const teleport_map pathfind::get_teleport_locations | ( | const unit & | u, |
const team & | viewing_team, | ||
bool | see_all, | ||
bool | ignore_units, | ||
bool | check_vision | ||
) |
Definition at line 251 of file teleport.cpp.
References pathfind::manager::get(), unit::get_abilities(), i, and resources::tunnels.
Referenced by ai::ai_default_rca::move_to_targets_phase::access_points(), ai::ai_default_rca::move_to_targets_phase::choose_move(), ai::ai_default_rca::goto_phase::evaluate(), ai::ai_default_rca::move_leader_to_goals_phase::evaluate(), ai::ai_default_rca::move_leader_to_keep_phase::evaluate(), find_routes(), ai::formula_ai::get_allowed_teleports(), events::mouse_handler::get_route(), game_lua_kernel::intf_find_path(), and ai::move_result::test_route().
marked_route pathfind::mark_route | ( | const plain_route & | rt, |
bool | update_move_cost | ||
) |
Add marks on a route rt assuming that the unit located at the first hex of rt travels along it.
Definition at line 658 of file pathfind.cpp.
References enemy_zoc(), unit_map::find(), team::fogged(), resources::gameboard, unit::get_ability_bool(), display::get_singleton(), game_board::get_team(), i, unit::invisible(), team::is_enemy(), gamemap::is_village(), game_board::map(), mark, pathfind::marked_route::marks, pathfind::marked_route::move_cost, unit::movement_cost(), unit::movement_left(), team::owns_village(), pathfind::marked_route::route, unit::side(), pathfind::plain_route::steps, unit::total_movement(), game_board::units(), and display::viewing_team().
Referenced by wb::move::apply_temp_modifier(), wb::move::calculate_new_route(), wb::move::check_validity(), wb::move::execute(), and events::mouse_handler::get_route().
|
static |
Definition at line 474 of file pathfind.cpp.
References b, and pathfind::paths::step::curr.
Referenced by pathfind::paths::dest_vect::find(), and pathfind::paths::dest_vect::insert().