MCPcopy Create free account
hub / github.com/NetHack/NetHack / do_look

Function do_look

src/pager.c:1672–1963  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1670const char what_is_a_location[] = "a monster, object or location";
1671
1672int
1673do_look(int mode, coord *click_cc)
1674{
1675 boolean quick = (mode == 1); /* use cursor; don't search for "more info" */
1676 boolean clicklook = (mode == 2); /* right mouse-click method */
1677 char out_str[BUFSZ] = DUMMY;
1678 struct _cmd_queue cq, *cmdq;
1679 const char *firstmatch = 0;
1680 struct permonst *pm = 0, *supplemental_pm = 0;
1681 int i = '\0', ans = 0;
1682 int sym; /* typed symbol or converted glyph */
1683 int found; /* count of matching syms found */
1684 coord cc; /* screen pos of unknown glyph */
1685 boolean save_verbose; /* saved value of flags.verbose */
1686 boolean from_screen; /* question from the screen */
1687 int clr = NO_COLOR;
1688
1689 cc.x = 0;
1690 cc.y = 0;
1691
1692 if ((cmdq = cmdq_pop()) != 0) {
1693 cq = *cmdq;
1694 free((genericptr_t) cmdq);
1695 if (cq.typ == CMDQ_KEY)
1696 i = cq.key;
1697 else
1698 cmdq_clear(CQ_CANNED);
1699 goto dowhatiscmd;
1700 }
1701
1702 if (!clicklook) {
1703 if (quick) {
1704 i = 'y';
1705 } else {
1706 menu_item *pick_list = (menu_item *) 0;
1707 winid win;
1708 anything any;
1709
1710 any = cg.zeroany;
1711 win = create_nhwindow(NHW_MENU);
1712 start_menu(win, MENU_BEHAVE_STANDARD);
1713
1714 /*
1715 * Originally this was just a y|n question about whether to
1716 * use the cursor or to type a word. When other choices were
1717 * added, it was changed to be a menu. Using 'y' and 'n' as
1718 * unshown accelerators keeps backwards compatibility with
1719 * the old y|n behavior.
1720 *
1721 * Initially the menu included a third choice and always used
1722 * 'a', 'b', and 'c'. Then it was changed to be controlled by
1723 * the 'lootabc' option instead, defaulting to '/', 'i', '?'
1724 * when that's false. Eventually additional entries have been
1725 * introduced.
1726 *
1727 * When lootabc is set, abandon the 'y'|'n' compatibility in
1728 * favor of newer '/' and '?' compatibility instead.
1729 */

Callers 2

dowhatisFunction · 0.85
doquickwhatisFunction · 0.85

Calls 15

cmdq_popFunction · 0.85
cmdq_clearFunction · 0.85
add_menuFunction · 0.85
add_menu_strFunction · 0.85
select_menuFunction · 0.85
display_inventoryFunction · 0.85
singularFunction · 0.85
checkfileFunction · 0.85
getlinFunction · 0.85
mungspacesFunction · 0.85
look_allFunction · 0.85
look_trapsFunction · 0.85

Tested by

no test coverage detected