fix #H7983 - inconsistent shop 'for sale' behavior

Items on floor in the free spot one step inside a shop's doorway were
showing shop sell prices.  Treat items on that spot as if they were
flagged no_charge as on the floor of other shop squares.

Report stated that sometimes they showed a 'for sale' price and
sometimes they didn't, but I didn't see any cases where they didn't.
This commit is contained in:
PatR
2019-01-18 14:13:30 -08:00
parent 3506c24d39
commit 9a39618fb3
2 changed files with 11 additions and 4 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.231 $ $NHDT-Date: 1547846557 2019/01/18 21:22:37 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.232 $ $NHDT-Date: 1547849604 2019/01/18 22:13:24 $
This fixes36.2 file is here to capture information about updates in the 3.6.x This fixes36.2 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.1 in April 2018. Please note, however, lineage following the release of 3.6.1 in April 2018. Please note, however,
@@ -395,6 +395,8 @@ when in a shop and using ':' to look inside a container on shop floor, items
the hero owned the container the hero owned the container
when engulfed while in a shop, dropping an item into the engulfer and then when engulfed while in a shop, dropping an item into the engulfer and then
using ':' to look at current location could cause a crash using ':' to look at current location could cause a crash
when items were on the floor just inside a shop's door where the shopkeeper
doesn't buy and sell stuff, those items showed a 'for sale' price
tty: turn off an optimization that is the suspected cause of Windows reported tty: turn off an optimization that is the suspected cause of Windows reported
partial status lines following level changes partial status lines following level changes
tty: ensure that current status fields are always copied to prior status tty: ensure that current status fields are always copied to prior status
+8 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 shk.c $NHDT-Date: 1546770990 2019/01/06 10:36:30 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.152 $ */ /* NetHack 3.6 shk.c $NHDT-Date: 1547849604 2019/01/18 22:13:24 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.153 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1983,6 +1983,7 @@ int *nochrg; /* alternate return value: 1: no charge, 0: shop owned, */
struct monst *shkp; struct monst *shkp;
struct obj *top; struct obj *top;
xchar x, y; xchar x, y;
boolean freespot;
long cost = 0L; long cost = 0L;
*nochrg = -1; /* assume 'not applicable' */ *nochrg = -1; /* assume 'not applicable' */
@@ -1993,11 +1994,15 @@ int *nochrg; /* alternate return value: 1: no charge, 0: shop owned, */
&& (shkp = shop_keeper(inside_shop(x, y))) != 0 && inhishop(shkp)) { && (shkp = shop_keeper(inside_shop(x, y))) != 0 && inhishop(shkp)) {
for (top = obj; top->where == OBJ_CONTAINED; top = top->ocontainer) for (top = obj; top->where == OBJ_CONTAINED; top = top->ocontainer)
continue; continue;
*nochrg = (top->where == OBJ_FLOOR && obj->no_charge); freespot = (top->where == OBJ_FLOOR
&& x == ESHK(shkp)->shk.x && y == ESHK(shkp)->shk.y);
/* no_charge is only set for floor items inside shop proper;
items on freespot are implicitly 'no charge' */
*nochrg = (top->where == OBJ_FLOOR && (obj->no_charge || freespot));
if (carried(top) ? (int) obj->unpaid : !*nochrg) if (carried(top) ? (int) obj->unpaid : !*nochrg)
cost = obj->quan * get_cost(obj, shkp); cost = obj->quan * get_cost(obj, shkp);
if (Has_contents(obj)) if (Has_contents(obj) && !freespot)
cost += contained_cost(obj, shkp, 0L, FALSE, FALSE); cost += contained_cost(obj, shkp, 0L, FALSE, FALSE);
} }
return cost; return cost;