number_pad menu hack
I don't try to toggle 'number_pad' very often, but when I do I almost always type '0' instead of 'a' for Off or '1' instead of 'b' for On on the first attempt. The menu shows | a - 0 (off) | b - 1 (on) | c - 2 (on, MSDOS compatible) | d - 3 (on, phone-style digit layout) | e - 4 (on, phone-style layout, MSDOS compatible) | f - -1 (off, 'z' to move upper-left, 'y' to zap wands) This change makes '0' through '4' be undocumented group accelerators for 'a' through 'e' (and '5' for 'f') in the sub-menu put up by 'O'. tty and X11 worked as-is for '0' and required what amounts to a pair of one-line changes to handle the other digits. It doesn't work for curses and Qt (no idea about Windows GUI) because they insist on treating any typed digit as the start of a count even if one or more menu entries include that digit as a group accelerator. (They also fail to support '0' as the group accelerator for iron-ball class in the menu for multiple-drop.)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 options.c $NHDT-Date: 1643491546 2022/01/29 21:25:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.535 $ */
|
||||
/* NetHack 3.7 options.c $NHDT-Date: 1644531493 2022/02/10 22:18:13 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.538 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Michael Allison, 2008. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -4528,8 +4528,8 @@ handler_number_pad(void)
|
||||
any = cg.zeroany;
|
||||
for (i = 0; i < SIZE(npchoices); i++) {
|
||||
any.a_int = i + 1;
|
||||
add_menu(tmpwin, &nul_glyphinfo, &any, 'a' + i,
|
||||
0, ATR_NONE, npchoices[i], MENU_ITEMFLAGS_NONE);
|
||||
add_menu(tmpwin, &nul_glyphinfo, &any, 'a' + i, '0' + i,
|
||||
ATR_NONE, npchoices[i], MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
end_menu(tmpwin, "Select number_pad mode:");
|
||||
if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) {
|
||||
|
||||
Reference in New Issue
Block a user