summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2009-11-04 13:06:05 -0800
committerStefan O'Rear <stefanor@cox.net>2009-11-04 13:06:42 -0800
commit7d98adbee397d823ffbd77b8ea2e3be552f1c5f9 (patch)
tree0e9ca7f6566f331d5758b51850900d7b4f98124d
parent5eeaf5d109c3c19ebe83bc10278dbf5fffd37af8 (diff)
downloadcrawl-ref-7d98adbee397d823ffbd77b8ea2e3be552f1c5f9.tar.gz
crawl-ref-7d98adbee397d823ffbd77b8ea2e3be552f1c5f9.zip
[ and ] respect dungeon topology (by)
-rw-r--r--crawl-ref/source/cmd-keys.h1
-rw-r--r--crawl-ref/source/cmd-name.h1
-rw-r--r--crawl-ref/source/dat/database/help.txt1
-rw-r--r--crawl-ref/source/enum.h1
-rw-r--r--crawl-ref/source/travel.cc14
-rw-r--r--crawl-ref/source/travel.h3
-rw-r--r--crawl-ref/source/view.cc67
7 files changed, 17 insertions, 71 deletions
diff --git a/crawl-ref/source/cmd-keys.h b/crawl-ref/source/cmd-keys.h
index 6cda197429..5294c04ae0 100644
--- a/crawl-ref/source/cmd-keys.h
+++ b/crawl-ref/source/cmd-keys.h
@@ -284,7 +284,6 @@
{CK_SHIFT_HOME, CMD_MAP_JUMP_UP_LEFT},
{'[', CMD_MAP_PREV_LEVEL},
{']', CMD_MAP_NEXT_LEVEL},
-{'v', CMD_MAP_OTHER_BRANCH},
{'G', CMD_MAP_GOTO_LEVEL},
{'+', CMD_MAP_SCROLL_DOWN},
{CK_MOUSE_B5, CMD_MAP_SCROLL_DOWN},
diff --git a/crawl-ref/source/cmd-name.h b/crawl-ref/source/cmd-name.h
index c251802138..9940b8e548 100644
--- a/crawl-ref/source/cmd-name.h
+++ b/crawl-ref/source/cmd-name.h
@@ -132,7 +132,6 @@
{CMD_MAP_JUMP_DOWN_RIGHT, "CMD_MAP_JUMP_DOWN_RIGHT"},
{CMD_MAP_NEXT_LEVEL, "CMD_MAP_NEXT_LEVEL"},
{CMD_MAP_PREV_LEVEL, "CMD_MAP_PREV_LEVEL"},
-{CMD_MAP_OTHER_BRANCH, "CMD_MAP_OTHER_BRANCH"},
{CMD_MAP_GOTO_LEVEL, "CMD_MAP_GOTO_LEVEL"},
{CMD_MAP_SCROLL_DOWN, "CMD_MAP_SCROLL_DOWN"},
{CMD_MAP_SCROLL_UP, "CMD_MAP_SCROLL_UP"},
diff --git a/crawl-ref/source/dat/database/help.txt b/crawl-ref/source/dat/database/help.txt
index 477abdb88b..6f3d552032 100644
--- a/crawl-ref/source/dat/database/help.txt
+++ b/crawl-ref/source/dat/database/help.txt
@@ -68,7 +68,6 @@ level-map
<w>.</w> : Start travel (also <w>Enter</w> and <w>,</w> and <w>;</w>).
(Moves cursor to the last travel destination if still on @.)
<w>[</w>/<w>]</w> : Examine the next higher/lower level
-<w>v</w> : Examine a different level at the same depth
<w>G</w> : Go to another level by branch and depth
<h>Travel exclusions
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 2deffd9793..f8604c0c67 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -604,7 +604,6 @@ enum command_type
CMD_MAP_NEXT_LEVEL,
CMD_MAP_PREV_LEVEL,
- CMD_MAP_OTHER_BRANCH,
CMD_MAP_GOTO_LEVEL,
CMD_MAP_SCROLL_DOWN,
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 99cd5bc7bf..f7fd190d05 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -2092,7 +2092,7 @@ static bool _is_easy_exiting_branch(int branch)
return branches[branch].any_upstair_exits;
}
-static level_id _find_up_level(level_id curr, bool up_branch = false)
+level_id find_up_level(level_id curr, bool up_branch)
{
--curr.depth;
@@ -2123,10 +2123,10 @@ static level_id _find_up_level(level_id curr, bool up_branch = false)
static level_id _find_up_level()
{
- return (_find_up_level(level_id::current()));
+ return (find_up_level(level_id::current()));
}
-static level_id _find_down_level(level_id curr)
+level_id find_down_level(level_id curr)
{
if (curr.depth < branches[curr.branch].depth)
++curr.depth;
@@ -2147,7 +2147,7 @@ static level_id _find_deepest_explored(level_id curr)
static level_id _find_down_level()
{
- return (_find_down_level(level_id::current()));
+ return (find_down_level(level_id::current()));
}
static int _travel_depth_keyfilter(int &c)
@@ -2202,13 +2202,13 @@ static void _travel_depth_munge(int munge_method, const std::string &s,
redraw_screen();
return;
case '<':
- lid = _find_up_level(lid);
+ lid = find_up_level(lid);
break;
case '>':
- lid = _find_down_level(lid);
+ lid = find_down_level(lid);
break;
case '-':
- lid = _find_up_level(lid, true);
+ lid = find_up_level(lid, true);
break;
case '$':
lid = _find_deepest_explored(lid);
diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h
index 22afdfee8a..38f6bf0ae5 100644
--- a/crawl-ref/source/travel.h
+++ b/crawl-ref/source/travel.h
@@ -90,6 +90,9 @@ struct level_pos;
class level_id;
struct travel_target;
+level_id find_up_level(level_id curr, bool up_branch = false);
+level_id find_down_level(level_id curr);
+
void start_translevel_travel(const travel_target &pos);
void start_translevel_travel(bool prompt_for_destination = true);
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 87e18225a7..e499245913 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -2443,71 +2443,18 @@ void show_map( level_pos &spec_place, bool travel_mode, bool allow_esc )
case CMD_MAP_PREV_LEVEL:
case CMD_MAP_NEXT_LEVEL: {
- int best_score = 1000;
- level_id best_level;
+ level_id next;
- int cur_depth = level_id::current().dungeon_absdepth();
+ next = (cmd == CMD_MAP_PREV_LEVEL)
+ ? find_up_level(level_id::current())
+ : find_down_level(level_id::current());
- for (level_id_set::iterator it = Generated_Levels.begin();
- it != Generated_Levels.end(); ++it)
+ if (next.is_valid() && next != level_id::current()
+ && is_existing_level(next))
{
- int depth = it->dungeon_absdepth();
-
- int score = (depth - cur_depth) * 2;
-
- if (cmd == CMD_MAP_PREV_LEVEL)
- score *= -1;
-
- if (score <= 0)
- continue;
-
- if (it->branch == you.where_are_you
- && it->level_type == you.level_type)
- {
- --score;
- }
-
- if (score < best_score)
- {
- best_score = score;
- best_level = *it;
- }
- }
-
- if (best_score != 1000)
- {
- le.go_to(best_level);
- new_level = true;
- }
- break;
- }
-
- case CMD_MAP_OTHER_BRANCH: {
- level_id_set::iterator it = Generated_Levels.begin();
-
- while (*it != level_id::current())
- {
- ++it;
-
- if (it != Generated_Levels.end())
- goto no_depth_category;
- }
-
- do
- {
- ++it;
-
- if (it == Generated_Levels.end())
- it = Generated_Levels.begin();
- }
- while (it->dungeon_absdepth() != level_id::current().dungeon_absdepth());
-
- if (*it != level_id::current())
- {
- le.go_to(*it);
+ le.go_to(next);
new_level = true;
}
- no_depth_category:
break;
}