From 0f15b7c3ad42f220a66cea4352e643867c2948fe Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 16 Dec 2018 15:43:17 -0800 Subject: [PATCH] fix #H2504 - dropping shop goods inside engulfer This one is only seven years old. Dropping an unpaid item inside an engulfer leaves it unpaid and still on bill. If engulfer is killed, it ends up unpaid when back on the shop's floor. Treat dropping an unpaid item into engulfer's inventory as stealing that item. You have to pay for it to leave the shop, and like any other dying monster's inventory, the shopkeeper will take ownership if it lands on the shop floor when the engulfer is killed. The 'theft' doesn't anger the shopkeeper and the cost shows up on 'Ix' as part of "usage fees/other charges" rather than as an itemized used up item. --- doc/fixes36.2 | 5 +++++ src/do.c | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index f7a3d5983..1e8d84cb6 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -273,6 +273,11 @@ make it easier to clear 'pickup_types' (menustyles Traditional and Combination allowed unselecting every object class; now 'all classes' is a choice) distribution of monsters selected by mkclass() didn't match expected distrib (cited example was ndemon() creating twice as many incubi as succubi) +while inside a shop, dropping an unpaid item inside an engulfer would leave + that item 'unpaid' and it would remain so on shop floor after the + the engulfer was killed; treat dropping shop items inside an engulfer + as stealing them and giving them to that engulfer--hero must pay for + for them and shop retains ownership of them Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/do.c b/src/do.c index 87cbe86c4..a4ef2bda5 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do.c $NHDT-Date: 1544442710 2018/12/10 11:51:50 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.177 $ */ +/* NetHack 3.6 do.c $NHDT-Date: 1545003783 2018/12/16 23:43:03 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.178 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -584,11 +584,13 @@ register struct obj *obj; if (u.uswallow) { /* barrier between you and the floor */ if (flags.verbose) { - char buf[BUFSZ]; + char *onam_p, monbuf[BUFSZ]; /* doname can call s_suffix, reusing its buffer */ - Strcpy(buf, s_suffix(mon_nam(u.ustuck))); - You("drop %s into %s %s.", doname(obj), buf, + Strcpy(monbuf, s_suffix(mon_nam(u.ustuck))); + onam_p = obj->unpaid ? Yobjnam2(obj, (char *) 0) : doname(obj); + + You("drop %s into %s %s.", onam_p, monbuf, mbodypart(u.ustuck, STOMACH)); } } else { @@ -682,6 +684,8 @@ boolean with_impact; could_grow = (obj->corpsenm == PM_WRAITH); could_heal = (obj->corpsenm == PM_NURSE); } + if (obj->unpaid) + (void) stolen_value(obj, u.ux, u.uy, TRUE, FALSE); (void) mpickobj(u.ustuck, obj); if (is_animal(u.ustuck->data)) { if (could_poly || could_slime) {