summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/menu.cc
diff options
context:
space:
mode:
authorKyle Fox <kylejfox@gmail.com>2013-04-17 12:05:29 -0500
committerFlorian Diebold <flodiebold@gmail.com>2013-04-28 12:52:54 +0200
commit8e1f0a710952af69f09dea14dd529ee7f1929380 (patch)
tree430767b18911dc21516f4468ee1047d59f1d8897 /crawl-ref/source/menu.cc
parent0387c0aff6f5b11d0ef75c805b1eed64d26058c9 (diff)
downloadcrawl-ref-8e1f0a710952af69f09dea14dd529ee7f1929380.tar.gz
crawl-ref-8e1f0a710952af69f09dea14dd529ee7f1929380.zip
Enabled aptitudes and species info hotkeys to work when selecting character.
The start and end values for the webtiles menus were not being updated correctly when a jump_to was used before the menu actually appeared. Signed-off-by: Florian Diebold <flodiebold@gmail.com>
Diffstat (limited to 'crawl-ref/source/menu.cc')
-rw-r--r--crawl-ref/source/menu.cc38
1 files changed, 22 insertions, 16 deletions
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index 3de382bf3e..21b58fb5a1 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -1603,6 +1603,26 @@ void Menu::webtiles_write_item(int index, const MenuEntry* me) const
tiles.json_close_object();
}
+
+void Menu::webtiles_new_first_entry()
+{
+ if (first_entry < webtiles_section_start()
+ || webtiles_section_end() <= first_entry)
+ {
+ _webtiles_section_start = first_entry;
+ while (_webtiles_section_start > 0
+ && items[_webtiles_section_start]->level != MEL_TITLE)
+ {
+ _webtiles_section_start--;
+ }
+ _webtiles_section_end = first_entry + 1;
+ while (_webtiles_section_end < (int) items.size()
+ && items[_webtiles_section_end]->level != MEL_TITLE)
+ {
+ _webtiles_section_end++;
+ }
+ }
+}
#endif // USE_TILE_WEB
/////////////////////////////////////////////////////////////////
@@ -1859,22 +1879,7 @@ bool formatted_scroller::jump_to(int i)
first_entry = i - 1;
#ifdef USE_TILE_WEB
- if (first_entry < webtiles_section_start()
- || webtiles_section_end() <= first_entry)
- {
- _webtiles_section_start = first_entry;
- while (_webtiles_section_start > 0
- && items[_webtiles_section_start]->level != MEL_TITLE)
- {
- _webtiles_section_start--;
- }
- _webtiles_section_end = first_entry + 1;
- while (_webtiles_section_end < (int) items.size()
- && items[_webtiles_section_end]->level != MEL_TITLE)
- {
- _webtiles_section_end++;
- }
- }
+ webtiles_new_first_entry();
webtiles_write_menu(true);
#endif
@@ -1966,6 +1971,7 @@ vector<MenuEntry *> formatted_scroller::show(bool reuse_selections)
{
_webtiles_section_end++;
}
+ webtiles_new_first_entry();
#endif
return Menu::show(reuse_selections);
}