tty: selecting gold in menus

Requested by a beta tester nearly four years ago: '$' is both an
inventory "letter" and a group accelator.  The letter only works
if gold is on the current menu page and was taking precedence
over the group accelator.  Allow '$' to toggle selection of gold
regardless of the page.

curses already behaves this way.  X11 and Qt menus aren't
paginated so also pick gold even if the '$' entry in the menu
isn't visible at the time.  No idea about Windows GUI...
This commit is contained in:
PatR
2020-11-21 18:21:16 -08:00
parent 3e9d8f9aa5
commit efea46a93d
2 changed files with 9 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.359 $ $NHDT-Date: 1606008997 2020/11/22 01:36:37 $
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.360 $ $NHDT-Date: 1606011660 2020/11/22 02:21:00 $
General Fixes and Modified Features
-----------------------------------
@@ -506,6 +506,7 @@ Qt+OSX: since menu entry help->"About Qt NetHack" gets hijacked and becomes
tiles: add indicator of thonged portion to aklys tile
tty: role and race selection menus weren't filtering out potential choices
which got excluded by OPTIONS=align:!lawful or !neutral or !chaotic
tty: '$' can now select gold in a menu even when it isn't on current page
Unix: when user name is used as default character name, keep hyphenated value
intact instead stripping off dash and whatever follows as if that
specified role/race/&c (worked once upon a time; broken since 3.3.0)

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 wintty.c $NHDT-Date: 1596498345 2020/08/03 23:45:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.259 $ */
/* NetHack 3.7 wintty.c $NHDT-Date: 1606011660 2020/11/22 02:21:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.263 $ */
/* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */
@@ -1922,7 +1922,12 @@ struct WinDesc *cw;
if (n > 0) /* at least one group accelerator found */
for (rp = gacc, curr = cw->mlist; curr; curr = curr->next)
if (curr->gselector && curr->gselector != curr->selector
if (curr->gselector
&& (curr->gselector != curr->selector
/* '$' is both a selector "letter" and a group
accelerator; including it in gacc allows gold to
be selected via group when not on current page */
|| curr->gselector == GOLD_SYM)
&& !index(gacc, curr->gselector)
&& (cw->how == PICK_ANY
|| gcnt[GSELIDX(curr->gselector)] == 1)) {