Stores a set of defense levels. More...
#include <movetype.hpp>
Public Member Functions | |
terrain_defense () | |
terrain_defense (const config &cfg) | |
terrain_defense (const terrain_defense &that) | |
terrain_defense (terrain_defense &&that) | |
terrain_defense & | operator= (const terrain_defense &that) |
terrain_defense & | operator= (terrain_defense &&that) |
int | defense (const t_translation::terrain_code &terrain) const |
Returns the defense associated with the given terrain. More... | |
bool | capped (const t_translation::terrain_code &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_ |
Friends | |
void | swap (movetype::terrain_defense &a, movetype::terrain_defense &b) |
Swap function for the terrain_defense class. More... | |
Stores a set of defense levels.
Definition at line 177 of file movetype.hpp.
|
inline |
Definition at line 183 of file movetype.hpp.
|
inlineexplicit |
Definition at line 184 of file movetype.hpp.
movetype::terrain_defense::terrain_defense | ( | const terrain_defense & | that | ) |
Definition at line 685 of file movetype.cpp.
movetype::terrain_defense::terrain_defense | ( | terrain_defense && | that | ) |
Definition at line 691 of file movetype.cpp.
|
inline |
Returns whether there is a defense cap associated to this terrain.
Definition at line 196 of file movetype.hpp.
References min_, and movetype::terrain_info::value().
Referenced by movetype::has_terrain_defense_caps(), and help::unit_topic_generator::operator()().
|
inline |
Returns the defense associated with the given terrain.
Definition at line 193 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 | ||
) |
Merges the given config over the existing costs.
(Not overwriting implies adding.)
Definition at line 714 of file movetype.cpp.
Referenced by movetype::merge().
movetype::terrain_defense & movetype::terrain_defense::operator= | ( | const terrain_defense & | that | ) |
Definition at line 697 of file movetype.cpp.
movetype::terrain_defense & movetype::terrain_defense::operator= | ( | terrain_defense && | that | ) |
Definition at line 704 of file movetype.cpp.
|
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 207 of file movetype.hpp.
References max_, and movetype::terrain_info::write().
Referenced by movetype::write().
|
friend |
Swap function for the terrain_defense class.
This relies on all of the terrain_infos having no fallback and no cascade, an assumption which is provided by terrain_defense's constructors.
Definition at line 498 of file movetype.cpp.
|
private |
Definition at line 216 of file movetype.hpp.
Referenced by defense(), operator=(), and write().
|
private |
Definition at line 215 of file movetype.hpp.
Referenced by capped(), defense(), and operator=().
|
staticprivate |
Definition at line 180 of file movetype.hpp.
|
staticprivate |
Definition at line 179 of file movetype.hpp.