summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/menu.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2014-05-29 01:51:17 -0400
committerNeil Moore <neil@s-z.org>2014-05-29 02:22:32 -0400
commit2575cb8483d517b687f94f9671abcc72a34a6670 (patch)
tree48601dcb192f5c369d8a01fc158deeaa419d2bf6 /crawl-ref/source/menu.cc
parenta22ca7f95ff93f2a5e81679baa613107dd0573c5 (diff)
downloadcrawl-ref-2575cb8483d517b687f94f9671abcc72a34a6670.tar.gz
crawl-ref-2575cb8483d517b687f94f9671abcc72a34a6670.zip
Make the menu cursor skip unselectables.
Diffstat (limited to 'crawl-ref/source/menu.cc')
-rw-r--r--crawl-ref/source/menu.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index 1eb6164e4a..3dabf281d5 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -367,10 +367,15 @@ int Menu::get_cursor() const
if (last_selected == -1)
return -1;
+ unsigned int last = last_selected % item_count();
unsigned int next = (last_selected + 1) % item_count();
- if (items[next]->level != MEL_ITEM)
+ // Items with no hotkeys are unselectable
+ while (next != last && (items[next]->hotkeys.empty()
+ || items[next]->level != MEL_ITEM))
+ {
next = (next + 1) % item_count();
+ }
return next;
}