fix #H4407 - avoiding floor-food while blind

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.
This commit is contained in:
PatR
2016-06-24 16:21:53 -07:00
parent 02db340cd6
commit eb1add8500
4 changed files with 48 additions and 6 deletions

View 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

View 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

View File

@@ -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;

View File

@@ -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))))