The Battle for Wesnoth  1.15.1+dev
Classes | Functions
pathutils.hpp File Reference
#include "map/location.hpp"
Include dependency graph for pathutils.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  xy_pred
 

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, std::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, std::size_t radius, std::set< map_location > &result, bool with_border=false)
 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 (const gamemap &map, const std::vector< map_location > &locs, std::size_t radius, std::set< map_location > &result, bool with_border, const xy_pred &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...
 

Function Documentation

◆ get_tile_ring()

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 31 of file pathutils.cpp.

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

Referenced by get_tiles_in_radius(), and xy_pred::~xy_pred().

◆ 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 55 of file pathutils.cpp.

References get_tile_ring(), and n.

Referenced by editor::brush::brush(), wfl::gamestate::DEFINE_WFL_FUNCTION(), get_tiles_radius(), ai::default_recruitment::recruitment::is_enemy_in_radius(), ai::default_recruitment::recruitment::update_important_hexes(), and xy_pred::~xy_pred().

◆ get_tiles_radius() [1/3]

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

◆ get_tiles_radius() [2/3]

void get_tiles_radius ( const gamemap map,
const std::vector< map_location > &  locs,
std::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 198 of file pathutils.cpp.

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

◆ get_tiles_radius() [3/3]

void get_tiles_radius ( const gamemap map,
const std::vector< map_location > &  locs,
std::size_t  radius,
std::set< map_location > &  result,
bool  with_border,
const xy_pred 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 237 of file pathutils.cpp.

References get_tiles_radius(), gamemap::on_board(), and gamemap::on_board_with_border().