The Battle for Wesnoth  1.15.2+dev
Public Member Functions | Private Attributes | List of all members
unit_filter Class Reference

#include <filter.hpp>

Public Member Functions

 unit_filter (vconfig cfg)
 
 unit_filter (const unit_filter &)=default
 
unit_filteroperator= (const unit_filter &)=default
 
 unit_filter (unit_filter &&)=default
 
unit_filteroperator= (unit_filter &&)=default
 
unit_filterset_use_flat_tod (bool value)
 
bool matches (const unit &u, const map_location &loc) const
 Determine if *this matches filter at a specified location. More...
 
bool matches (const unit &u) const
 Determine if *this matches filter at its current location. More...
 
bool matches (const unit &u, const map_location &loc, const unit &u2) const
 
bool matches (const unit &u, const unit &u2) const
 
bool operator() (const unit &u, const map_location &loc) const
 
bool operator() (const unit &u) const
 
bool operator() (const unit &u, const map_location &loc, const unit &u2) const
 
bool operator() (const unit &u, const unit &u2) const
 
std::vector< const unit * > all_matches_on_map (const map_location *loc=nullptr, const unit *other_unit=nullptr) const
 
std::vector< const unit * > all_matches_at (const map_location &loc) const
 
std::vector< const unit * > all_matches_with_unit (const unit &u) const
 
std::vector< const unit * > all_matches_with_unit_at (const unit &u, const map_location &loc) const
 
unit_const_ptr first_match_on_map () const
 
config to_config () const
 
bool empty () const
 

Private Attributes

vconfig cfg_
 
const filter_contextfc_
 
bool use_flat_tod_
 
unit_filter_impl::unit_filter_compound impl_
 
int max_matches_
 

Detailed Description

Definition at line 110 of file filter.hpp.

Constructor & Destructor Documentation

◆ unit_filter() [1/3]

unit_filter::unit_filter ( vconfig  cfg)
explicit

Definition at line 47 of file filter.cpp.

◆ unit_filter() [2/3]

unit_filter::unit_filter ( const unit_filter )
default

◆ unit_filter() [3/3]

unit_filter::unit_filter ( unit_filter &&  )
default

Member Function Documentation

◆ all_matches_at()

std::vector<const unit*> unit_filter::all_matches_at ( const map_location loc) const
inline

Definition at line 162 of file filter.hpp.

Referenced by game_lua_kernel::intf_get_units().

◆ all_matches_on_map()

std::vector< const unit * > unit_filter::all_matches_on_map ( const map_location loc = nullptr,
const unit other_unit = nullptr 
) const

◆ all_matches_with_unit()

std::vector<const unit*> unit_filter::all_matches_with_unit ( const unit u) const
inline

Definition at line 166 of file filter.hpp.

Referenced by game_lua_kernel::intf_get_units().

◆ all_matches_with_unit_at()

std::vector<const unit*> unit_filter::all_matches_with_unit_at ( const unit u,
const map_location loc 
) const
inline

Definition at line 170 of file filter.hpp.

◆ empty()

bool unit_filter::empty ( ) const
inline

Definition at line 180 of file filter.hpp.

◆ first_match_on_map()

unit_const_ptr unit_filter::first_match_on_map ( ) const

◆ matches() [1/4]

bool unit_filter::matches ( const unit u,
const map_location loc 
) const
inline

Determine if *this matches filter at a specified location.

Use this for units on a recall list, or to test for a match if a unit is hypothetically moved.

Definition at line 129 of file filter.hpp.

References impl_.

Referenced by unit::ability_active(), unit::ability_affects_self(), unit::ability_filter_fighter(), first_match_on_map(), game_events::entity_location::matches_unit_filter(), and game_events::WML_HANDLER_FUNCTION().

◆ matches() [2/4]

bool unit_filter::matches ( const unit u) const

Determine if *this matches filter at its current location.

(Only use for units currently on the map; otherwise use the overload that takes a location, possibly with a null location.)

Definition at line 56 of file filter.cpp.

References fc_, unit::get_location(), impl_, unit_filter_impl::unit_filter_compound::matches(), and use_flat_tod_.

◆ matches() [3/4]

bool unit_filter::matches ( const unit u,
const map_location loc,
const unit u2 
) const
inline

Definition at line 138 of file filter.hpp.

References impl_.

◆ matches() [4/4]

bool unit_filter::matches ( const unit u,
const unit u2 
) const

◆ operator()() [1/4]

bool unit_filter::operator() ( const unit u,
const map_location loc 
) const
inline

Definition at line 144 of file filter.hpp.

Referenced by first_match_on_map().

◆ operator()() [2/4]

bool unit_filter::operator() ( const unit u) const
inline

Definition at line 148 of file filter.hpp.

◆ operator()() [3/4]

bool unit_filter::operator() ( const unit u,
const map_location loc,
const unit u2 
) const
inline

Definition at line 152 of file filter.hpp.

◆ operator()() [4/4]

bool unit_filter::operator() ( const unit u,
const unit u2 
) const
inline

Definition at line 156 of file filter.hpp.

◆ operator=() [1/2]

unit_filter& unit_filter::operator= ( const unit_filter )
default

◆ operator=() [2/2]

unit_filter& unit_filter::operator= ( unit_filter &&  )
default

◆ set_use_flat_tod()

unit_filter& unit_filter::set_use_flat_tod ( bool  value)
inline

◆ to_config()

config unit_filter::to_config ( ) const
inline

Definition at line 176 of file filter.hpp.

Member Data Documentation

◆ cfg_

vconfig unit_filter::cfg_
private

Definition at line 186 of file filter.hpp.

Referenced by first_match_on_map().

◆ fc_

const filter_context* unit_filter::fc_
private

Definition at line 187 of file filter.hpp.

Referenced by all_matches_on_map(), first_match_on_map(), and matches().

◆ impl_

unit_filter_impl::unit_filter_compound unit_filter::impl_
private

Definition at line 189 of file filter.hpp.

Referenced by all_matches_on_map(), and matches().

◆ max_matches_

int unit_filter::max_matches_
private

Definition at line 190 of file filter.hpp.

Referenced by all_matches_on_map().

◆ use_flat_tod_

bool unit_filter::use_flat_tod_
private

Definition at line 188 of file filter.hpp.

Referenced by matches().


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