|
From: <gi...@cr...> - 2011-08-30 15:14:16
|
via f2140d3a3f37674feccbbb2c0a1f248eee48faea (commit)
via 4cac99eb86a8ab4194a5db7facb1e7c8dced5aa2 (commit)
from 1203519ab68e5e38fa0d89bfdc0d9dc53b17f57c (commit)
-----------------------------------------------------------------------
commit f2140d3a3f37674feccbbb2c0a1f248eee48faea
Author: Adam Borowski <kil...@an...>
Date: Tue Aug 30 17:12:18 2011 +0200
Fix &: pretending Snake is not a Lair branch.
commit 4cac99eb86a8ab4194a5db7facb1e7c8dced5aa2
Author: Adam Borowski <kil...@an...>
Date: Tue Aug 30 16:10:34 2011 +0200
Generalize checks for disabled Lair branches.
-----------------------------------------------------------------------
Summary of changes:
crawl-ref/source/branch.cc | 6 ++++++
crawl-ref/source/branch.h | 1 +
crawl-ref/source/dgn-overview.cc | 14 +++++---------
crawl-ref/source/mon-place.cc | 17 +++++++----------
crawl-ref/source/wiz-dgn.cc | 2 +-
5 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/crawl-ref/source/branch.cc b/crawl-ref/source/branch.cc
index b6616c1..59140dc 100644
--- a/crawl-ref/source/branch.cc
+++ b/crawl-ref/source/branch.cc
@@ -75,6 +75,12 @@ bool is_hell_subbranch(branch_type branch)
&& branch != BRANCH_VESTIBULE_OF_HELL);
}
+bool is_random_lair_subbranch(branch_type branch)
+{
+ return branches[branch].parent_branch == BRANCH_LAIR
+ && branch != BRANCH_SLIME_PITS;
+}
+
branch_type str_to_branch(const std::string &branch, branch_type err)
{
for (int i = 0; i < NUM_BRANCHES; ++i)
diff --git a/crawl-ref/source/branch.h b/crawl-ref/source/branch.h
index 3dfd0dd..b0ff7f9 100644
--- a/crawl-ref/source/branch.h
+++ b/crawl-ref/source/branch.h
@@ -56,6 +56,7 @@ Branch& your_branch();
bool at_branch_bottom();
bool is_hell_subbranch(branch_type branch);
+bool is_random_lair_subbranch(branch_type branch);
level_id branch_entry_level(branch_type branch);
level_id current_level_parent();
diff --git a/crawl-ref/source/dgn-overview.cc b/crawl-ref/source/dgn-overview.cc
index ebeff52..c809f38 100644
--- a/crawl-ref/source/dgn-overview.cc
+++ b/crawl-ref/source/dgn-overview.cc
@@ -413,28 +413,24 @@ static std::string _get_unseen_branches()
char buffer[100];
std::string disp;
- /* see if we need to hide a lair branch that doesn't exist */
- int possibly_missing_lair_branches = 0, missing_lair_branch = -1;
+ /* see if we need to hide lair branches that don't exist */
+ int seen_lair_branches = 0;
for (int i = BRANCH_FIRST_NON_DUNGEON; i < NUM_BRANCHES; i++)
{
const branch_type branch = branches[i].id;
- if (i != BRANCH_SWAMP && i != BRANCH_SNAKE_PIT && i != BRANCH_SHOALS)
+ if (!is_random_lair_subbranch(branch))
continue;
if (stair_level.find(branch) != stair_level.end())
- possibly_missing_lair_branches++;
- else
- missing_lair_branch = i;
+ seen_lair_branches++;
}
- if (possibly_missing_lair_branches < 2)
- missing_lair_branch = -1;
for (int i = BRANCH_FIRST_NON_DUNGEON; i < NUM_BRANCHES; i++)
{
const branch_type branch = branches[i].id;
- if (i == missing_lair_branch)
+ if (seen_lair_branches >= 2 && is_random_lair_subbranch(branch))
continue;
if (i == BRANCH_VESTIBULE_OF_HELL)
diff --git a/crawl-ref/source/mon-place.cc b/crawl-ref/source/mon-place.cc
index b36b1a0..6c27f46 100644
--- a/crawl-ref/source/mon-place.cc
+++ b/crawl-ref/source/mon-place.cc
@@ -1748,22 +1748,19 @@ static int _place_monster_aux(const mgen_data &mg,
bool got_stair = false;
// If we're in lair, and we're in one of the suitable levels,
- // and it's the disabled branch, pretend to be that one.
+ // and it's a disabled branch, pretend to be one of them.
if (you.where_are_you == BRANCH_LAIR)
{
- const branch_type lair_branches[3] =
- {
- BRANCH_SWAMP,
- BRANCH_SHOALS,
- BRANCH_SNAKE_PIT,
- };
+ int cnt = 0;
- for (int i = 0; i < 3; i++)
+ for (int i = 0; i < NUM_BRANCHES; i++)
{
- if (branches[lair_branches[i]].startdepth == -1)
+ if (is_random_lair_subbranch(branches[i].id)
+ && branches[i].startdepth == -1
+ && one_chance_in(++cnt))
{
mon->props["stair_type"] = static_cast<short>(
- branches[lair_branches[i]].entry_stairs);
+ branches[i].entry_stairs);
got_stair = true;
}
}
diff --git a/crawl-ref/source/wiz-dgn.cc b/crawl-ref/source/wiz-dgn.cc
index 8e5bf4d..a2654ca 100644
--- a/crawl-ref/source/wiz-dgn.cc
+++ b/crawl-ref/source/wiz-dgn.cc
@@ -377,7 +377,7 @@ void wizard_list_branches()
i, branches[i].longname, branches[i].startdepth,
branches[branches[i].parent_branch].abbrevname);
}
- else if (i == BRANCH_SWAMP || i == BRANCH_SHOALS)
+ else if (is_random_lair_subbranch((branch_type)i))
{
mprf(MSGCH_DIAGNOSTICS, "Branch %d (%s) was not generated "
"this game", i, branches[i].longname);
--
Dungeon Crawl Stone Soup
|