fix #H4347 - revival of carried corpse in shop
authorPatR <rankin@nethack.org>
Wed, 25 May 2016 01:00:57 +0000 (18:00 -0700)
committerPatR <rankin@nethack.org>
Wed, 25 May 2016 01:00:57 +0000 (18:00 -0700)
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
src/shk.c
src/trap.c
src/zap.c

index e0cf7a4681d50099ecb9c5ba1c523779cad89380..690cabaff1a23c3011a68dec19a0f4ae0001d4f3 100644 (file)
@@ -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
index 3a6638e9c2284af58d53b1b9dec0bec35641d157..586f5de6e7e3029f190ad8cca8bdc3e9b21e7bd2 100644 (file)
--- 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;
index 6ba1aeb61771f169ab28851a8f2cc96ebdfb5766..bac03c1bed70044471077d33baa9577d63891ead 100644 (file)
@@ -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 */
index 161959ffb88a10add5419ca7fd112d9745cdbf89..0c3ec173fa43d1e46b940cb2fcae29fcff07de62 100644 (file)
--- 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);