Added optional [tile] no_draw=<bool> to exclude images from a hex

This can be used in rare cases when a multi-hex rule requires that a [tile] be used for matching purposes but without getting the image(s) drawn on it.
This commit is contained in:
ln-zookeeper 2016-03-30 18:51:55 +03:00
parent 0360184942
commit 085afa0e4a
2 changed files with 12 additions and 2 deletions

View file

@ -782,6 +782,8 @@ void terrain_builder::add_constraints(terrain_builder::constraint_set &constrain
item_string.begin(), item_string.end());
constraint.no_draw = cfg["no_draw"].to_bool(false);
add_images_from_config(constraint.images, cfg, false);
}
@ -1081,8 +1083,10 @@ void terrain_builder::apply_rule(const terrain_builder::building_rule &rule, con
tile& btile = tile_map_[tloc];
BOOST_FOREACH(const rule_image &img, constraint.images) {
btile.images.push_back(tile::rule_image_rand(&img, rand_seed));
if (!constraint.no_draw) {
BOOST_FOREACH(const rule_image &img, constraint.images) {
btile.images.push_back(tile::rule_image_rand(&img, rand_seed));
}
}
// Sets flags

View file

@ -256,6 +256,7 @@ public:
set_flag(),
no_flag(),
has_flag(),
no_draw(),
images()
{}
@ -265,6 +266,7 @@ public:
set_flag(),
no_flag(),
has_flag(),
no_draw(),
images()
{}
@ -273,6 +275,10 @@ public:
std::vector<std::string> set_flag;
std::vector<std::string> no_flag;
std::vector<std::string> has_flag;
/** Whether to actually draw the images onto this hex or not */
bool no_draw;
rule_imagelist images;
};