From 955c53eba5f94aca8b20cf25b8ec9a07388e2cf3 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 24 May 2016 18:00:57 -0700 Subject: [PATCH] fix #H4347 - revival of carried corpse in shop Zapping wand of undead turning at self while inside a shop and carrying a corpse caused the shopkeeper to claim a use-up fee for the corpse regardless of whether it was owned by the shop. Not mentioned in the report: casting stone-to-flesh as self while carrying a figurine or statue behaved similarly. --- doc/fixes36.1 | 4 ++++ src/shk.c | 9 +++++---- src/trap.c | 3 ++- src/zap.c | 24 ++++++++++++------------ 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/doc/fixes36.1 b/doc/fixes36.1 index e0cf7a468..690cabaff 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -263,6 +263,10 @@ new character with OPTIONS=role:Valk,race:!human,align:!lawful yielded new character with OPTIONS=role:Valk,race:random yielded "Shall I pick your Valkyrie's race and alignment for you?" instead of honoring race:random without asking +while in shop, undead turning at self causing carried, hero owned corpse to + resurrect claimed it belonged to shopkeeper +while in shop, stone-to-flesh at self causing carried, hero owned figurine + or statue to animate claimed it belonged to shopkeeper Fixes to Post-3.6.0 Problems that Were Exposed Via git Respository diff --git a/src/shk.c b/src/shk.c index 3a6638e9c..586f5de6e 100644 --- a/src/shk.c +++ b/src/shk.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 shk.c $NHDT-Date: 1463620377 2016/05/19 01:12:57 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.131 $ */ +/* NetHack 3.6 shk.c $NHDT-Date: 1464138042 2016/05/25 01:00:42 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.132 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2559,9 +2559,10 @@ boolean ininv, dummy, silent; } obj->quan = 1L; /* fool xname() into giving singular */ pline("%s %ld %s %s %s%s.\"", buf, ltmp, currency(ltmp), - (save_quan > 1L) ? "per" : (contentscount && !obj->unpaid) - ? "for the contents of this" - : "for this", + (save_quan > 1L) ? "per" + : (contentscount && !obj->unpaid) + ? "for the contents of this" + : "for this", xname(obj), (contentscount && obj->unpaid) ? and_its_contents : ""); obj->quan = save_quan; diff --git a/src/trap.c b/src/trap.c index 6ba1aeb61..bac03c1be 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 trap.c $NHDT-Date: 1461568321 2016/04/25 07:12:01 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.268 $ */ +/* NetHack 3.6 trap.c $NHDT-Date: 1464138044 2016/05/25 01:00:44 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.272 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -690,6 +690,7 @@ int *fail_reason; which refers to "it" so needs to follow a message describing the object ("the statue comes to life" one above) */ if (cause != ANIMATE_NORMAL && costly_spot(x, y) + && (carried(statue) ? statue->unpaid : !statue->no_charge) && (shkp = shop_keeper(*in_rooms(x, y, SHOPBASE))) != 0 /* avoid charging for Manlobbi's statue of Manlobbi if stone-to-flesh is used on petrified shopkeep */ diff --git a/src/zap.c b/src/zap.c index 161959ffb..0c3ec173f 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 zap.c $NHDT-Date: 1463533826 2016/05/18 01:10:26 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.255 $ */ +/* NetHack 3.6 zap.c $NHDT-Date: 1464138044 2016/05/25 01:00:44 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.257 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -795,7 +795,8 @@ boolean by_hero; struct monst *shkp = 0; x = corpse->ox, y = corpse->oy; - if (costly_spot(x, y)) + if (costly_spot(x, y) + && (carried(corpse) ? corpse->unpaid : !corpse->no_charge)) shkp = shop_keeper(*in_rooms(x, y, SHOPBASE)); if (cansee(x, y)) { @@ -1612,9 +1613,9 @@ int id; if (*u.ushops && *in_rooms(u.ux, u.uy, 0) == *in_rooms(shkp->mx, shkp->my, 0) - && !costly_spot(u.ux, u.uy)) + && !costly_spot(u.ux, u.uy)) { make_angry_shk(shkp, ox, oy); - else { + } else { pline("%s gets angry!", Monnam(shkp)); hot_pursuit(shkp); } @@ -1633,7 +1634,7 @@ struct obj *obj; { int res = 1; /* affected object by default */ struct permonst *ptr; - struct monst *mon; + struct monst *mon, *shkp; struct obj *item; xchar oox, ooy; boolean smell = FALSE, golem_xform = FALSE; @@ -1664,19 +1665,18 @@ struct obj *obj; break; } if (obj->otyp == STATUE) { - /* animate_statue() forces all golems to become flesh golems - */ + /* animate_statue() forces all golems to become flesh golems */ mon = animate_statue(obj, oox, ooy, ANIMATE_SPELL, (int *) 0); } else { /* (obj->otyp == FIGURINE) */ if (golem_xform) ptr = &mons[PM_FLESH_GOLEM]; mon = makemon(ptr, oox, ooy, NO_MINVENT); if (mon) { - if (costly_spot(oox, ooy) && !obj->no_charge) { - if (costly_spot(u.ux, u.uy)) - addtobill(obj, carried(obj), FALSE, FALSE); - else - stolen_value(obj, oox, ooy, TRUE, FALSE); + if (costly_spot(oox, ooy) + && (carried(obj) ? obj->unpaid : !obj->no_charge)) { + shkp = shop_keeper(*in_rooms(oox, ooy, SHOPBASE)); + stolen_value(obj, oox, ooy, + (shkp && shkp->mpeaceful), FALSE); } if (obj->timed) obj_stop_timers(obj); -- 2.40.0