summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-25 01:01:34 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-25 01:01:34 +0000
commit25827049ebef8e9335375d01a5c77468bd9a3b08 (patch)
tree3625d296a964a7af9e6e249f45e8f84b88fe9a85 /crawl-ref/source/mapdef.cc
parentf53c0fd020b3619b8488f23793c08fd39c160f29 (diff)
downloadcrawl-ref-25827049ebef8e9335375d01a5c77468bd9a3b08.tar.gz
crawl-ref-25827049ebef8e9335375d01a5c77468bd9a3b08.zip
Enable vault generation for non-LEVEL_DUNGEON levels, make ziggurat eligible for random gen in main dungeon and Pan; still needs entry portal timing/charging fixes, and ziggurat builder is still incomplete.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7601 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mapdef.cc')
-rw-r--r--crawl-ref/source/mapdef.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 48fc6fd2d8..8cbe27c026 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -103,7 +103,8 @@ std::string mapdef_split_key_item(const std::string &s,
//
level_range::level_range(branch_type br, int s, int d)
- : branch(br), shallowest(), deepest(), deny(false)
+ : level_type(LEVEL_DUNGEON), branch(br), shallowest(),
+ deepest(), deny(false)
{
set(s, d);
}
@@ -116,6 +117,7 @@ level_range::level_range(const raw_range &r)
void level_range::write(writer& outf) const
{
+ marshallShort(outf, level_type);
marshallShort(outf, branch);
marshallShort(outf, shallowest);
marshallShort(outf, deepest);
@@ -124,6 +126,7 @@ void level_range::write(writer& outf) const
void level_range::read(reader& inf)
{
+ level_type = static_cast<level_area_type>( unmarshallShort(inf) );
branch = static_cast<branch_type>( unmarshallShort(inf) );
shallowest = unmarshallShort(inf);
deepest = unmarshallShort(inf);
@@ -168,11 +171,9 @@ void level_range::set(const std::string &br, int s, int d)
{
if (br == "any" || br == "Any")
branch = NUM_BRANCHES;
- else
- {
- if ((branch = str_to_branch(br)) == NUM_BRANCHES)
- throw make_stringf("Unknown branch: '%s'", br.c_str());
- }
+ else if ((branch = str_to_branch(br)) == NUM_BRANCHES
+ && (level_type = str_to_level_area_type(br)) == LEVEL_DUNGEON)
+ throw make_stringf("Unknown branch: '%s'", br.c_str());
shallowest = s;
deepest = d;
@@ -263,12 +264,13 @@ void level_range::set(int s, int d)
void level_range::reset()
{
deepest = shallowest = -1;
+ level_type = LEVEL_DUNGEON;
}
bool level_range::matches(const level_id &lid) const
{
if (lid.level_type != LEVEL_DUNGEON)
- return (false);
+ return (lid.level_type == level_type);
if (branch == NUM_BRANCHES)
return (matches(absdungeon_depth(lid.branch, lid.depth)));
else
@@ -285,8 +287,11 @@ bool level_range::matches(int x) const
bool level_range::operator == (const level_range &lr) const
{
- return (deny == lr.deny && shallowest == lr.shallowest
- && deepest == lr.deepest && branch == lr.branch);
+ return (deny == lr.deny && level_type == lr.level_type
+ && (level_type != LEVEL_DUNGEON
+ || (shallowest == lr.shallowest
+ && deepest == lr.deepest
+ && branch == lr.branch)));
}
bool level_range::valid() const