The Battle for Wesnoth  1.15.1+dev
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
terrain_type_data Class Reference

#include <type_data.hpp>

Public Types

enum  merge_mode { BASE, OVERLAY, BOTH }
 

Public Member Functions

 terrain_type_data (const config &game_config)
 
const t_translation::ter_listlist () const
 
const std::map< t_translation::terrain_code, terrain_type > & map () const
 
const terrain_typeget_terrain_info (const t_translation::terrain_code &terrain) const
 Get the corresponding terrain_type information object for a given type of terrain. More...
 
const t_translation::ter_listunderlying_mvt_terrain (const t_translation::terrain_code &terrain) const
 
const t_translation::ter_listunderlying_def_terrain (const t_translation::terrain_code &terrain) const
 
const t_translation::ter_listunderlying_union_terrain (const t_translation::terrain_code &terrain) const
 
std::string get_terrain_string (const t_translation::terrain_code &terrain) const
 Get a formatted terrain name – terrain (underlying, terrains) More...
 
std::string get_terrain_editor_string (const t_translation::terrain_code &terrain) const
 
std::string get_underlying_terrain_string (const t_translation::terrain_code &terrain) const
 
bool is_village (const t_translation::terrain_code &terrain) const
 
int gives_healing (const t_translation::terrain_code &terrain) const
 
bool is_castle (const t_translation::terrain_code &terrain) const
 
bool is_keep (const t_translation::terrain_code &terrain) const
 
t_translation::terrain_code merge_terrains (const t_translation::terrain_code &old_t, const t_translation::terrain_code &new_t, const merge_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::terrain_code &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 Types

using tcodeToTerrain_t = std::map< t_translation::terrain_code, terrain_type >
 

Private Member Functions

tcodeToTerrain_t::const_iterator find_or_merge (t_translation::terrain_code) const
 

Private Attributes

t_translation::ter_list terrainList_
 
tcodeToTerrain_t tcodeToTerrain_
 
bool initialized_
 
const configgame_config_
 

Detailed Description

Definition at line 21 of file type_data.hpp.

Member Typedef Documentation

◆ tcodeToTerrain_t

Definition at line 24 of file type_data.hpp.

Member Enumeration Documentation

◆ merge_mode

Enumerator
BASE 
OVERLAY 
BOTH 

Definition at line 65 of file type_data.hpp.

Constructor & Destructor Documentation

◆ terrain_type_data()

terrain_type_data::terrain_type_data ( const config game_config)

Definition at line 21 of file type_data.cpp.

Member Function Documentation

◆ find_or_merge()

terrain_type_data::tcodeToTerrain_t::const_iterator terrain_type_data::find_or_merge ( t_translation::terrain_code  terrain) const
private

◆ get_terrain_editor_string()

std::string terrain_type_data::get_terrain_editor_string ( const t_translation::terrain_code terrain) const

◆ get_terrain_info()

const terrain_type & terrain_type_data::get_terrain_info ( const t_translation::terrain_code terrain) const

◆ get_terrain_string()

std::string terrain_type_data::get_terrain_string ( const t_translation::terrain_code terrain) const

Get a formatted terrain name – terrain (underlying, terrains)

Definition at line 108 of file type_data.cpp.

References terrain_type::description(), get_terrain_info(), and get_underlying_terrain_string().

◆ get_underlying_terrain_string()

std::string terrain_type_data::get_underlying_terrain_string ( const t_translation::terrain_code terrain) const

◆ gives_healing()

int terrain_type_data::gives_healing ( const t_translation::terrain_code terrain) const
inline

Definition at line 58 of file type_data.hpp.

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

◆ is_castle()

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

Definition at line 60 of file type_data.hpp.

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

◆ is_keep()

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

Definition at line 62 of file type_data.hpp.

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

◆ is_village()

bool terrain_type_data::is_village ( const t_translation::terrain_code terrain) const
inline

Definition at line 56 of file type_data.hpp.

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

◆ list()

const t_translation::ter_list & terrain_type_data::list ( ) const

◆ map()

const std::map< t_translation::terrain_code, terrain_type > & terrain_type_data::map ( ) const

◆ merge_terrains()

t_translation::terrain_code terrain_type_data::merge_terrains ( const t_translation::terrain_code old_t,
const t_translation::terrain_code new_t,
const merge_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 180 of file type_data.cpp.

References t_translation::terrain_code::base, BASE, BOTH, terrain_type::default_base(), get_terrain_info(), t_translation::NO_LAYER, t_translation::NONE_TERRAIN, t_translation::terrain_code::overlay, OVERLAY, t, tcodeToTerrain_, terrain_type::terrain_with_default_base(), and try_merge_terrains().

◆ try_merge_terrains()

bool terrain_type_data::try_merge_terrains ( const t_translation::terrain_code 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 175 of file type_data.cpp.

References find_or_merge(), and tcodeToTerrain_.

Referenced by merge_terrains().

◆ underlying_def_terrain()

const t_translation::ter_list & terrain_type_data::underlying_def_terrain ( const t_translation::terrain_code terrain) const

Definition at line 79 of file type_data.cpp.

References find_or_merge(), i, tcodeToTerrain_, and gui2::terrain.

◆ underlying_mvt_terrain()

const t_translation::ter_list & terrain_type_data::underlying_mvt_terrain ( const t_translation::terrain_code terrain) const

Definition at line 63 of file type_data.cpp.

References find_or_merge(), i, tcodeToTerrain_, and gui2::terrain.

◆ underlying_union_terrain()

const t_translation::ter_list & terrain_type_data::underlying_union_terrain ( const t_translation::terrain_code terrain) const

Definition at line 92 of file type_data.cpp.

References i, tcodeToTerrain_, and gui2::terrain.

Referenced by get_underlying_terrain_string(), and image::getMinimap().

Member Data Documentation

◆ game_config_

const config& terrain_type_data::game_config_
private

Definition at line 28 of file type_data.hpp.

Referenced by list(), and map().

◆ initialized_

bool terrain_type_data::initialized_
mutableprivate

Definition at line 27 of file type_data.hpp.

Referenced by list(), and map().

◆ tcodeToTerrain_

tcodeToTerrain_t terrain_type_data::tcodeToTerrain_
mutableprivate

◆ terrainList_

t_translation::ter_list terrain_type_data::terrainList_
mutableprivate

Definition at line 23 of file type_data.hpp.

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


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