summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/maps.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-19 12:31:32 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-19 12:31:32 +0000
commitab679653017c1d661572cf34a62bf5ddf7c1304e (patch)
tree359b57bcf3e60574d64ce9c6ee4ca54a2d788807 /crawl-ref/source/maps.cc
parent73eb0f77865d30c6da027b85c716bce7edd3fa1b (diff)
downloadcrawl-ref-ab679653017c1d661572cf34a62bf5ddf7c1304e.tar.gz
crawl-ref-ab679653017c1d661572cf34a62bf5ddf7c1304e.zip
Added elf arrival vaults (Eino).
Tweaked dungeon builder so you always land on { on level 1 of a branch (using a map marker to identify which stair was a {). Maps with the "uniq" tag will be used only once in a game. Maps with a "uniq_foo" tag will be used only once, and will also prevent any other maps tagged "uniq_foo" from being used thereafter. Breaks saves. Oklob plants should not receive stab brands, fixed. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1897 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/maps.cc')
-rw-r--r--crawl-ref/source/maps.cc28
1 files changed, 25 insertions, 3 deletions
diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc
index 8d5845bde2..e8a1514296 100644
--- a/crawl-ref/source/maps.cc
+++ b/crawl-ref/source/maps.cc
@@ -283,6 +283,22 @@ static int apply_vault_definition(
///////////////////////////////////////////////////////////////////////////
// Map lookups
+template <typename I>
+static bool map_has_no_tags(const map_def &map, I begin, I end)
+{
+ for ( ; begin != end; ++begin)
+ if (map.has_tag(*begin))
+ return (false);
+ return (true);
+}
+
+static bool vault_unforbidden(const map_def &map)
+{
+ return (you.uniq_map_names.find(map.name) == you.uniq_map_names.end()
+ && map_has_no_tags(map, you.uniq_map_tags.begin(),
+ you.uniq_map_tags.end()));
+}
+
// Returns a map for which PLACE: matches the given place.
int random_map_for_place(const level_id &place, bool want_minivault)
{
@@ -296,7 +312,8 @@ int random_map_for_place(const level_id &place, bool want_minivault)
{
// We also accept tagged levels here.
if (vdefs[i].place == place
- && vdefs[i].is_minivault() == want_minivault)
+ && vdefs[i].is_minivault() == want_minivault
+ && vault_unforbidden(vdefs[i]))
{
rollsize += vdefs[i].chance;
@@ -305,6 +322,9 @@ int random_map_for_place(const level_id &place, bool want_minivault)
}
}
+ if (mapindex != -1 && vdefs[mapindex].has_tag("dummy"))
+ mapindex = -1;
+
#ifdef DEBUG_DIAGNOSTICS
if (mapindex != -1)
mprf(MSGCH_DIAGNOSTICS, "Found map %s for %s",
@@ -328,7 +348,8 @@ int random_map_in_depth(const level_id &place, bool want_minivault)
// showing up in the main dungeon.
&& !vdefs[i].has_tag_suffix("entry")
&& !vdefs[i].has_tag("pan")
- && !vdefs[i].has_tag("unrand"))
+ && !vdefs[i].has_tag("unrand")
+ && vault_unforbidden(vdefs[i]))
{
rollsize += vdefs[i].chance;
@@ -353,7 +374,8 @@ 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())))
+ || vdefs[i].is_usable_in(level_id::current()))
+ && vault_unforbidden(vdefs[i]))
{
rollsize += vdefs[i].chance;