fix github issue #202 - worn items inside engulfer

Fixes #202

When swallowed, you can take things from the engulfer's inventory, if
there are any, via pickup.  Items might be worn by the engulfer and
when "picked up" those weren't being unworn before being added to
hero's inventory.  Then they would be formatted as "(being worn)" and
could trigger warnings or worse.

Conceptually they should be worn on the outside and not be accessible
from the inside, so I've made attempts to pick up worn items fail
rather than fix up the unwearing.

Using ':' when swallowed to look at the engulfer's inventory describes
that inventory as "contents of <mon>'s stomach".  That's weird for any
worn items, but the situation is so rare I haven't made any attempt to
deal with it.
This commit is contained in:
PatR
2019-07-03 18:30:55 -07:00
parent 4a74968a58
commit 79ff4cd9c3
3 changed files with 56 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 invent.c $NHDT-Date: 1561751391 2019/06/28 19:49:51 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.260 $ */
/* NetHack 3.6 invent.c $NHDT-Date: 1562203850 2019/07/04 01:30:50 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.261 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -3372,6 +3372,21 @@ boolean picked_some;
if (u.uswallow && u.ustuck) {
struct monst *mtmp = u.ustuck;
/*
* FIXME?
* Engulfer's inventory can include worn items (specific case is
* Juiblex being created with an amulet as random defensive item)
* which will be flagged as "(being worn)". This code includes
* such a worn item under the header "Contents of <mon>'s stomach",
* a nifty trick for how/where to wear stuff. The situation is
* rare enough to turn a blind eye.
*
* 3.6.3: Pickup has been changed to decline to pick up a worn
* item from inside an engulfer, but if player tries, it just
* says "you can't" without giving a reason why (which would be
* something along the lines of "because it's worn on the outside
* so is unreachable from in here...").
*/
Sprintf(fbuf, "Contents of %s %s", s_suffix(mon_nam(mtmp)),
mbodypart(mtmp, STOMACH));
/* Skip "Contents of " by using fbuf index 12 */