Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2018-12-25 22:12:44 -05:00
5 changed files with 44 additions and 13 deletions

View File

@@ -305,6 +305,10 @@ life-saving while weak/starving/fainting boosted nutrition without restoring
lost point of strength, making temporary loss be permanent
unlike #chat in a shop, walking on an item in a shop failed to include price
for hero-owned container holding shop-owned items
bag of holding explosion inside shop billed hero for unpaid contents if it
happened when applied while carried but not when looted while on floor
looking into an applied container with ':' showed prices of unpaid items but
looking into a looted one with ':' did not show prices for shop items
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 end.c $NHDT-Date: 1545771927 2018/12/25 21:05:27 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.161 $ */
/* NetHack 3.6 end.c $NHDT-Date: 1545786454 2018/12/26 01:07:34 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.162 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1576,7 +1576,7 @@ boolean identified, all_containers, reportempty;
if (Is_container(obj) || obj->otyp == STATUE)
obj->cknown = obj->lknown = 1;
}
Strcpy(&buf[2], doname(obj));
Strcpy(&buf[2], doname_with_price(obj));
putstr(tmpwin, 0, buf);
}
unsortloot(&sortedcobj);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 invent.c $NHDT-Date: 1545597422 2018/12/23 20:37:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.245 $ */
/* NetHack 3.6 invent.c $NHDT-Date: 1545785120 2018/12/26 00:45:20 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.246 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2882,6 +2882,7 @@ int *bcp, *ucp, *ccp, *xcp, *ocp;
}
}
/* count everything inside a container, or just shop-owned items inside */
long
count_contents(container, nested, quantity, everything)
struct obj *container;
@@ -2889,13 +2890,24 @@ boolean nested, /* include contents of any nested containers */
quantity, /* count all vs count separate stacks */
everything; /* all objects vs only unpaid objects */
{
struct obj *otmp;
struct obj *otmp, *topc;
boolean shoppy = FALSE;
long count = 0L;
if (!everything) {
for (topc = container; topc->ocontainer; topc = topc->ocontainer)
continue;
if (topc->where == OBJ_FLOOR) {
xchar x, y;
(void) get_obj_location(topc, &x, &y, CONTAINED_TOO);
shoppy = costly_spot(x, y);
}
}
for (otmp = container->cobj; otmp; otmp = otmp->nobj) {
if (nested && Has_contents(otmp))
count += count_contents(otmp, nested, quantity, everything);
if (everything || otmp->unpaid)
if (everything || otmp->unpaid || (shoppy && !otmp->no_charge))
count += quantity ? otmp->quan : 1L;
}
return count;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 pickup.c $NHDT-Date: 1545597427 2018/12/23 20:37:07 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.221 $ */
/* NetHack 3.6 pickup.c $NHDT-Date: 1545785547 2018/12/26 00:52:27 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.222 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2188,7 +2188,20 @@ register struct obj *obj;
if (was_unpaid)
addtobill(obj, FALSE, FALSE, TRUE);
obfree(obj, (struct obj *) 0);
delete_contents(g.current_container);
/* if carried, shop goods will be flagged 'unpaid' and obfree() will
handle bill issues, but if on floor, we need to put them on bill
before deleting them (non-shop items will be flagged 'no_charge') */
if (floor_container
&& costly_spot(current_container->ox, current_container->oy)) {
struct obj save_no_charge;
save_no_charge.no_charge = current_container->no_charge;
addtobill(current_container, FALSE, FALSE, FALSE);
/* addtobill() clears no charge; we need to set it back
so that useupf() doesn't double bill */
current_container->no_charge = save_no_charge.no_charge;
}
delete_contents(current_container);
if (!floor_container)
useup(g.current_container);
else if (obj_here(g.current_container, u.ux, u.uy))

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: 1545786461 2018/12/26 01:07:41 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.147 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1969,7 +1969,7 @@ register struct obj *obj;
if (*u.ushops && obj->oclass != COIN_CLASS
&& obj != uball && obj != uchain
&& get_obj_location(obj, &x, &y, 0)
&& get_obj_location(obj, &x, &y, CONTAINED_TOO)
&& *in_rooms(u.ux, u.uy, SHOPBASE) == *in_rooms(x, y, SHOPBASE)
&& (shkp = shop_keeper(inside_shop(x, y))) != 0 && inhishop(shkp)) {
cost = obj->no_charge ? 0L : obj->quan * get_cost(obj, shkp);
@@ -2806,11 +2806,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) {