The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
terrain_filter Class Reference

#include <filter.hpp>

Inheritance diagram for terrain_filter:
Inheritance graph

Classes

struct  terrain_filter_cache
 

Public Member Functions

 terrain_filter (const vconfig &cfg, const filter_context *fc, const bool flat_tod=false)
 
 terrain_filter (const vconfig &cfg, const terrain_filter &original)
 
 ~terrain_filter ()
 Default implementation, but defined out-of-line for efficiency reasons. More...
 
 terrain_filter (const terrain_filter &other)
 
terrain_filteroperator= (const terrain_filter &other)
 
bool match (const map_location &loc) const
 
bool match (const map_location &loc, const unit &ref_unit) const
 
virtual bool operator() (const map_location &loc) const
 
void get_locations (std::set< map_location > &locs, bool with_border=false) const
 gets all locations on the map that match this filter More...
 
void get_locations (std::set< map_location > &locs, const unit &ref_unit, bool with_border=false) const
 gets all locations on the map that match this filter More...
 
void flatten (const bool flat_tod=true)
 
config to_config () const
 

Private Member Functions

bool match_impl (const map_location &loc, const unit *ref_unit) const
 
void get_locs_impl (std::set< map_location > &locs, const unit *ref_unit, bool with_border) const
 
bool match_internal (const map_location &loc, const unit *ref_unit, const bool ignore_xy) const
 

Private Attributes

const vconfig cfg_
 
const filter_contextfc_
 
terrain_filter_cache cache_
 
const size_t max_loop_
 
bool flat_
 

Friends

class terrain_filterimpl
 

Additional Inherited Members

- Protected Member Functions inherited from xy_pred
virtual ~xy_pred ()
 

Detailed Description

Definition at line 28 of file filter.hpp.

Constructor & Destructor Documentation

terrain_filter::terrain_filter ( const vconfig cfg,
const filter_context fc,
const bool  flat_tod = false 
)

Definition at line 46 of file filter.cpp.

Referenced by get_locs_impl(), match_impl(), match_internal(), and operator=().

terrain_filter::terrain_filter ( const vconfig cfg,
const terrain_filter original 
)

Definition at line 55 of file filter.cpp.

terrain_filter::~terrain_filter ( )

Default implementation, but defined out-of-line for efficiency reasons.

Definition at line 42 of file filter.cpp.

Referenced by operator=().

terrain_filter::terrain_filter ( const terrain_filter other)

Definition at line 64 of file filter.cpp.

Member Function Documentation

void terrain_filter::flatten ( const bool  flat_tod = true)
inline

Definition at line 70 of file filter.hpp.

References flat_.

Referenced by unit::ability_active().

void terrain_filter::get_locations ( std::set< map_location > &  locs,
bool  with_border = false 
) const
inline

gets all locations on the map that match this filter

Parameters
[out]locsset to store the results in
[in]with_borderwhether to include the borders

Definition at line 57 of file filter.hpp.

References get_locs_impl().

Referenced by ai::cfun_ai_get_avoid(), get_locs_impl(), pathfind::teleport_group::get_teleport_pair(), ai::formula_ai::get_value(), game_events::builtin_conditions::have_location(), game_lua_kernel::intf_add_time_area(), game_lua_kernel::intf_find_cost_map(), game_lua_kernel::intf_get_locations(), and ai::readonly_context_impl::nearest_keep().

void terrain_filter::get_locations ( std::set< map_location > &  locs,
const unit ref_unit,
bool  with_border = false 
) const
inline

gets all locations on the map that match this filter

Parameters
[out]locsset to store the results in
[in]with_borderwhether to include the borders
[in]ref_unitA reference unit for the $teleport_unit auto-stored variable

Definition at line 65 of file filter.hpp.

References get_locs_impl().

void terrain_filter::get_locs_impl ( std::set< map_location > &  locs,
const unit ref_unit,
bool  with_border 
) const
private
bool terrain_filter::match ( const map_location loc) const
inline
bool terrain_filter::match ( const map_location loc,
const unit ref_unit 
) const
inline
Parameters
locThe location to test
ref_unitA reference unit for the $teleport_unit auto-stored variable
Returns
true if and only if the given location matches this filter

Definition at line 48 of file filter.hpp.

References match_impl().

bool terrain_filter::match_impl ( const map_location loc,
const unit ref_unit 
) const
private
bool terrain_filter::match_internal ( const map_location loc,
const unit ref_unit,
const bool  ignore_xy 
) const
private

Definition at line 100 of file filter.cpp.

References terrain_filter::terrain_filter_cache::adjacent_match_cache, terrain_filter::terrain_filter_cache::adjacent_matches, variable_info< V >::as_array(), wfl::variant::as_bool(), cache_, cfg_, vconfig::child(), game_events::builtin_conditions::default_counts, map_location::default_dirs(), e, config_attribute_value::empty(), wfl::formula::evaluate(), fc_, wfl::formula_error::filename, gui2::event::find(), unit_map::find(), flat_, team::fogged(), get_adjacent_tiles(), tod_manager::get_area_by_id(), vconfig::get_children(), filter_context::get_disp_context(), filter_context::get_game_data(), tod_manager::get_illuminated_time_of_day(), filter_context::get_lua_kernel(), display_context::get_team(), side_filter::get_teams(), gamemap::get_terrain_info(), tod_manager::get_time_of_day(), filter_context::get_tod_man(), vconfig::has_attribute(), vconfig::has_child(), i, time_of_day::id, in_ranges(), utf8::index(), gamemap::is_village(), time_of_day::lawful_bonus, wfl::formula_error::line, main(), vconfig::make_safe(), display_context::map(), map_location::matches_range(), vconfig::null(), terrain_type::number(), gamemap::on_board(), gamemap::on_board_with_border(), team::owns_village(), map_location::parse_directions(), utils::parse_ranges(), terrain_filter::terrain_filter_cache::parsed_terrain, game_lua_kernel::run_filter(), team::shrouded(), gamemap::special_location(), utils::split(), terrain_filter(), t_translation::terrain_matches(), config_attribute_value::to_int(), wfl::formula_error::type, terrain_filter::terrain_filter_cache::ufilter_, display_context::units(), unit_map::iterator_base< iter_types >::valid(), display_context::village_owner(), lg::wml_error(), and WRN_NG.

Referenced by get_locs_impl(), and match_impl().

virtual bool terrain_filter::operator() ( const map_location loc) const
inlinevirtual

Implements xy_pred.

Definition at line 52 of file filter.hpp.

References match().

terrain_filter & terrain_filter::operator= ( const terrain_filter other)

Definition at line 75 of file filter.cpp.

References terrain_filter(), and ~terrain_filter().

config terrain_filter::to_config ( ) const

Friends And Related Function Documentation

friend class terrain_filterimpl
friend

Definition at line 73 of file filter.hpp.

Member Data Documentation

terrain_filter_cache terrain_filter::cache_
mutableprivate

Definition at line 97 of file filter.hpp.

Referenced by get_locs_impl(), and match_internal().

const vconfig terrain_filter::cfg_
private
const filter_context* terrain_filter::fc_
private
bool terrain_filter::flat_
private

Definition at line 99 of file filter.hpp.

Referenced by flatten(), and match_internal().

const size_t terrain_filter::max_loop_
private

Definition at line 98 of file filter.hpp.

Referenced by get_locs_impl(), and match_impl().


The documentation for this class was generated from the following files: