]> granicus.if.org Git - nethack/commitdiff
fix [pre-]beta 'Du' bug with containers in shops
authorPatR <rankin@nethack.org>
Thu, 28 May 2015 09:22:48 +0000 (02:22 -0700)
committerPatR <rankin@nethack.org>
Thu, 28 May 2015 09:22:48 +0000 (02:22 -0700)
'Du' in a shop was listing hero-owned containers that didn't contain
any unpaid items.  At least one unpaid item must be carried; bug
manifested iff one or more unpaid items followed the container in
the invent list.

Recently revised allow_category() was using count_unpaid() for
container contents incorrectly, inadvertently checking the rest of
inventory after the container in addition to its contents.

src/pickup.c

index 6668135a49af17d3e233c1172a23b3de7df44611..ce8c6f49aa29cba7dfc6f5519dbc78f7b8a8353f 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 pickup.c        $NHDT-Date: 1432512773 2015/05/25 00:12:53 $  $NHDT-Branch: master $:$NHDT-Revision: 1.155 $ */
+/* NetHack 3.6 pickup.c        $NHDT-Date: 1432804962 2015/05/28 09:22:42 $  $NHDT-Branch: master $:$NHDT-Revision: 1.157 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -401,7 +401,7 @@ struct obj *obj;
     /* if unpaid is expected and obj isn't unpaid, reject (treat a container
        holding any unpaid object as unpaid even if isn't unpaid itself) */
     if (shop_filter && !obj->unpaid
-        && !(Has_contents(obj) && count_unpaid(obj) > 0))
+        && !(Has_contents(obj) && count_unpaid(obj->cobj) > 0))
         return FALSE;
     /* check for particular bless/curse state */
     if (bucx_filter) {