MCPcopy Create free account
hub / github.com/crawl/crawl / process_command

Method process_command

crawl-ref/source/menu.cc:1718–1902  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1716}
1717
1718bool Menu::process_command(command_type cmd)
1719{
1720 bool ret = true;
1721
1722#ifdef USE_TILE_WEB
1723 const int old_vis_first = get_first_visible();
1724#endif
1725
1726 // note -- MF_USE_TWO_COLUMNS doesn't guarantee two cols!
1727 // currently guaranteed to be false except on local tiles
1728 const bool multicol = m_ui.menu->get_num_columns() > 1;
1729 const int old_hover = last_hovered;
1730
1731 switch (cmd)
1732 {
1733 case CMD_MENU_UP:
1734 if (is_set(MF_ARROWS_SELECT))
1735 {
1736 cycle_hover(true, false, true);
1737 if (last_hovered >= 0 && old_hover == last_hovered)
1738 line_up();
1739 }
1740 else
1741 line_up();
1742 break;
1743 case CMD_MENU_DOWN:
1744 if (is_set(MF_ARROWS_SELECT))
1745 {
1746 cycle_hover(false, false, true);
1747 if (last_hovered >= 0 && old_hover == last_hovered)
1748 line_down();
1749 }
1750 else
1751 line_down();
1752 break;
1753 case CMD_MENU_RIGHT:
1754 if (multicol && is_set(MF_ARROWS_SELECT))
1755 cycle_hover(false, true, false);
1756 else
1757 cycle_mode(true);
1758 break;
1759 case CMD_MENU_LEFT:
1760 if (multicol && is_set(MF_ARROWS_SELECT))
1761 cycle_hover(true, true, false);
1762 else
1763 cycle_mode(false);
1764 break;
1765
1766 case CMD_MENU_LINE_UP:
1767 line_up();
1768 break;
1769 case CMD_MENU_LINE_DOWN:
1770 line_down();
1771 break;
1772 case CMD_MENU_PAGE_UP:
1773 page_up();
1774 break;
1775 case CMD_MENU_PAGE_DOWN:

Callers

nothing calls this directly

Calls 13

cycle_hoverFunction · 0.85
line_upFunction · 0.85
line_downFunction · 0.85
set_hoveredFunction · 0.85
title_promptFunction · 0.85
show_specific_helpFunction · 0.85
update_titleFunction · 0.85
update_moreFunction · 0.85
get_num_columnsMethod · 0.80
set_scrollMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected