]> granicus.if.org Git - nethack/commitdiff
fix #H3724 - gold pile stacking bug
authorPatR <rankin@nethack.org>
Mon, 16 Mar 2015 09:29:10 +0000 (02:29 -0700)
committerPasi Kallinen <paxed@alt.org>
Tue, 17 Mar 2015 16:47:37 +0000 (18:47 +0200)
     Bug report included a pointer to a fix; this patch is a superset.
Gold pieces dropped on an altar by the player got their bknown flag set,
which is incorrect since bless/curse doesn't apply to coins.  If a
monster (in reported case, a slain temple priest) dropped gold there too
then the two stacks wouldn't merge.  For the normal !GOLDOBJ config, the
problem goes away as soon as the gold gets picked up.  I didn't test for
GOLDOBJ but think two inventory slots containing gold can result.

     The superset part is to not break agnostic conduct by dropping gold
on an altar since no information is revealed when doing that.

[This was one of the very last patches checked into the old cvs repository,
where the somewhat out of date message above was accidentally omitted.]

doc/fixes35.0
src/do.c

index ad81178204f4d858818043713acbaa8b56f2916a..250b09d8585d576cdbcc247962ac48f8c4dde73c 100644 (file)
@@ -855,6 +855,7 @@ fix "object lost" panic (or even crash) when dropping multiple items while
        levitating and a lit potion of oil explodes and destroys some inventory
 fix "object_is_local" panic when saving bones after hero is killed by explosion
        produced by dropped or thrown lit potion of oil
+gold dropped on altar by hero wouldn't stack with gold dropped there by monster
 if lava burns up the player's water walking boots, the player falls in
 the messages for lava burning items up are always printed
 fix used-up magic trap trying to hit steed.
index 3069a40479dfcd84e4a85891926368562259d456..41e25a1b0ae8f85ebf1926dd9e673ff8c31cf339 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -1,4 +1,4 @@
-/* NetHack 3.5 do.c    $NHDT-Date$  $NHDT-Branch$:$NHDT-Revision$ */
+/* NetHack 3.5 do.c    $NHDT-Date: 1426497723 2015/03/16 09:22:03 $  $NHDT-Branch: H3724 $:$NHDT-Revision: 1.109 $ */
 /* NetHack 3.5 do.c    $Date: 2014/11/18 03:10:39 $  $Revision: 1.101 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -222,10 +222,15 @@ doaltarobj(obj)  /* obj is an object dropped on an altar */
        if (Blind)
                return;
 
-       /* KMH, conduct */
-       u.uconduct.gnostic++;
+       if (obj->oclass != COIN_CLASS) {
+           /* KMH, conduct */
+           u.uconduct.gnostic++;
+       } else {
+           /* coins don't have bless/curse status */
+           obj->blessed = obj->cursed = 0;
+       }
 
-       if ((obj->blessed || obj->cursed) && obj->oclass != COIN_CLASS) {
+       if (obj->blessed || obj->cursed) {
                There("is %s flash as %s %s the altar.",
                        an(hcolor(obj->blessed ? NH_AMBER : NH_BLACK)),
                        doname(obj), otense(obj, "hit"));
@@ -233,7 +238,7 @@ doaltarobj(obj)  /* obj is an object dropped on an altar */
        } else {
                pline("%s %s on the altar.", Doname2(obj),
                        otense(obj, "land"));
-               obj->bknown = 1;
+               if (obj->oclass != COIN_CLASS) obj->bknown = 1;
        }
 }