The Battle for Wesnoth  1.19.6+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 32 of file pathutils.cpp.

References map_location::get_direction(), i, loc, n, and map_location::south_west.

Referenced by get_tiles_in_radius(), and lua_map_location::intf_get_tile_ring().

◆ 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(), and n.

Referenced by editor::brush::brush(), wfl::builtins::DEFINE_WFL_FUNCTION(), wfl::gamestate::DEFINE_WFL_FUNCTION(), get_tiles_radius(), lua_map_location::intf_get_tiles_in_radius(), ai::default_recruitment::recruitment::is_enemy_in_radius(), and ai::default_recruitment::recruitment::update_important_hexes().

◆ get_tiles_radius() [1/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 242 of file pathutils.cpp.

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

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

References border, gamemap_base::border_size(), gamemap_base::h(), and gamemap_base::w().

◆ get_tiles_radius() [3/3]

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).

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_locs_impl(), get_tiles_radius(), intf_mg_get_tiles_radius(), terrain_filter::match_impl(), and place_village().