14 #ifndef MOVETYPE_H_INCLUDED
15 #define MOVETYPE_H_INCLUDED
20 #include <boost/shared_ptr.hpp>
60 void merge(
const config & new_values,
bool overwrite);
127 min_(cfg, params_min_),
max_(cfg, params_max_)
166 void merge(
const config & new_data,
bool overwrite);
230 void merge(
const config & new_cfg,
bool overwrite=
true);
249 #endif // MOVETYPE_H_INCLUDED
Stores a set of terrain costs (for movement, vision, or "jamming").
int resistance_against(const std::string &damage_type) const
Returns the resistance against the indicated damage type.
resistances & get_resistances()
void clear_cache() const
Clears the cache of values.
const terrain_info *const fallback_
Created as needed.
terrain_defense(const config &cfg)
const boost::shared_ptr< data > & get_merged() const
Returns a pointer to data the incorporates our fallback.
int vision_cost(const t_translation::t_terrain &terrain, bool slowed=false) const
Returns the cost to see through the indicated terrain.
int defense(const t_translation::t_terrain &terrain) const
Returns the defense associated with the given terrain.
const terrain_costs & get_movement() const
void make_unique_fallback() const
Ensures our data is not shared, and propagates to our fallback.
void write(config &cfg, const std::string &child_name="", bool merged=true) const
Writes our data to a config.
static const int UNREACHABLE
Magic value that signifies a hex is unreachable.
boost::shared_ptr< data > merged_data_
Never nullptr.
movetype()
Default constructor.
static const parameters params_
int resistance_against(const attack_type &attack) const
Returns the resistance against the indicated attack.
~terrain_info()
Destructor.
boost::shared_ptr< data > data_
void merge(const config &new_data, bool overwrite)
Merges the given config over the existing costs.
const resistances & get_resistances() const
void write(config &cfg) const
Writes the movement type data to the provided config.
void merge(const config &new_cfg, bool overwrite=true)
Merges the given config over the existing data.
The basic "size" of the unit - flying, small land, large land, etc.
Definitions for the interface to Wesnoth Markup Language (WML).
bool capped(const t_translation::t_terrain &terrain) const
Returns whether there is a defense cap associated to this terrain.
utils::string_map damage_table() const
Returns a map from attack types to resistances.
resistances(const config &cfg)
int movement_cost(const t_translation::t_terrain &terrain, bool slowed=false) const
Returns the cost to move through the indicated terrain.
const terrain_defense & get_defense() const
terrain_costs & get_jamming()
bool has_vision_data() const
Returns whether or not there are any vision-specific costs.
std::map< std::string, t_string > string_map
terrain_costs(const config &cfg, const terrain_costs *fallback=nullptr, const terrain_costs *cascade=nullptr)
const terrain_info *const cascade_
terrain_defense & get_defense()
terrain_costs & get_vision()
static const std::set< std::string > effects
The set of applicable effects for movement types.
terrain_costs(const terrain_costs *fallback=nullptr, const terrain_costs *cascade=nullptr)
Stores a set of resistances.
const terrain_costs & get_vision() const
Stores a set of data based on terrain.
bool is_flying() const
Returns whether or not *this is flagged as a flying movement type.
static const ::config * terrain
The terrain used to create the cache.
void merge(const config &new_data, bool overwrite)
Merges the given config over the existing costs.
terrain_costs & get_movement()
utils::string_map damage_table() const
Returns a map from attack types to resistances.
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...
void write(config &cfg, const std::string &child_name="") const
Writes our data to a config, as a child if child_name is specified.
terrain_info & operator=(const terrain_info &that)
Assignment operator.
int value(const t_translation::t_terrain &terrain) const
Returns the value associated with the given terrain.
int resistance_against(const attack_type &attack) const
Returns the resistance against the indicated attack.
static const terrain_info::parameters params_max_
const terrain_costs & get_jamming() const
int cost(const t_translation::t_terrain &terrain, bool slowed=false) const
Returns the cost associated with the given terrain.
void write(config &out_cfg, const std::string &child_name="") const
Writes our data to a config, as a child if child_name is specified.
bool empty() const
Returns whether or not our data is empty.
bool has_terrain_defense_caps(const std::set< t_translation::t_terrain > &ts) const
Returns whether or not there are any terrain caps with respect to a set of terrains.
bool has_jamming_data() const
Returns whether or not there are any jamming-specific costs.
The parameters used when calculating a terrain-based value.
void make_unique_cascade() const
Ensures our data is not shared, and propagates to our cascade.
A config object defines a single node in a WML file, with access to child nodes.
void set_flying(bool flies=true)
Sets whether or not *this is flagged as a flying movement type.
Stores a set of defense levels.
terrain_info(const parameters ¶ms, const terrain_info *fallback=nullptr, const terrain_info *cascade=nullptr)
Constructor.
GLsizei const GLcharARB ** string
int jamming_cost(const t_translation::t_terrain &terrain, bool slowed=false) const
Returns the cost to "jam" through the indicated terrain.
static const terrain_info::parameters params_min_
void merge(const config &new_values, bool overwrite)
Merges the given config over the existing values.
int defense_modifier(const t_translation::t_terrain &terrain) const
Returns the defensive value of the indicated terrain.
terrain_costs(const terrain_costs &that, const terrain_costs *fallback=nullptr, const terrain_costs *cascade=nullptr)