From: PatR Date: Sat, 5 Jan 2019 02:28:50 +0000 (-0800) Subject: 'm ^T' menu fix X-Git-Tag: NetHack-3.6.2_Released~102^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9bcc42957b624d870c031407e8daf9dc67786646;p=nethack 'm ^T' menu fix Fix fuzzer feedback. The new wizard mode ^T menu had an early return which bypassed destroy_nhwindow(), leaving the menu around. Fuzzer eventually got "No window slots!" panic from tty. Make sure that the menu window is torn down fully before returning. Also, make the normal wizard mode teleportation chioce be preselected so that not picking anything doesn't lead to an early return any more. ESC still does though. --- diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 015ce2c20..102c61f6b 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.222 $ $NHDT-Date: 1546565812 2019/01/04 01:36:52 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.223 $ $NHDT-Date: 1546655319 2019/01/05 02:28:39 $ This fixes36.2 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.1 in April 2018. Please note, however, @@ -371,6 +371,8 @@ wizard mode ^G, creating a monster via class name using "lo" through "long wor" if bouldersym bug (via 'O', above) put a ('\0') on the map, examining that spot matched placeholder monster class #0 and triggered impossible "Alphabet soup: 'an("")'." +wizard mode m^T, not selecting a teleport choice didn't teardown the menu + properly and could eventually lead to "No window slots!" panic tty: turn off an optimization that is the suspected cause of Windows reported partial status lines following level changes tty: ensure that current status fields are always copied to prior status diff --git a/src/teleport.c b/src/teleport.c index e2a6c32dc..fb99e6331 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 teleport.c $NHDT-Date: 1546565815 2019/01/04 01:36:55 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.82 $ */ +/* NetHack 3.6 teleport.c $NHDT-Date: 1546655319 2019/01/05 02:28:39 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.83 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -555,16 +555,25 @@ dotelecmd() for (i = 0; i < SIZE(tports); ++i) { any.a_int = (int) tports[i].menulet; add_menu(win, NO_GLYPH, &any, (char) any.a_int, 0, ATR_NONE, - tports[i].menudesc, MENU_UNSELECTED); + tports[i].menudesc, + (tports[i].menulet == 'w') ? MENU_SELECTED + : MENU_UNSELECTED); } end_menu(win, "Which way do you want to teleport?"); - if (select_menu(win, PICK_ONE, &picks) > 0) { + i = select_menu(win, PICK_ONE, &picks); + destroy_nhwindow(win); + if (i > 0) { tmode = picks[0].item.a_int; + /* if we got 2, use the one which wasn't preselected */ + if (i > 1 && tmode == 'w') + tmode = picks[1].item.a_int; free((genericptr_t) picks); - } else { + } else if (i == 0) { + /* preselected one was explicitly chosen and got toggled off */ + tmode = 'w'; + } else { /* ESC */ return 0; } - destroy_nhwindow(win); switch (tmode) { case 'n': HTeleportation |= I_SPECIAL; /* confer intrinsic teleportation */