The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Functions
pathutils.cpp File Reference

Various pathfinding functions and utilities. More...

#include "global.hpp"
#include "pathutils.hpp"
#include "map/map.hpp"
Include dependency graph for pathutils.cpp:

Go to the source code of this file.

Functions

void get_tile_ring (const map_location &center, const int radius, std::vector< map_location > &result)
 Function that will add to result all locations exactly radius tiles from center (or nothing if radius is not positive). More...
 
void get_tiles_in_radius (const map_location &center, const int radius, std::vector< map_location > &result)
 Function that will add to result all locations within radius tiles of center (excluding center itself). More...
 
void get_tiles_radius (const map_location &center, size_t radius, std::set< map_location > &result)
 Function that will add to result all locations within radius tiles of center (including center itself). More...
 
void get_tiles_radius (const gamemap &map, const std::vector< map_location > &locs, size_t radius, std::set< map_location > &result, bool with_border)
 Function that will add to result all elements of locs, plus all on-board locations that are within radius tiles of an element of locs. More...
 
void get_tiles_radius (gamemap const &map, std::vector< map_location > const &locs, size_t radius, std::set< map_location > &result, bool with_border, xy_pred const &pred)
 Function that will add to result all elements of locs, plus all on-board locations matching pred that are connected to elements of locs by a chain of at most radius tiles, each of which matches pred. More...
 

Detailed Description

Various pathfinding functions and utilities.

Definition in file pathutils.cpp.

Function Documentation

void get_tile_ring ( const map_location center,
const int  radius,
std::vector< map_location > &  result 
)

Function that will add to result all locations exactly radius tiles from center (or nothing if radius is not positive).

result must be a std::vector of locations.

Definition at line 32 of file pathutils.cpp.

References map_location::get_direction(), i, and map_location::SOUTH_WEST.

Referenced by get_tiles_in_radius().

void get_tiles_in_radius ( const map_location center,
const int  radius,
std::vector< map_location > &  result 
)

Function that will add to result all locations within radius tiles of center (excluding center itself).

result must be a std::vector of locations.

Definition at line 56 of file pathutils.cpp.

References get_tile_ring().

Referenced by editor::brush::brush(), get_tiles_radius(), ai::default_recruitment::recruitment::is_enemy_in_radius(), and ai::default_recruitment::recruitment::update_important_hexes().

void get_tiles_radius ( const map_location center,
size_t  radius,
std::set< map_location > &  result 
)

Function that will add to result all locations within radius tiles of center (including center itself).

result must be a std::set of locations.

Definition at line 70 of file pathutils.cpp.

References get_tiles_in_radius().

Referenced by terrain_filter::get_locations(), terrain_filter::match(), and place_village().

void get_tiles_radius ( const gamemap map,
const std::vector< map_location > &  locs,
size_t  radius,
std::set< map_location > &  result,
bool  with_border 
)

Function that will add to result all elements of locs, plus all on-board locations that are within radius tiles of an element of locs.

result must be a std::set of locations.

Definition at line 199 of file pathutils.cpp.

References gamemap::border_size(), gamemap::h(), and gamemap::w().

void get_tiles_radius ( gamemap const &  map,
std::vector< map_location > const &  locs,
size_t  radius,
std::set< map_location > &  result,
bool  with_border,
xy_pred const &  pred 
)

Function that will add to result all elements of locs, plus all on-board locations matching pred that are connected to elements of locs by a chain of at most radius tiles, each of which matches pred.

result must be a std::set of locations.

Definition at line 238 of file pathutils.cpp.

References get_adjacent_tiles(), i, gamemap::on_board(), and gamemap::on_board_with_border().