#include <type_data.hpp>
Public Types | |
enum | tmerge_mode { BASE, OVERLAY, BOTH } |
Public Member Functions | |
terrain_type_data (const config &game_config) | |
const t_translation::t_list & | list () const |
const std::map < t_translation::t_terrain, terrain_type > & | map () const |
const terrain_type & | get_terrain_info (const t_translation::t_terrain &terrain) const |
Get the corresponding terrain_type information object for a given type of terrain. More... | |
const t_translation::t_list & | underlying_mvt_terrain (const t_translation::t_terrain &terrain) const |
const t_translation::t_list & | underlying_def_terrain (const t_translation::t_terrain &terrain) const |
const t_translation::t_list & | underlying_union_terrain (const t_translation::t_terrain &terrain) const |
std::string | get_terrain_string (const t_translation::t_terrain &terrain) const |
Get a formatted terrain name – terrain (underlying, terrains) More... | |
std::string | get_terrain_editor_string (const t_translation::t_terrain &terrain) const |
std::string | get_underlying_terrain_string (const t_translation::t_terrain &terrain) const |
bool | is_village (const t_translation::t_terrain &terrain) const |
int | gives_healing (const t_translation::t_terrain &terrain) const |
bool | is_castle (const t_translation::t_terrain &terrain) const |
bool | is_keep (const t_translation::t_terrain &terrain) const |
t_translation::t_terrain | merge_terrains (const t_translation::t_terrain &old_t, const t_translation::t_terrain &new_t, const tmerge_mode mode, bool replace_if_failed=false) |
Tries to merge old and new terrain using the merge_settings config Relevant parameters are "layer" and "replace_conflicting" "layer" specifies the layer that should be replaced (base or overlay, default is both). More... | |
bool | try_merge_terrains (const t_translation::t_terrain &terrain) |
Tries to find out if "terrain" can be created by combining two existing terrains Will add the resulting terrain to the terrain list if successful. More... | |
Private Attributes | |
t_translation::t_list | terrainList_ |
std::map < t_translation::t_terrain, terrain_type > | tcodeToTerrain_ |
bool | initialized_ |
const config & | game_config_ |
Definition at line 23 of file type_data.hpp.
Enumerator | |
---|---|
BASE | |
OVERLAY | |
BOTH |
Definition at line 66 of file type_data.hpp.
terrain_type_data::terrain_type_data | ( | const config & | game_config | ) |
Definition at line 23 of file type_data.cpp.
std::string terrain_type_data::get_terrain_editor_string | ( | const t_translation::t_terrain & | terrain | ) | const |
Definition at line 119 of file type_data.cpp.
References terrain_type::description(), terrain_type::editor_name(), get_terrain_info(), and get_underlying_terrain_string().
const terrain_type & terrain_type_data::get_terrain_info | ( | const t_translation::t_terrain & | terrain | ) | const |
Get the corresponding terrain_type information object for a given type of terrain.
Definition at line 53 of file type_data.cpp.
References game_config::default_terrain, i, and tcodeToTerrain_.
Referenced by get_terrain_editor_string(), get_terrain_string(), get_underlying_terrain_string(), image::getMinimap(), gives_healing(), is_castle(), is_keep(), is_village(), and merge_terrains().
std::string terrain_type_data::get_terrain_string | ( | const t_translation::t_terrain & | terrain | ) | const |
Get a formatted terrain name – terrain (underlying, terrains)
Definition at line 109 of file type_data.cpp.
References terrain_type::description(), get_terrain_info(), and get_underlying_terrain_string().
std::string terrain_type_data::get_underlying_terrain_string | ( | const t_translation::t_terrain & | terrain | ) | const |
Definition at line 136 of file type_data.cpp.
References get_terrain_info(), i, terrain_type::name(), gui2::terrain, and underlying_union_terrain().
Referenced by get_terrain_editor_string(), and get_terrain_string().
|
inline |
Definition at line 59 of file type_data.hpp.
References get_terrain_info(), and terrain_type::gives_healing().
|
inline |
Definition at line 61 of file type_data.hpp.
References get_terrain_info(), and terrain_type::is_castle().
|
inline |
Definition at line 63 of file type_data.hpp.
References get_terrain_info(), and terrain_type::is_keep().
|
inline |
Definition at line 57 of file type_data.hpp.
References get_terrain_info(), and terrain_type::is_village().
const t_translation::t_list & terrain_type_data::list | ( | ) | const |
Definition at line 31 of file type_data.cpp.
References config::child_range(), create_terrain_maps(), game_config_, initialized_, tcodeToTerrain_, and terrainList_.
const std::map< t_translation::t_terrain, terrain_type > & terrain_type_data::map | ( | ) | const |
Definition at line 42 of file type_data.cpp.
References config::child_range(), create_terrain_maps(), game_config_, initialized_, tcodeToTerrain_, and terrainList_.
t_translation::t_terrain terrain_type_data::merge_terrains | ( | const t_translation::t_terrain & | old_t, |
const t_translation::t_terrain & | new_t, | ||
const tmerge_mode | mode, | ||
bool | replace_if_failed = false |
||
) |
Tries to merge old and new terrain using the merge_settings config Relevant parameters are "layer" and "replace_conflicting" "layer" specifies the layer that should be replaced (base or overlay, default is both).
If "replace_conflicting" is true the new terrain will replace the old one if merging failed (using the default base if new terrain is an overlay terrain) Will return the resulting terrain or NONE_TERRAIN if merging failed
Definition at line 177 of file type_data.cpp.
References t_translation::t_terrain::base, BASE, BOTH, terrain_type::default_base(), get_terrain_info(), t_translation::NO_LAYER, t_translation::NONE_TERRAIN, t_translation::t_terrain::overlay, OVERLAY, tcodeToTerrain_, terrain_type::terrain_with_default_base(), and try_merge_terrains().
bool terrain_type_data::try_merge_terrains | ( | const t_translation::t_terrain & | terrain | ) |
Tries to find out if "terrain" can be created by combining two existing terrains Will add the resulting terrain to the terrain list if successful.
Definition at line 156 of file type_data.cpp.
References t_translation::t_terrain::base, t_translation::NO_LAYER, terrain_type::number(), t_translation::t_terrain::overlay, tcodeToTerrain_, and terrainList_.
Referenced by merge_terrains().
const t_translation::t_list & terrain_type_data::underlying_def_terrain | ( | const t_translation::t_terrain & | terrain | ) | const |
Definition at line 79 of file type_data.cpp.
References i, tcodeToTerrain_, and gui2::terrain.
const t_translation::t_list & terrain_type_data::underlying_mvt_terrain | ( | const t_translation::t_terrain & | terrain | ) | const |
Definition at line 65 of file type_data.cpp.
References i, tcodeToTerrain_, and gui2::terrain.
const t_translation::t_list & terrain_type_data::underlying_union_terrain | ( | const t_translation::t_terrain & | terrain | ) | const |
Definition at line 93 of file type_data.cpp.
References i, tcodeToTerrain_, and gui2::terrain.
Referenced by get_underlying_terrain_string(), and image::getMinimap().
|
private |
Definition at line 29 of file type_data.hpp.
|
mutableprivate |
Definition at line 28 of file type_data.hpp.
|
mutableprivate |
Definition at line 26 of file type_data.hpp.
Referenced by get_terrain_info(), list(), map(), merge_terrains(), try_merge_terrains(), underlying_def_terrain(), underlying_mvt_terrain(), and underlying_union_terrain().
|
mutableprivate |
Definition at line 25 of file type_data.hpp.
Referenced by list(), map(), and try_merge_terrains().