diff options
-rw-r--r-- | crawl-ref/source/command.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/travel.cc | 16 |
2 files changed, 19 insertions, 1 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index 5bd5fcfedc..304216d46f 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -582,7 +582,9 @@ static const char *interlevel_travel_depth_help = " <w>Enter</w> : Go to the default level.\n" " <w><<</w> : Change the default to one level above the current.\n" " <w>></w> : Change default to one level below the current.\n" - " <w>-</w>/<w>p</w> : Change default to the branch above this one.\n"; + " <w>-</w>/<w>p</w> : Change default to the branch above this one.\n" + " <w>$</w> : Change default to deepest visited level in this branch." + "\n"; // Add the contents of the file fp to the scroller menu m. // If first_hotkey is nonzero, that will be the hotkey for the diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 796df67a74..9cb7bec3bc 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -1960,6 +1960,17 @@ static level_id find_down_level(level_id curr) return (curr); } +static level_id find_deepest_explored(level_id curr) +{ + for (int i = branches[curr.branch].depth; i > 0; --i) + { + const level_id lid(curr.branch, i); + if (travel_cache.find_level_info(lid)) + return (lid); + } + return (curr); +} + static level_id find_down_level() { return (find_down_level(level_id::current())); @@ -1975,6 +1986,8 @@ static int travel_depth_keyfilter(int &c) case CONTROL('P'): case 'p': c = '-'; // Make uniform. return (-1); + case '$': + return (-1); default: return (1); } @@ -1998,6 +2011,9 @@ static void travel_depth_munge(int munge_method, branch_type *br, int *depth) case '-': lid = find_up_level(lid, true); break; + case '$': + lid = find_deepest_explored(lid); + break; } *br = lid.branch; *depth = lid.depth; |