]> granicus.if.org Git - nethack/commitdiff
fix #H4407 - avoiding floor-food while blind
authorPatR <rankin@nethack.org>
Fri, 24 Jun 2016 23:21:53 +0000 (16:21 -0700)
committerPatR <rankin@nethack.org>
Fri, 24 Jun 2016 23:21:53 +0000 (16:21 -0700)
Accept the 'm' prefix for eat, offer, and apply.

Allows 'me' to eat from inventory without checking for floor food.
Primarily for use after blind character used 'm<dir>' to move
somewhere without touching a suspected cockatrice corpse there.

'm#offer' and 'ma<let>' accomplish similar floor-object-skipping
when offering a sacrifice or applying a tinning-kit.  (All three
commands share floorfood() to pick the item to use.)

Report suggested replacing pick-from-floor followed by pick-from-
invent with use of slash'em-style pick-from-invent with explicit
pick-from-floor choice in list of inventory letters "[abc or ,]"
(slash'em used period for 'here'; I've always liked comma better
since the action is to pick an item rather than a location).  I
implemented that for nethack a long time ago, but it was mixed in
with other stuff that wasn't ready for prime time and vanished
when I lost access to the VMS system I used to use).

Using 'm' prefix to skip part of a multi-part operation is a lot
simpler to implement but doesn't include an in-game reminder that
it is available.

Revised Guidebook.mn is tested, Guidebook.tex is not.

doc/Guidebook.mn
doc/Guidebook.tex
src/cmd.c
src/eat.c

index b76fa5a691d49c7e53839d5033cbd28b77af0e26..8b9f8e630f20f97272a1e16861e3b71a6626d3a0 100644 (file)
@@ -570,9 +570,21 @@ Figure 2
 Go in that direction until you hit a wall or run into something.
 .lp m[yuhjklbn]
 Prefix:  move without picking up objects or fighting (even if you remember
-a monster there)
+a monster there).
+.lp ""
+A few non-movement commands use the `m' prefix to request operating
+via menu (to temporarily override the
+.op menustyle:Traditional
+option).
+Primarily useful for `,' (pickup) when there is only one class of
+objects present (where there won't be any ``what kinds of objects?'' prompt,
+so no opportunity to answer `m' at that prompt).
+.lp ""
+A few other commands (eat food, offer sacrifice, apply tinning-kit) use
+the `m' prefix to skip checking for applicable objects on the floor
+and go straight to checking inventory.
 .lp F[yuhjklbn]
-Prefix:  fight a monster (even if you only guess one is there)
+Prefix:  fight a monster (even if you only guess one is there).
 .lp M[yuhjklbn]
 Prefix:  move far, no pickup.
 .lp "g[yuhjklbn]
@@ -640,6 +652,11 @@ D%u - drop only unpaid food.
 Kick something (usually a door).
 .lp e
 Eat food.
+.lp ""
+Normally checks for edible item(s) on the floor, then if none are found
+or none are chosen, checks for edible item(s) in inventory.
+Precede `e' with the `m' prefix to bypass attempting to eat
+anything off the floor.
 .\" Make sure Elbereth is not hyphenated below, the exact spelling matters
 .hw Elbereth
 .lp E
index 54dc5a542dfd10003135c78107f1217c960951b2..df4282d7e419f630129495eb513d92c106e2d718 100644 (file)
@@ -690,10 +690,22 @@ Go in that direction until you hit a wall or run into something.
 %.lp
 \item[\tb{m[yuhjklbn]}]
 Prefix:  move without picking up objects or fighting (even if you remember
-a monster there)
+a monster there).\\
+%.lp ""
+A few non-movement commands use the `{\tt m}' prefix to request operating
+via menu (to temporarily override the
+{\it menustyle:Traditional\/}
+option).
+Primarily useful for `{\tt ,}' (pickup) when there is only one class of
+objects present (where there won't be any ``what kinds of objects?'' prompt,
+so no opportunity to answer `{\tt m}' at that prompt).\\
+%.lp ""
+A few other commands (eat food, offer sacrifice, apply tinning-kit) use
+the `{\tt m}' prefix to skip checking for applicable objects on the floor
+and go straight to checking inventory.
 %.lp
 \item[\tb{F[yuhjklbn]}]
-Prefix:  fight a monster (even if you only guess one is there)
+Prefix:  fight a monster (even if you only guess one is there).
 %.lp
 \item[\tb{M[yuhjklbn]}]
 Prefix:  Move far, no pickup.
@@ -775,7 +787,12 @@ the bless\-ed/\-un\-curs\-ed/\-curs\-ed groups may be typed.\\
 Kick something (usually a door).
 %.lp
 \item[\tb{e}]
-Eat food.
+Eat food.\\
+%.lp ""
+Normally checks for edible item(s) on the floor, then if none are found
+or none are chosen, checks for edible item(s) in inventory.
+Precede `{\tt e}' with the `{\tt m}' prefix to bypass attempting to eat
+anything off the floor.
 %.lp
 % Make sure Elbereth is not hyphenated below, the exact spelling matters.
 % (Only specified here to parallel Guidebook.mn; use of \tt font implicity
index 4feb9bf94880264df67706708537e51eb458a7bf..5dfb3dbc78b1e8557d264fde621e3d7d36a69205 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -3445,11 +3445,17 @@ boolean initial;
     Cmd.move_SW = Cmd.dirchars[7];
 }
 
+/* non-movement commands which accept 'm' prefix to request menu operation */
 STATIC_OVL boolean
 accept_menu_prefix(cmd_func)
 int NDECL((*cmd_func));
 {
     if (cmd_func == dopickup || cmd_func == dotip
+        /* eat, #offer, and apply tinning-kit all use floorfood() to pick
+           an item on floor or in invent; 'm' skips picking from floor
+           (ie, inventory only) rather than request use of menu operation */
+        || cmd_func == doeat || cmd_func == dosacrifice || cmd_func == doapply
+        /* 'm' prefix allowed for some extended commands */
         || cmd_func == doextcmd || cmd_func == doextlist)
         return TRUE;
     return FALSE;
index 5b8f08a8ddeb9311a2878f27883a7b468b9cf499..3b01dd8cf5315af92252af3e9263be98952177ec 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -2368,6 +2368,7 @@ doeat()
 
     if (u.uedibility) {
         int res = edibility_prompts(otmp);
+
         if (res) {
             Your(
                "%s stops tingling and your sense of smell returns to normal.",
@@ -2974,7 +2975,8 @@ int corpsecheck; /* 0, no check, 1, corpses, 2, tinnable corpses */
         offering = !strcmp(verb, "sacrifice"); /* corpsecheck==1 */
 
     /* if we can't touch floor objects then use invent food only */
-    if (!can_reach_floor(TRUE) || (feeding && u.usteed)
+    if (iflags.menu_requested /* command was preceded by 'm' prefix */
+        || !can_reach_floor(TRUE) || (feeding && u.usteed)
         || (is_pool_or_lava(u.ux, u.uy)
             && (Wwalking || is_clinger(youmonst.data)
                 || (Flying && !Breathless))))