The Battle for Wesnoth  1.19.5+dev
Public Types | Public Member Functions | Private Attributes | List of all members
unit_ability_list Class Reference

#include <unit.hpp>

Public Types

typedef std::vector< unit_ability >::iterator iterator
 
typedef std::vector< unit_ability >::const_iterator const_iterator
 

Public Member Functions

 unit_ability_list (const map_location &loc=map_location())
 
std::pair< int, map_locationhighest (const std::string &key, int def=0) const
 
std::pair< int, map_locationlowest (const std::string &key, int def=0) const
 
template<typename TComp >
std::pair< int, map_locationget_extremum (const std::string &key, int def, const TComp &comp) const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
bool empty () const
 
unit_abilityfront ()
 
const unit_abilityfront () const
 
unit_abilityback ()
 
const unit_abilityback () const
 
std::size_t size ()
 
iterator erase (const iterator &erase_it)
 
iterator erase (const iterator &first, const iterator &last)
 
template<typename... T>
void emplace_back (T &&... args)
 
const map_locationloc () const
 
void append (const unit_ability_list &other)
 Appends the abilities from other to this, ignores other.loc() More...
 
template<typename Predicate >
void append_if (const unit_ability_list &other, const Predicate &predicate)
 Appends any abilities from other for which the given condition returns true to this, ignores other.loc(). More...
 

Private Attributes

std::vector< unit_abilitycfgs_
 
map_location loc_
 

Detailed Description

Definition at line 62 of file unit.hpp.

Member Typedef Documentation

◆ const_iterator

Definition at line 82 of file unit.hpp.

◆ iterator

Definition at line 81 of file unit.hpp.

Constructor & Destructor Documentation

◆ unit_ability_list()

unit_ability_list::unit_ability_list ( const map_location loc = map_location())
inline

Definition at line 65 of file unit.hpp.

Member Function Documentation

◆ append()

void unit_ability_list::append ( const unit_ability_list other)
inline

Appends the abilities from other to this, ignores other.loc()

Definition at line 106 of file unit.hpp.

References begin(), cfgs_, and end().

Referenced by attack_type::get_specials_and_abilities(), unit_display::reset_helpers(), and unit_display::unit_attack().

◆ append_if()

template<typename Predicate >
void unit_ability_list::append_if ( const unit_ability_list other,
const Predicate &  predicate 
)
inline

Appends any abilities from other for which the given condition returns true to this, ignores other.loc().

Parameters
otherwhere to copy the elements from
predicatea single-argument function that takes a reference to an element and returns a bool

Definition at line 118 of file unit.hpp.

References begin(), cfgs_, and end().

Referenced by attack_type::get_weapon_ability().

◆ back() [1/2]

unit_ability& unit_ability_list::back ( )
inline

Definition at line 93 of file unit.hpp.

References cfgs_.

◆ back() [2/2]

const unit_ability& unit_ability_list::back ( ) const
inline

Definition at line 94 of file unit.hpp.

References cfgs_.

◆ begin() [1/2]

iterator unit_ability_list::begin ( )
inline

Definition at line 84 of file unit.hpp.

References cfgs_.

Referenced by append(), and append_if().

◆ begin() [2/2]

const_iterator unit_ability_list::begin ( ) const
inline

Definition at line 85 of file unit.hpp.

References cfgs_.

◆ emplace_back()

template<typename... T>
void unit_ability_list::emplace_back ( T &&...  args)
inline

Definition at line 101 of file unit.hpp.

References cfgs_.

Referenced by unit::get_abilities(), attack_type::get_specials(), and unit_type::resistance_against().

◆ empty()

bool unit_ability_list::empty ( ) const
inline

◆ end() [1/2]

iterator unit_ability_list::end ( )
inline

Definition at line 86 of file unit.hpp.

References cfgs_.

Referenced by append(), and append_if().

◆ end() [2/2]

const_iterator unit_ability_list::end ( ) const
inline

Definition at line 87 of file unit.hpp.

References cfgs_.

◆ erase() [1/2]

iterator unit_ability_list::erase ( const iterator erase_it)
inline

Definition at line 97 of file unit.hpp.

References cfgs_.

◆ erase() [2/2]

iterator unit_ability_list::erase ( const iterator first,
const iterator last 
)
inline

Definition at line 98 of file unit.hpp.

References cfgs_.

◆ front() [1/2]

unit_ability& unit_ability_list::front ( )
inline

Definition at line 91 of file unit.hpp.

References cfgs_.

Referenced by battle_context_unit_stats::battle_context_unit_stats().

◆ front() [2/2]

const unit_ability& unit_ability_list::front ( ) const
inline

Definition at line 92 of file unit.hpp.

References cfgs_.

◆ get_extremum()

template<typename TComp >
std::pair< int, map_location > unit_ability_list::get_extremum ( const std::string &  key,
int  def,
const TComp &  comp 
) const

Definition at line 687 of file abilities.cpp.

References wfl::formula::evaluate(), and p.

Referenced by highest(), and lowest().

◆ highest()

std::pair<int, map_location> unit_ability_list::highest ( const std::string &  key,
int  def = 0 
) const
inline

◆ loc()

const map_location& unit_ability_list::loc ( ) const
inline

Definition at line 103 of file unit.hpp.

References loc_.

Referenced by unit_abilities::effect::effect().

◆ lowest()

std::pair<int, map_location> unit_ability_list::lowest ( const std::string &  key,
int  def = 0 
) const
inline

Definition at line 72 of file unit.hpp.

References get_extremum().

Referenced by unit_abilities::effect::effect(), and tod_manager::get_illuminated_time_of_day().

◆ size()

std::size_t unit_ability_list::size ( )
inline

Definition at line 95 of file unit.hpp.

References cfgs_.

Referenced by attack_type::overwrite_special_overwriter().

Member Data Documentation

◆ cfgs_

std::vector<unit_ability> unit_ability_list::cfgs_
private

Definition at line 125 of file unit.hpp.

Referenced by append(), append_if(), back(), begin(), emplace_back(), empty(), end(), erase(), front(), and size().

◆ loc_

map_location unit_ability_list::loc_
private

Definition at line 126 of file unit.hpp.

Referenced by loc().


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