Skip to content

Commit

Permalink
Added optional [tile] no_draw=<bool> to exclude images from a hex
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ln-zookeeper committed Mar 30, 2016
1 parent 0360184 commit 085afa0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/terrain/builder.cpp
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/terrain/builder.hpp
Expand Up @@ -256,6 +256,7 @@ class terrain_builder
set_flag(),
no_flag(),
has_flag(),
no_draw(),
images()
{}

Expand All @@ -265,6 +266,7 @@ class terrain_builder
set_flag(),
no_flag(),
has_flag(),
no_draw(),
images()
{}

Expand All @@ -273,6 +275,10 @@ class terrain_builder
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;
};

Expand Down

0 comments on commit 085afa0

Please sign in to comment.