summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/view.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-24 07:14:31 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-24 07:14:31 +0000
commiteedd926a2de32ac965b9cae1dd30242f75c479f5 (patch)
treea33a5807eb98b6bb23963b90981fdfc6070abe03 /crawl-ref/source/view.cc
parented60b40c58c79b13abf54b1a53ae2e2f805a3728 (diff)
downloadcrawl-ref-eedd926a2de32ac965b9cae1dd30242f75c479f5.tar.gz
crawl-ref-eedd926a2de32ac965b9cae1dd30242f75c479f5.zip
In the level map fudge things somewhat when cycling through features:
entrances to Zot and the four Hell branches, plus gates to further levels of Pandemonium, can be cycled via '>', while exits from Zot, the Vestibule of Hell, Pandemonium and portal vaults can be cycled via '<'. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6106 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/view.cc')
-rw-r--r--crawl-ref/source/view.cc50
1 files changed, 48 insertions, 2 deletions
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 9f7f48ffd4..8bed707e4d 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -2710,6 +2710,7 @@ bool is_feature(int feature, int x, int y)
switch (grid)
{
case DNGN_ENTER_HELL:
+ case DNGN_EXIT_HELL:
case DNGN_ENTER_LABYRINTH:
case DNGN_ENTER_PORTAL_VAULT:
case DNGN_EXIT_PORTAL_VAULT:
@@ -2794,6 +2795,51 @@ bool is_feature(int feature, int x, int y)
}
}
+static bool _is_feature_fudged(int feature, int x, int y)
+{
+ if (!env.map[x][y].object)
+ return (false);
+
+ if (is_feature(feature, x, y))
+ return (true);
+
+ // 'grid' can fit in an unsigned char, but making this a short shuts up
+ // warnings about out-of-range case values.
+ short grid = grd[x][y];
+
+ if (feature == '<')
+ {
+ switch(grid)
+ {
+ case DNGN_EXIT_HELL:
+ case DNGN_EXIT_PORTAL_VAULT:
+ case DNGN_EXIT_ABYSS:
+ case DNGN_EXIT_PANDEMONIUM:
+ case DNGN_RETURN_FROM_ZOT:
+ return true;
+ default:
+ return (false);
+ }
+ }
+ else if (feature == '>')
+ {
+ switch (grid)
+ {
+ case DNGN_ENTER_DIS:
+ case DNGN_ENTER_GEHENNA:
+ case DNGN_ENTER_COCYTUS:
+ case DNGN_ENTER_TARTARUS:
+ case DNGN_TRANSIT_PANDEMONIUM:
+ case DNGN_ENTER_ZOT:
+ return (true);
+ default:
+ return (false);
+ }
+ }
+
+ return (false);
+}
+
static int _find_feature(int feature, int curs_x, int curs_y,
int start_x, int start_y, int anchor_x, int anchor_y,
int ignore_count, int *move_x, int *move_y)
@@ -2825,7 +2871,7 @@ static int _find_feature(int feature, int curs_x, int curs_y,
int x = cx + dx, y = cy + dy;
if (!in_bounds(x, y))
continue;
- if (is_feature(feature, x, y))
+ if (_is_feature_fudged(feature, x, y))
{
++matchcount;
if (!ignore_count--)
@@ -2879,7 +2925,7 @@ static int _find_feature( const std::vector<coord_def>& features,
{
const coord_def& coord = features[feat];
- if (is_feature(feature, coord.x, coord.y))
+ if (_is_feature_fudged(feature, coord.x, coord.y))
{
++matchcount;
if (forward? !ignore_count-- : --ignore_count == 1)