This commit is contained in:
keni
2015-03-27 21:38:25 -04:00

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 wintty.c $NHDT-Date: 1426465444 2015/03/16 00:24:04 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.71 $ */
/* NetHack 3.5 wintty.c $NHDT-Date: 1427505884 2015/03/28 01:24:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.73 $ */
/* NetHack 3.5 wintty.c $Date: 2012/01/22 06:27:09 $ $Revision: 1.66 $ */
/* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */
@@ -1391,10 +1391,11 @@ struct WinDesc *cw;
{
tty_menu_item *page_start, *page_end, *curr;
long count;
int n, curr_page, page_lines;
int n, curr_page, page_lines, resp_len;
boolean finished, counting, reset_count;
char *cp, *rp, resp[QBUFSZ], gacc[QBUFSZ],
*msave, *morestr;
*msave, *morestr, really_morc;
#define MENU_EXPLICIT_CHOICE 0x7f /* pseudo menu manipulation char */
curr_page = page_lines = 0;
page_start = page_end = 0;
@@ -1501,6 +1502,8 @@ struct WinDesc *cw;
page_lines = 0;
}
*rp = 0;
/* remember how many explicit menu choices there are */
resp_len = (int)strlen(resp);
/* corner window - clear extra lines from last page */
if (cw->offx) {
@@ -1533,7 +1536,15 @@ struct WinDesc *cw;
xwaitforspace(resp);
}
morc = map_menu_cmd(morc);
really_morc = morc; /* (only used with MENU_EXPLICIT_CHOICE */
if ((rp = index(resp, morc)) != 0 && rp < resp + resp_len)
/* explicit menu selection; don't override it if it also
happens to match a mapped menu command (such as ':' to
look inside a container vs ':' to search) */
morc = MENU_EXPLICIT_CHOICE;
else
morc = map_menu_cmd(morc);
switch (morc) {
case '0':
/* special case: '0' is also the default ball class */
@@ -1664,6 +1675,9 @@ struct WinDesc *cw;
}
}
break;
case MENU_EXPLICIT_CHOICE:
morc = really_morc;
/*FALLTHRU*/
default:
if (cw->how == PICK_NONE || !index(resp, morc)) {
/* unacceptable input received */