stolen_value() vs containers

stolen_value() treated hero-owned container holding shop-owned goods
as free for the taking.

The fix I'm working on which led to discovering this first added
stolen_value() then eventually stopped using it so I don't have an
example of where it is giving the wrong result.
This commit is contained in:
PatR
2018-12-25 16:45:41 -08:00
parent 3aca92215c
commit 5f5f7f63f1
2 changed files with 22 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 shk.c $NHDT-Date: 1545774524 2018/12/25 21:48:44 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.145 $ */
/* NetHack 3.6 shk.c $NHDT-Date: 1545785119 2018/12/26 00:45:19 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.146 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2811,11 +2811,13 @@ boolean peaceful, silent;
if (!billable(&shkp, obj, roomno, FALSE)) {
/* things already on the bill yield a not-billable result, so
we need to check bill before deciding that shk doesn't care */
if ((bp = onbill(obj, shkp, FALSE)) == 0)
if ((bp = onbill(obj, shkp, FALSE)) != 0) {
/* shk does care; take obj off bill to avoid double billing */
billamt = bp->bquan * bp->price;
sub_one_frombill(obj, shkp);
}
if (!bp && !u_count)
return 0L;
/* shk does care; take obj off bill to avoid double billing */
billamt = bp->bquan * bp->price;
sub_one_frombill(obj, shkp);
}
if (obj->oclass == COIN_CLASS) {