#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 |
t_translation::terrain_code | terrain_with_default_base () const |
bool | operator== (const terrain_type &other) const |
Returns true if all 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 36 of file terrain.cpp.
|
explicit |
Constructor for terrains defined by a WML [terrain_type] tag.
Definition at line 74 of file terrain.cpp.
References _(), def_type_, deprecated_message(), editor_image_, t_string::empty(), 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(), gui2::dialogs::tip::remove(), 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 208 of file terrain.cpp.
References def_type_, description(), description_, t_string::empty(), 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, gui2::dialogs::tip::remove(), 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 |
Definition at line 169 of file terrain.hpp.
References editor_default_base_.
Referenced by editor::terrain_palette::setup_item().
|
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()(), editor::mouse_action::set_terrain_mouse_overlay(), and editor::terrain_palette::setup_item().
|
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 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(), image::getMinimap(), terrain_type_data::lazy_initialization(), help::terrain_topic_generator::operator()(), image::render_minimap(), 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 image::getMinimap(), 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(), image::getMinimap(), 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::getMinimap(), terrain_builder::rebuild_terrain(), and image::render_minimap().
|
inline |
Definition at line 46 of file terrain.hpp.
References minimap_image_overlay_.
Referenced by image::getMinimap(), terrain_builder::rebuild_terrain(), and image::render_minimap().
|
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 all 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 304 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 |
Definition at line 297 of file terrain.cpp.
References t_translation::terrain_code::base, editor_default_base_, t_translation::NONE_TERRAIN, 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_hex(), and unit_drawer::redraw_unit().
|
inline |
Definition at line 77 of file terrain.hpp.
References vision_type_.
|
private |
Definition at line 235 of file terrain.hpp.
Referenced by is_castle(), and operator==().
|
private |
Definition at line 237 of file terrain.hpp.
Referenced by is_combined(), and operator==().
|
private |
Definition at line 214 of file terrain.hpp.
Referenced by def_type(), operator==(), and terrain_type().
|
private |
Definition at line 204 of file terrain.hpp.
Referenced by description(), and terrain_type().
|
private |
Definition at line 238 of file terrain.hpp.
Referenced by default_base(), operator==(), and terrain_with_default_base().
|
private |
Definition at line 233 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 200 of file terrain.hpp.
Referenced by editor_image(), operator==(), and terrain_type().
|
private |
Definition at line 203 of file terrain.hpp.
Referenced by editor_name(), and operator==().
|
private |
Definition at line 226 of file terrain.hpp.
Referenced by gives_healing(), and operator==().
|
private |
Definition at line 217 of file terrain.hpp.
Referenced by operator==(), terrain_type(), and unit_height_adjust().
|
private |
Definition at line 218 of file terrain.hpp.
Referenced by operator==(), and terrain_type().
|
private |
Definition at line 205 of file terrain.hpp.
Referenced by help_topic_text().
|
private |
Definition at line 239 of file terrain.hpp.
Referenced by hide_help(), and operator==().
|
private |
Definition at line 239 of file terrain.hpp.
Referenced by hide_if_impassable().
|
private |
Definition at line 239 of file terrain.hpp.
Referenced by hide_in_editor(), operator==(), and terrain_type().
|
private |
The image used as symbol icon.
Definition at line 190 of file terrain.hpp.
Referenced by icon_image().
|
private |
Definition at line 201 of file terrain.hpp.
Referenced by id(), and operator==().
|
private |
Definition at line 228 of file terrain.hpp.
Referenced by income_description(), and terrain_type().
|
private |
Definition at line 229 of file terrain.hpp.
Referenced by income_description_ally(), and terrain_type().
|
private |
Definition at line 230 of file terrain.hpp.
Referenced by income_description_enemy(), and terrain_type().
|
private |
Definition at line 231 of file terrain.hpp.
Referenced by income_description_own(), and terrain_type().
|
private |
Definition at line 235 of file terrain.hpp.
Referenced by is_keep(), and operator==().
|
private |
Definition at line 223 of file terrain.hpp.
Referenced by light_bonus(), and operator==().
|
private |
Definition at line 224 of file terrain.hpp.
Referenced by light_bonus(), and operator==().
|
private |
Definition at line 225 of file terrain.hpp.
Referenced by light_bonus(), and operator==().
|
private |
The image used in the minimap.
Definition at line 193 of file terrain.hpp.
Referenced by minimap_image(), operator==(), and terrain_type().
|
private |
Definition at line 194 of file terrain.hpp.
Referenced by minimap_image_overlay(), and operator==().
|
private |
Definition at line 212 of file terrain.hpp.
Referenced by is_mvt_indivisible(), mvt_type(), operator==(), and terrain_type().
|
private |
Definition at line 202 of file terrain.hpp.
Referenced by description(), name(), operator==(), and terrain_type().
|
private |
Definition at line 211 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 237 of file terrain.hpp.
Referenced by is_overlay(), operator==(), and terrain_with_default_base().
|
private |
Definition at line 220 of file terrain.hpp.
Referenced by operator==(), terrain_type(), and unit_submerge().
|
private |
Definition at line 221 of file terrain.hpp.
Referenced by operator==(), and terrain_type().
|
private |
Definition at line 215 of file terrain.hpp.
Referenced by is_indivisible(), operator==(), terrain_type(), and union_type().
|
private |
Definition at line 235 of file terrain.hpp.
Referenced by is_village(), operator==(), and terrain_type().
|
private |
Definition at line 213 of file terrain.hpp.
Referenced by operator==(), terrain_type(), and vision_type().