diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-26 07:45:18 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-26 07:45:18 +0000 |
commit | f910f85b74d9dae832f8d3422f51d87565ea3a08 (patch) | |
tree | 5b10f62736e875a57e0380e4dc477af5774cc661 /crawl-ref/source/maps.cc | |
parent | f7f652ac0f4c5a193ee4ad5471a85cf723466e24 (diff) | |
download | crawl-ref-f910f85b74d9dae832f8d3422f51d87565ea3a08.tar.gz crawl-ref-f910f85b74d9dae832f8d3422f51d87565ea3a08.zip |
FR 1822931: Vaults can now include tags of the form "layout_foo" to
indicate which level layout types it's compatible with, where "foo"
can be: rooms, caves, open, city, or cross (plus swamp, shoals and
labyrinth, even though random vaults aren't used in those places).
Having no "layout_foo" tag means that the vault is compatible with
all layout types, which is the current behavior.
Also, fixed bug where layouts plan_1 (donut levels), plan_2 (cross
levels) and plan_6 (octagon with circle of pillars) were choosing
randomly from the three Lua defined layouts in dat/layout.des, rather
than choosing exactly the chosen layout.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5251 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/maps.cc')
-rw-r--r-- | crawl-ref/source/maps.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc index 044ae2a47f..2aeadcf73d 100644 --- a/crawl-ref/source/maps.cc +++ b/crawl-ref/source/maps.cc @@ -329,6 +329,14 @@ static bool vault_unforbidden(const map_def &map) you.uniq_map_tags.end())); } +static bool map_matches_layout_type(const map_def &map) +{ + if (dgn_Layout_Type.empty() || !map.has_tag_prefix("layout_")) + return true; + + return map.has_tag("layout_" + dgn_Layout_Type); +} + int find_map_by_name(const std::string &name) { for (unsigned i = 0, size = vdefs.size(); i < size; ++i) @@ -362,6 +370,7 @@ int random_map_for_place(const level_id &place, bool want_minivault) if (vdefs[i].place == place && vdefs[i].is_minivault() == want_minivault && !vdefs[i].has_tag("layout") + && map_matches_layout_type(vdefs[i]) && vault_unforbidden(vdefs[i])) { rollsize += vdefs[i].chance; @@ -388,6 +397,8 @@ int random_map_in_depth(const level_id &place, bool want_minivault) int mapindex = -1; int rollsize = 0; + const bool check_layout = (place == level_id::current()); + for (unsigned i = 0, size = vdefs.size(); i < size; ++i) if (vdefs[i].is_minivault() == want_minivault && !vdefs[i].place.is_valid() @@ -400,6 +411,7 @@ int random_map_in_depth(const level_id &place, bool want_minivault) && !vdefs[i].has_tag("unrand") && !vdefs[i].has_tag("bazaar") && !vdefs[i].has_tag("layout") + && (!check_layout || map_matches_layout_type(vdefs[i])) && vault_unforbidden(vdefs[i])) { rollsize += vdefs[i].chance; @@ -426,6 +438,7 @@ int random_map_for_tag(const std::string &tag, if (vdefs[i].has_tag(tag) && vdefs[i].is_minivault() == want_minivault && (!check_depth || !vdefs[i].has_depth() || vdefs[i].is_usable_in(level_id::current())) + && map_matches_layout_type(vdefs[i]) && vault_unforbidden(vdefs[i])) { rollsize += vdefs[i].chance; |