From 105545172f28719b0fcf07ceead160334ac33460 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 16 Mar 2015 02:29:10 -0700 Subject: [PATCH] fix #H3724 - gold pile stacking bug 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 | 1 + src/do.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index ad8117820..250b09d85 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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. diff --git a/src/do.c b/src/do.c index 3069a4047..41e25a1b0 100644 --- 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; } } -- 2.40.0