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

Stores a set of defense levels. More...

#include <movetype.hpp>

Public Member Functions

 terrain_defense ()
 
 terrain_defense (const config &cfg)
 
int defense (const t_translation::t_terrain &terrain) const
 Returns the defense associated with the given terrain. More...
 
bool capped (const t_translation::t_terrain &terrain) const
 Returns whether there is a defense cap associated to this terrain. More...
 
void merge (const config &new_data, bool overwrite)
 Merges the given config over the existing costs. More...
 
void write (config &cfg, const std::string &child_name="") const
 Writes our data to a config, as a child if child_name is specified. More...
 

Private Attributes

terrain_info min_
 
terrain_info max_
 

Static Private Attributes

static const
terrain_info::parameters 
params_min_
 
static const
terrain_info::parameters 
params_max_
 

Detailed Description

Stores a set of defense levels.

Definition at line 119 of file movetype.hpp.

Constructor & Destructor Documentation

movetype::terrain_defense::terrain_defense ( )
inline

Definition at line 125 of file movetype.hpp.

movetype::terrain_defense::terrain_defense ( const config cfg)
inlineexplicit

Definition at line 126 of file movetype.hpp.

Member Function Documentation

bool movetype::terrain_defense::capped ( const t_translation::t_terrain terrain) const
inline

Returns whether there is a defense cap associated to this terrain.

Definition at line 134 of file movetype.hpp.

References min_, and movetype::terrain_info::value().

Referenced by movetype::has_terrain_defense_caps(), and help::unit_topic_generator::operator()().

int movetype::terrain_defense::defense ( const t_translation::t_terrain terrain) const
inline

Returns the defense associated with the given terrain.

Definition at line 131 of file movetype.hpp.

References max_, min_, and movetype::terrain_info::value().

Referenced by movetype::defense_modifier().

void movetype::terrain_defense::merge ( const config new_data,
bool  overwrite 
)
inline

Merges the given config over the existing costs.

(Not overwriting implies adding.)

Definition at line 138 of file movetype.hpp.

References max_, movetype::terrain_info::merge(), and min_.

Referenced by unit::apply_builtin_effect(), and movetype::merge().

void movetype::terrain_defense::write ( config cfg,
const std::string child_name = "" 
) const
inline

Writes our data to a config, as a child if child_name is specified.

(No child is created if there is no data.)

Definition at line 142 of file movetype.hpp.

References max_, and movetype::terrain_info::write().

Referenced by movetype::write().

Member Data Documentation

terrain_info movetype::terrain_defense::max_
private

Definition at line 149 of file movetype.hpp.

Referenced by defense(), merge(), and write().

terrain_info movetype::terrain_defense::min_
private

Definition at line 148 of file movetype.hpp.

Referenced by capped(), defense(), and merge().

const movetype::terrain_info::parameters movetype::terrain_defense::params_max_
staticprivate

Definition at line 122 of file movetype.hpp.

const movetype::terrain_info::parameters movetype::terrain_defense::params_min_
staticprivate

Definition at line 121 of file movetype.hpp.


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