#include <terrain.hpp>
Public Member Functions | |
terrain_type () | |
Creates an instance for which is_nonnull() returns false. More... | |
terrain_type (const config &cfg) | |
Constructor for terrains defined by a WML [terrain_type] tag. More... | |
terrain_type (const terrain_type &base, const terrain_type &overlay) | |
Used when a terrain code which hasn't been defined with a [terrain_type] tag is used in a map, to build the terrain from already-defined terrains. More... | |
const std::string & | icon_image () const |
const std::string & | minimap_image () const |
const std::string & | minimap_image_overlay () const |
const std::string & | editor_image () const |
const t_string & | name () const |
const t_string & | editor_name () const |
const t_string & | description () const |
const t_string & | help_topic_text () const |
const std::string & | id () const |
bool | hide_help () const |
For instances created from a [terrain_type] tag, the value in the tag (with default false). More... | |
bool | hide_in_editor () const |
bool | hide_if_impassable () const |
t_translation::terrain_code | number () const |
const t_translation::ter_list & | mvt_type () const |
The underlying type of the terrain. More... | |
const t_translation::ter_list & | def_type () const |
const t_translation::ter_list & | vision_type () const |
const t_translation::ter_list & | union_type () const |
bool | is_indivisible () const |
Returns true if this terrain has no underlying types other than itself. More... | |
bool | is_mvt_indivisible () const |
bool | is_nonnull () const |
True if this object represents some sentinel values. More... | |
int | light_bonus (int base) const |
Returns the light (lawful) bonus for this terrain when the time of day gives a base bonus. More... | |
int | unit_height_adjust () const |
double | unit_submerge () const |
int | gives_healing () const |
bool | is_village () const |
bool | is_castle () const |
bool | is_keep () const |
const t_string & | income_description () const |
const t_string & | income_description_ally () const |
const t_string & | income_description_enemy () const |
const t_string & | income_description_own () const |
const std::string & | editor_group () const |
void | set_editor_group (const std::string &str) |
bool | is_overlay () const |
bool | is_combined () const |
True for instances created by the terrain_code(base, overlay) constructor. More... | |
t_translation::terrain_code | default_base () const |
Overlay terrains defined by a [terrain_type] can declare a fallback base terrain, for use when the overlay is selected in the editor, or when the overlay is placed on the map using [terrain]replace_if_failed=true. More... | |
bool | has_default_base () const |
t_translation::terrain_code | terrain_with_default_base () const |
Return the overlay part of this terrain, on the default_base(). More... | |
bool | operator== (const terrain_type &other) const |
Returns true if most of the data matches. More... | |
Static Public Member Functions | |
static bool | is_indivisible (t_translation::terrain_code id, const t_translation::ter_list &underlying) |
Returns true if a terrain has no underlying types other than itself, in respect of either union, movement or defense. More... | |
Definition at line 22 of file terrain.hpp.
|
explicit |
Creates an instance for which is_nonnull() returns false.
Used for the sentinel value when terrain_type_data::get_terrain_info() is called for an unknown terrain code.
Definition at line 34 of file terrain.cpp.
|
explicit |
Constructor for terrains defined by a WML [terrain_type] tag.
Definition at line 73 of file terrain.cpp.
References _(), def_type_, deprecated_message(), editor_image_, t_string::empty(), utils::erase(), hide_in_editor_, income_description_, income_description_ally_, income_description_enemy_, income_description_own_, minimap_image_, t_translation::MINUS, missing_mandatory_wml_key(), mvt_type_, name_, t_translation::NONE_TERRAIN, number_, t_translation::PLUS, t_translation::read_list(), REMOVED, union_type_, VALIDATE, village_, vision_type_, and t_translation::write_terrain_code().
|
explicit |
Used when a terrain code which hasn't been defined with a [terrain_type] tag is used in a map, to build the terrain from already-defined terrains.
Definition at line 205 of file terrain.cpp.
References def_type_, description(), description_, t_string::empty(), utils::erase(), height_adjust_, height_adjust_set_, income_description_, income_description_ally_, income_description_enemy_, income_description_own_, merge_alias_lists(), t_translation::MINUS, mvt_type_, t_translation::PLUS, submerge_, submerge_set_, union_type_, village_, and vision_type_.
|
inline |
Definition at line 76 of file terrain.hpp.
References def_type_.
Referenced by help::terrain_topic_generator::operator()().
|
inline |
Overlay terrains defined by a [terrain_type] can declare a fallback base terrain, for use when the overlay is selected in the editor, or when the overlay is placed on the map using [terrain]replace_if_failed=true.
If there's no default, returns a sentinel value; see has_default_base().
Definition at line 176 of file terrain.hpp.
References editor_default_base_.
Referenced by help::terrain_topic_generator::operator()().
|
inline |
Definition at line 50 of file terrain.hpp.
References description_, t_string::empty(), and name_.
Referenced by editor_name(), terrain_type_data::get_terrain_editor_string(), terrain_type_data::get_terrain_string(), wfl::terrain_callable::get_value(), terrain_type(), and unit_defense().
|
inline |
Definition at line 152 of file terrain.hpp.
References editor_group_.
Referenced by terrain_type_data::lazy_initialization(), help::terrain_topic_generator::operator()(), and editor::terrain_palette::setup().
|
inline |
Definition at line 47 of file terrain.hpp.
References editor_image_.
Referenced by help::terrain_topic_generator::operator()(), and editor::mouse_action::set_terrain_mouse_overlay().
|
inline |
Definition at line 49 of file terrain.hpp.
References description(), editor_name_, and t_string::empty().
Referenced by help::generate_terrain_sections(), terrain_type_data::get_terrain_editor_string(), wfl::terrain_callable::get_value(), help::terrain_topic_generator::operator()(), help::print_behavior_description(), and editor::terrain_palette::setup().
|
inline |
Definition at line 140 of file terrain.hpp.
References heals_.
Referenced by wfl::terrain_callable::get_value(), terrain_type_data::gives_healing(), and help::terrain_topic_generator::operator()().
|
inline |
Definition at line 177 of file terrain.hpp.
References editor_default_base_, and t_translation::NONE_TERRAIN.
Referenced by help::terrain_topic_generator::operator()(), and terrain_with_default_base().
|
inline |
Definition at line 51 of file terrain.hpp.
References help_topic_text_.
Referenced by help::terrain_topic_generator::operator()().
|
inline |
For instances created from a [terrain_type] tag, the value in the tag (with default false).
Always true for instances generated by the terrain_type(base, overlay) constructor.
Definition at line 61 of file terrain.hpp.
References hide_help_.
Referenced by help::generate_terrain_sections().
|
inline |
Definition at line 63 of file terrain.hpp.
References hide_if_impassable_.
|
inline |
Definition at line 62 of file terrain.hpp.
References hide_in_editor_.
Referenced by help::terrain_topic_generator::operator()(), and editor::terrain_palette::setup().
|
inline |
Definition at line 44 of file terrain.hpp.
References icon_image_.
Referenced by wfl::terrain_callable::get_value(), help::terrain_topic_generator::operator()(), and REPORT_GENERATOR().
|
inline |
Definition at line 52 of file terrain.hpp.
References id_.
Referenced by help::generate_terrain_sections(), editor::terrain_palette::get_id(), wfl::terrain_callable::get_value(), terrain_type_data::lazy_initialization(), help::terrain_topic_generator::operator()(), image::prep_minimap_for_rendering(), REPORT_GENERATOR(), and unit_box_at().
|
inline |
Definition at line 147 of file terrain.hpp.
References income_description_.
Referenced by help::terrain_topic_generator::operator()(), and REPORT_GENERATOR().
|
inline |
Definition at line 148 of file terrain.hpp.
References income_description_ally_.
Referenced by REPORT_GENERATOR().
|
inline |
Definition at line 149 of file terrain.hpp.
References income_description_enemy_.
Referenced by REPORT_GENERATOR().
|
inline |
Definition at line 150 of file terrain.hpp.
References income_description_own_.
Referenced by REPORT_GENERATOR().
|
inline |
Definition at line 142 of file terrain.hpp.
References castle_.
Referenced by wfl::terrain_callable::get_value(), terrain_type_data::is_castle(), and help::terrain_topic_generator::operator()().
|
inline |
True for instances created by the terrain_code(base, overlay) constructor.
False for instances created by the terrain_type(config) constructor, implying that they were created directly from a WML [terrain_type] tag.
Note that this returns false for terrains such as Dd^Dc (crater) and Mm^Xm (regular impassible mountains), because there are [terrain_type] tags for those specific combinations of base^overlay.
Definition at line 167 of file terrain.hpp.
References combined_.
Referenced by help::terrain_topic_generator::operator()(), and editor::terrain_palette::setup().
|
inline |
Returns true if this terrain has no underlying types other than itself.
Definition at line 110 of file terrain.hpp.
References number_, and union_type_.
Referenced by movetype::terrain_info::data::calc_value().
|
inlinestatic |
Returns true if a terrain has no underlying types other than itself, in respect of either union, movement or defense.
If this returns false, then underlying must be non-empty.
This function is to encapsulate the logic of whether such a terrain is represented by a empty list, or whether it's represented by a list including only itself; so that a refactor can switch between these two possible implementations.
This is not related to whether the terrain has an overlay. For example, Gg^Uf (flat with old mushrooms) is indivisible (it's only Tt), although Gg^Tf (flat with new mushrooms) can be divided (in to Gt and Tt).
TODO: should this document vision_type() too?
id | the terrain |
underlying | the corresponding mvt_type(), def_type() or union_type() |
Definition at line 100 of file terrain.hpp.
Referenced by help::terrain_topic_generator::operator()().
|
inline |
Definition at line 143 of file terrain.hpp.
References keep_.
Referenced by wfl::terrain_callable::get_value(), terrain_type_data::is_keep(), and help::terrain_topic_generator::operator()().
|
inline |
Definition at line 114 of file terrain.hpp.
|
inline |
True if this object represents some sentinel values.
number_ should never be NONE_TERRAIN
there's two different VOID_TERRAINS - see the comment attached to the definition of VOID_TERRAIN.
Definition at line 129 of file terrain.hpp.
References t_translation::NONE_TERRAIN, number_, and t_translation::VOID_TERRAIN.
Referenced by help::generate_terrain_sections(), and help::terrain_topic_generator::operator()().
|
inline |
Definition at line 155 of file terrain.hpp.
References overlay_.
Referenced by help::terrain_topic_generator::operator()().
|
inline |
Definition at line 141 of file terrain.hpp.
References village_.
Referenced by wfl::terrain_callable::get_value(), terrain_type_data::is_village(), and help::terrain_topic_generator::operator()().
|
inline |
Returns the light (lawful) bonus for this terrain when the time of day gives a base bonus.
Definition at line 132 of file terrain.hpp.
References bounded_add(), light_modification_, max_light_, and min_light_.
Referenced by tod_manager::get_illuminated_time_of_day(), wfl::terrain_callable::get_value(), and help::terrain_topic_generator::operator()().
|
inline |
Definition at line 45 of file terrain.hpp.
References minimap_image_.
Referenced by image::prep_minimap_for_rendering(), and terrain_builder::rebuild_terrain().
|
inline |
Definition at line 46 of file terrain.hpp.
References minimap_image_overlay_.
Referenced by image::prep_minimap_for_rendering(), and terrain_builder::rebuild_terrain().
|
inline |
The underlying type of the terrain.
Whether "underlying" means "only the types used in [movetype]" is determined by the terrain.cfg file, rather than the .cpp code - in 1.14, the terrain.cfg file uses only the [movetype] terrains in its alias lists.
Definition at line 75 of file terrain.hpp.
References mvt_type_.
Referenced by help::terrain_topic_generator::operator()().
|
inline |
Definition at line 48 of file terrain.hpp.
References name_.
Referenced by terrain_type_data::get_underlying_terrain_string(), wfl::terrain_callable::get_value(), terrain_type_data::lazy_initialization(), and editor::terrain_palette::setup().
|
inline |
Definition at line 66 of file terrain.hpp.
References number_.
Referenced by terrain_type_data::find_or_create(), terrain_type_data::lazy_initialization(), terrain_filter::match_internal(), help::terrain_topic_generator::operator()(), and editor::terrain_palette::setup().
bool terrain_type::operator== | ( | const terrain_type & | other | ) | const |
Returns true if most of the data matches.
The ones that don't need to match:
The intention seems to be to allow additional [terrain_type] tags to add compatible definitions to multiple addon-specific editor groups. For this purpose the description strings aren't too important, and hide_if_impassable_ seems trivial.
Definition at line 298 of file terrain.cpp.
References t_string::base_str(), castle_, combined_, def_type_, editor_default_base_, editor_image_, editor_name_, heals_, height_adjust_, height_adjust_set_, hide_help_, hide_in_editor_, id_, keep_, light_modification_, max_light_, min_light_, minimap_image_, minimap_image_overlay_, mvt_type_, name_, number_, overlay_, submerge_, submerge_set_, union_type_, village_, and vision_type_.
|
inline |
Definition at line 153 of file terrain.hpp.
References editor_group_.
t_translation::terrain_code terrain_type::terrain_with_default_base | ( | ) | const |
Return the overlay part of this terrain, on the default_base().
Might return an unknown terrain, if there's a typo in the default base.
If this terrain has no overlay, it returns the terrain itself, ignoring the default_base() even if the terrain has a default_base().
This is intended for the editor's single-layer placement, or for replacing terrains via ActionWML, where the user or WML author intends to only use one layer of the current terrain.
Definition at line 291 of file terrain.cpp.
References t_translation::terrain_code::base, editor_default_base_, has_default_base(), number_, t_translation::terrain_code::overlay, and overlay_.
Referenced by editor::map_context::draw_terrain(), and terrain_type_data::merge_terrains().
|
inline |
Definition at line 78 of file terrain.hpp.
References union_type_.
Referenced by help::terrain_topic_generator::operator()().
|
inline |
Definition at line 137 of file terrain.hpp.
References height_adjust_.
Referenced by unit_animation_component::invalidate(), and unit_drawer::redraw_unit().
|
inline |
Definition at line 138 of file terrain.hpp.
References submerge_.
Referenced by display::draw_overlays_at(), and unit_drawer::redraw_unit().
|
inline |
Definition at line 77 of file terrain.hpp.
References vision_type_.
|
private |
Definition at line 255 of file terrain.hpp.
Referenced by is_castle(), and operator==().
|
private |
Definition at line 257 of file terrain.hpp.
Referenced by is_combined(), and operator==().
|
private |
Definition at line 234 of file terrain.hpp.
Referenced by def_type(), operator==(), and terrain_type().
|
private |
Definition at line 224 of file terrain.hpp.
Referenced by description(), and terrain_type().
|
private |
Definition at line 258 of file terrain.hpp.
Referenced by default_base(), has_default_base(), operator==(), and terrain_with_default_base().
|
private |
Definition at line 253 of file terrain.hpp.
Referenced by editor_group(), and set_editor_group().
|
private |
The image used in the editor palette if not defined in WML it will be initialized with the value of minimap_image_.
Definition at line 220 of file terrain.hpp.
Referenced by editor_image(), operator==(), and terrain_type().
|
private |
Definition at line 223 of file terrain.hpp.
Referenced by editor_name(), and operator==().
|
private |
Definition at line 246 of file terrain.hpp.
Referenced by gives_healing(), and operator==().
|
private |
Definition at line 237 of file terrain.hpp.
Referenced by operator==(), terrain_type(), and unit_height_adjust().
|
private |
Definition at line 238 of file terrain.hpp.
Referenced by operator==(), and terrain_type().
|
private |
Definition at line 225 of file terrain.hpp.
Referenced by help_topic_text().
|
private |
Definition at line 259 of file terrain.hpp.
Referenced by hide_help(), and operator==().
|
private |
Definition at line 259 of file terrain.hpp.
Referenced by hide_if_impassable().
|
private |
Definition at line 259 of file terrain.hpp.
Referenced by hide_in_editor(), operator==(), and terrain_type().
|
private |
The image used as symbol icon.
Definition at line 210 of file terrain.hpp.
Referenced by icon_image().
|
private |
Definition at line 221 of file terrain.hpp.
Referenced by id(), and operator==().
|
private |
Definition at line 248 of file terrain.hpp.
Referenced by income_description(), and terrain_type().
|
private |
Definition at line 249 of file terrain.hpp.
Referenced by income_description_ally(), and terrain_type().
|
private |
Definition at line 250 of file terrain.hpp.
Referenced by income_description_enemy(), and terrain_type().
|
private |
Definition at line 251 of file terrain.hpp.
Referenced by income_description_own(), and terrain_type().
|
private |
Definition at line 255 of file terrain.hpp.
Referenced by is_keep(), and operator==().
|
private |
Definition at line 243 of file terrain.hpp.
Referenced by light_bonus(), and operator==().
|
private |
Definition at line 244 of file terrain.hpp.
Referenced by light_bonus(), and operator==().
|
private |
Definition at line 245 of file terrain.hpp.
Referenced by light_bonus(), and operator==().
|
private |
The image used in the minimap.
Definition at line 213 of file terrain.hpp.
Referenced by minimap_image(), operator==(), and terrain_type().
|
private |
Definition at line 214 of file terrain.hpp.
Referenced by minimap_image_overlay(), and operator==().
|
private |
Definition at line 232 of file terrain.hpp.
Referenced by is_mvt_indivisible(), mvt_type(), operator==(), and terrain_type().
|
private |
Definition at line 222 of file terrain.hpp.
Referenced by description(), name(), operator==(), and terrain_type().
|
private |
Definition at line 231 of file terrain.hpp.
Referenced by is_indivisible(), is_mvt_indivisible(), is_nonnull(), number(), operator==(), terrain_type(), and terrain_with_default_base().
|
private |
Definition at line 257 of file terrain.hpp.
Referenced by is_overlay(), operator==(), and terrain_with_default_base().
|
private |
Definition at line 240 of file terrain.hpp.
Referenced by operator==(), terrain_type(), and unit_submerge().
|
private |
Definition at line 241 of file terrain.hpp.
Referenced by operator==(), and terrain_type().
|
private |
Definition at line 235 of file terrain.hpp.
Referenced by is_indivisible(), operator==(), terrain_type(), and union_type().
|
private |
Definition at line 255 of file terrain.hpp.
Referenced by is_village(), operator==(), and terrain_type().
|
private |
Definition at line 233 of file terrain.hpp.
Referenced by operator==(), terrain_type(), and vision_type().