Make [terrain_mask]border default to yes and imply the required border size
This commit is contained in:
parent
68363b3e21
commit
1b22a974c2
2 changed files with 3 additions and 23 deletions
|
@ -1181,17 +1181,11 @@ WML_HANDLER_FUNCTION(terrain_mask, /*event_info*/, cfg)
|
|||
|
||||
gamemap mask_map(resources::gameboard->map());
|
||||
|
||||
//config level;
|
||||
std::string mask = cfg["mask"];
|
||||
int border_size = 0;
|
||||
|
||||
if (mask.empty()) {
|
||||
border_size = cfg["border_size"];
|
||||
mask = cfg["data"].str();
|
||||
}
|
||||
bool border = cfg["border"].to_bool(true);
|
||||
|
||||
try {
|
||||
mask_map.read(mask, false, border_size);
|
||||
mask_map.read(mask, false, border);
|
||||
} catch(incorrect_map_format_error&) {
|
||||
ERR_NG << "terrain mask is in the incorrect format, and couldn't be applied" << std::endl;
|
||||
return;
|
||||
|
@ -1199,7 +1193,6 @@ WML_HANDLER_FUNCTION(terrain_mask, /*event_info*/, cfg)
|
|||
e.show(*resources::screen);
|
||||
return;
|
||||
}
|
||||
bool border = cfg["border"].to_bool();
|
||||
resources::gameboard->overlay_map(mask_map, cfg.get_parsed_config(), loc, border);
|
||||
resources::screen->needs_rebuild(true);
|
||||
}
|
||||
|
|
15
src/map.cpp
15
src/map.cpp
|
@ -337,8 +337,7 @@ void gamemap::overlay(const gamemap& m, const config& rules_cfg, int xpos, int y
|
|||
config::const_child_iterator rule = rules.first;
|
||||
for( ; rule != rules.second; ++rule)
|
||||
{
|
||||
static const std::string src_key = "old", src_not_key = "old_not",
|
||||
dst_key = "new", dst_not_key = "new_not";
|
||||
static const std::string src_key = "old", dst_key = "new";
|
||||
const config &cfg = *rule;
|
||||
const t_translation::t_list& src = t_translation::read_list(cfg[src_key]);
|
||||
|
||||
|
@ -346,24 +345,12 @@ void gamemap::overlay(const gamemap& m, const config& rules_cfg, int xpos, int y
|
|||
continue;
|
||||
}
|
||||
|
||||
const t_translation::t_list& src_not = t_translation::read_list(cfg[src_not_key]);
|
||||
|
||||
if(!src_not.empty() && t_translation::terrain_matches(current, src_not)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const t_translation::t_list& dst = t_translation::read_list(cfg[dst_key]);
|
||||
|
||||
if(!dst.empty() && t_translation::terrain_matches(t, dst) == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const t_translation::t_list& dst_not = t_translation::read_list(cfg[dst_not_key]);
|
||||
|
||||
if(!dst_not.empty() && t_translation::terrain_matches(t, dst_not)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue