26 #define ERR_G LOG_STREAM(err, lg::general())
27 #define WRN_G LOG_STREAM(warn, lg::general())
28 #define LOG_G LOG_STREAM(info, lg::general())
29 #define DBG_G LOG_STREAM(debug, lg::general())
33 minimap_image_overlay_(),
46 height_adjust_set_(false),
49 light_modification_(0),
53 income_description_(),
54 income_description_ally_(),
55 income_description_enemy_(),
56 income_description_own_(),
65 hide_in_editor_(false)
69 icon_image_(cfg[
"icon_image"]),
70 minimap_image_(cfg[
"symbol_image"]),
71 minimap_image_overlay_(),
72 editor_image_(cfg[
"editor_image"].empty() ?
"terrain/" + minimap_image_ +
".png" :
"terrain/" + cfg[
"editor_image"].str() +
".png"),
74 name_(cfg[
"name"].t_str()),
75 editor_name_(cfg[
"editor_name"].t_str()),
76 description_(cfg[
"description"].t_str()),
77 help_topic_text_(cfg[
"help_topic_text"].t_str()),
83 height_adjust_(cfg[
"unit_height_adjust"]),
84 height_adjust_set_(!cfg[
"unit_height_adjust"].empty()),
85 submerge_(cfg[
"submerge"].to_double()),
86 submerge_set_(!cfg[
"submerge"].empty()),
87 light_modification_(cfg[
"light"]),
88 max_light_(cfg[
"max_light"].to_int(light_modification_)),
89 min_light_(cfg[
"min_light"].to_int(light_modification_)),
91 income_description_(),
92 income_description_ally_(),
93 income_description_enemy_(),
94 income_description_own_(),
95 editor_group_(cfg[
"editor_group"]),
96 village_(cfg[
"gives_income"].to_bool()),
97 castle_(cfg[
"recruit_onto"].to_bool()),
98 keep_(cfg[
"recruit_from"].to_bool()),
102 hide_help_(cfg[
"hide_help"].to_bool(false)),
103 hide_in_editor_(cfg[
"hidden"].to_bool(false))
142 if(!mvt_alias.empty()) {
147 if(!def_alias.empty()) {
152 if(!vision_alias.empty()) {
199 minimap_image_(base.minimap_image_),
200 minimap_image_overlay_(overlay.minimap_image_),
201 editor_image_(base.editor_image_ +
"~BLIT(" + overlay.editor_image_ +
")"),
203 name_(overlay.name_),
204 editor_name_((base.editor_name_.empty() ? base.name_ : base.editor_name_) +
" / " + (overlay.editor_name_.empty() ? overlay.name_ : overlay.editor_name_)),
205 description_(overlay.description()),
207 number_(
t_translation::t_terrain(base.number_.base, overlay.number_.overlay)),
208 mvt_type_(overlay.mvt_type_),
209 vision_type_(overlay.vision_type_),
210 def_type_(overlay.def_type_),
212 height_adjust_(base.height_adjust_),
213 height_adjust_set_(base.height_adjust_set_),
214 submerge_(base.submerge_),
215 submerge_set_(base.submerge_set_),
216 light_modification_(base.light_modification_ + overlay.light_modification_),
217 max_light_(
std::max(base.max_light_, overlay.max_light_)),
218 min_light_(
std::min(base.min_light_, overlay.min_light_)),
219 heals_(
std::max<
int>(base.heals_, overlay.heals_)),
220 income_description_(),
221 income_description_ally_(),
222 income_description_enemy_(),
223 income_description_own_(),
225 village_(base.village_ || overlay.village_),
226 castle_(base.castle_ || overlay.castle_),
227 keep_(base.keep_ || overlay.keep_),
230 editor_default_base_(),
231 hide_help_(base.hide_help_ || overlay.hide_help_),
232 hide_in_editor_(base.hide_in_editor_ || overlay.hide_in_editor_)
318 std::map<t_translation::t_terrain, terrain_type>& letter_to_terrain)
323 DBG_G <<
"create_terrain_maps: " << terrain.
number() <<
" "
327 res = letter_to_terrain.insert(std::make_pair(terrain.
number(),
terrain));
330 if(terrain == curr) {
332 <<
": " << terrain.
id() <<
" (" << terrain.
name() <<
")\n";
335 std::set<std::string> egs;
336 bool clean_merge =
true;
338 clean_merge &= egs.insert(
t).second;
341 clean_merge &= egs.insert(
t).second;
347 LOG_G <<
"Editor groups merged to: " << joined <<
"\n";
350 <<
": " << terrain.
id() <<
" (" << terrain.
name() <<
") "
351 <<
"with duplicate editor groups [" << terrain.
editor_group() <<
"] "
355 ERR_G <<
"Duplicate terrain code definition found for " << terrain.
number() <<
"\n"
356 <<
"Failed to add terrain " << terrain.
id() <<
" (" << terrain.
name() <<
") "
358 <<
"which conflicts with " << curr.
id() <<
" (" << curr.
name() <<
") "
362 terrain_list.push_back(terrain.
number());
374 for(i = first.begin(); i != first.end(); ++
i) {
397 first.insert(insert_it, second.begin(), second.end());
std::string minimap_image_overlay_
bool operator==(const terrain_type &other) const
t_list read_list(const std::string &str, const t_layer filler)
Reads a list of terrains from a string, when reading the.
t_translation::t_terrain number_
const t_terrain NONE_TERRAIN
t_translation::t_list mvt_type_
t_string income_description_
std::string editor_image_
The image used in the editor palette if not defined in WML it will be initialized with the value of m...
const t_string & name() const
const std::string & id() const
const std::string & editor_group() const
t_terrain read_terrain_code(const std::string &str, const t_layer filler)
Reads a single terrain from a string.
t_string income_description_own_
std::pair< const_child_iterator, const_child_iterator > const_child_itors
std::string missing_mandatory_wml_key(const std::string §ion, const std::string &key, const std::string &primary_key, const std::string &primary_value)
Returns a standard message for a missing wml key.
static UNUSEDNOWARN std::string _(const char *str)
t_string income_description_ally_
#define VALIDATE(cond, message)
The macro to use for the validation of WML.
t_translation::t_terrain number() const
t_translation::t_terrain editor_default_base_
static const ::config * terrain
The terrain used to create the cache.
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
Templates and utility-routines for strings and numbers.
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...
std::string join(T const &v, const std::string &s=",")
Generates a new string joining container items in a list.
std::string base_str() const
static lg::log_domain log_config("config")
void merge_alias_lists(t_translation::t_list &first, const t_translation::t_list &second)
t_translation::t_terrain terrain_with_default_base() const
t_translation::t_list vision_type_
std::string minimap_image_
The image used in the minimap.
static int sort(lua_State *L)
std::string write_terrain_code(const t_terrain &tcode)
Writes a single terrain code to a string.
const t_terrain VOID_TERRAIN
t_string income_description_enemy_
void set_editor_group(const std::string &str)
t_translation::t_list def_type_
void create_terrain_maps(const config::const_child_itors &cfgs, t_translation::t_list &terrain_list, std::map< t_translation::t_terrain, terrain_type > &letter_to_terrain)
Standard logging facilities (interface).
const std::string remove
remove directive
std::vector< std::string > split(std::string const &val, const char c, const int flags)
Splits a (comma-)separated string into a vector of pieces.
t_translation::t_list union_type_
A config object defines a single node in a WML file, with access to child nodes.
const t_string & description() const
GLsizei const GLcharARB ** string
std::vector< t_terrain > t_list