get_cost_of_shop_item() crash

More shop price determination fallout.  After the most recent change
to get_cost_of_shop_item(), using ':' inside an engulfer carrying at
least one item while inside a shop would try to follow the item's
obj->ocontainer back-link and crash when that led to the engulfing
monster rather than to a container.
This commit is contained in:
PatR
2019-01-06 02:36:41 -08:00
parent ab1bee1778
commit a1fd4622f2
3 changed files with 8 additions and 5 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.224 $ $NHDT-Date: 1546687293 2019/01/05 11:21:33 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.225 $ $NHDT-Date: 1546770987 2019/01/06 10:36:27 $
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,
@@ -378,6 +378,8 @@ when in a shop and using ':' to look inside a container in inventory, items
when in a shop and using ':' to look inside a container on shop floor, items when in a shop and using ':' to look inside a container on shop floor, items
that shopkeeper didn't care about weren't shown as "no charge" unless that shopkeeper didn't care about weren't shown as "no charge" unless
the hero owned the container the hero owned the container
when engulfed while in a shop, dropping an item into the engulfer and then
using ':' to look at current location could cause a crash
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
+3 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 invent.c $NHDT-Date: 1546467443 2019/01/02 22:17:23 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.248 $ */ /* NetHack 3.6 invent.c $NHDT-Date: 1546770988 2019/01/06 10:36:28 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.249 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */ /*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2938,7 +2938,8 @@ boolean nested, /* include contents of any nested containers */
long count = 0L; long count = 0L;
if (!everything) { if (!everything) {
for (topc = container; topc->ocontainer; topc = topc->ocontainer) for (topc = container; topc->where == OBJ_CONTAINED;
topc = topc->ocontainer)
continue; continue;
if (topc->where == OBJ_FLOOR) { if (topc->where == OBJ_FLOOR) {
xchar x, y; xchar x, y;
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 shk.c $NHDT-Date: 1546687294 2019/01/05 11:21:34 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.151 $ */ /* 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 $ */
/* 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. */
@@ -1991,7 +1991,7 @@ int *nochrg; /* alternate return value: 1: no charge, 0: shop owned, */
&& get_obj_location(obj, &x, &y, CONTAINED_TOO) && get_obj_location(obj, &x, &y, CONTAINED_TOO)
&& *in_rooms(x, y, SHOPBASE) == *u.ushops && *in_rooms(x, y, SHOPBASE) == *u.ushops
&& (shkp = shop_keeper(inside_shop(x, y))) != 0 && inhishop(shkp)) { && (shkp = shop_keeper(inside_shop(x, y))) != 0 && inhishop(shkp)) {
for (top = obj; top->ocontainer; top = top->ocontainer) for (top = obj; top->where == OBJ_CONTAINED; top = top->ocontainer)
continue; continue;
*nochrg = (top->where == OBJ_FLOOR && obj->no_charge); *nochrg = (top->where == OBJ_FLOOR && obj->no_charge);