]> granicus.if.org Git - nethack/commitdiff
context-sensitive inventory item-action quaff
authorPatR <rankin@nethack.org>
Fri, 15 Apr 2022 19:09:17 +0000 (12:09 -0700)
committerPatR <rankin@nethack.org>
Fri, 15 Apr 2022 19:09:17 +0000 (12:09 -0700)
Picking a potion from inventory and then picking 'quaff this potion'
from the context menu needed handling similar to eat/offer/tin:  skip
floor candidates.  If you were on a fountain or sink, picked a potion
from inventory and then the quaff option for it, you weren't prompted
to drink from the fountain but you were prompted for what potion to
drink instead of using the one that had already been picked to
initiate drinkig.

src/potion.c

index 5a1e0d286726fb43c36843ae1b61b68ecec2e1f1..27ee711516f6084823eb16ff99e3666fb1bc8fba 100644 (file)
@@ -531,8 +531,11 @@ dodrink(void)
     drink_ok_extra = 0;
     /* preceding 'q'/#quaff with 'm' skips the possibility of drinking
        from fountains, sinks, and surrounding water plus the prompting
-       which those entail */
-    if (!iflags.menu_requested) {
+       which those entail; if cmdq is non-empty, player has selected a
+       potion from inventory and then chosen action-item 'quaff' so
+       skip fountains,&c for that case too--the potion's inv letter is
+       queued up for next getobj() */
+    if (!iflags.menu_requested && !cmdq_peek()) {
         /* Is there a fountain to drink from here? */
         if (IS_FOUNTAIN(levl[u.ux][u.uy].typ)
             /* not as low as floor level but similar restrictions apply */