The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Private Attributes | List of all members
terrain_type_data Class Reference

#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_listlist () const
 
const std::map
< t_translation::t_terrain,
terrain_type > & 
map () const
 
const terrain_typeget_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_listunderlying_mvt_terrain (const t_translation::t_terrain &terrain) const
 
const t_translation::t_listunderlying_def_terrain (const t_translation::t_terrain &terrain) const
 
const t_translation::t_listunderlying_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 configgame_config_
 

Detailed Description

Definition at line 23 of file type_data.hpp.

Member Enumeration Documentation

Enumerator
BASE 
OVERLAY 
BOTH 

Definition at line 66 of file type_data.hpp.

Constructor & Destructor Documentation

terrain_type_data::terrain_type_data ( const config game_config)

Definition at line 23 of file type_data.cpp.

Member Function Documentation

std::string terrain_type_data::get_terrain_editor_string ( const t_translation::t_terrain terrain) const
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
int terrain_type_data::gives_healing ( const t_translation::t_terrain terrain) const
inline

Definition at line 59 of file type_data.hpp.

References get_terrain_info(), and terrain_type::gives_healing().

bool terrain_type_data::is_castle ( const t_translation::t_terrain terrain) const
inline

Definition at line 61 of file type_data.hpp.

References get_terrain_info(), and terrain_type::is_castle().

bool terrain_type_data::is_keep ( const t_translation::t_terrain terrain) const
inline

Definition at line 63 of file type_data.hpp.

References get_terrain_info(), and terrain_type::is_keep().

bool terrain_type_data::is_village ( const t_translation::t_terrain terrain) const
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
const std::map< t_translation::t_terrain, terrain_type > & terrain_type_data::map ( ) const
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().

Member Data Documentation

const config& terrain_type_data::game_config_
private

Definition at line 29 of file type_data.hpp.

Referenced by list(), and map().

bool terrain_type_data::initialized_
mutableprivate

Definition at line 28 of file type_data.hpp.

Referenced by list(), and map().

std::map<t_translation::t_terrain, terrain_type> terrain_type_data::tcodeToTerrain_
mutableprivate
t_translation::t_list terrain_type_data::terrainList_
mutableprivate

Definition at line 25 of file type_data.hpp.

Referenced by list(), map(), and try_merge_terrains().


The documentation for this class was generated from the following files: