]> granicus.if.org Git - nethack/commitdiff
kinda/sorta fix github issue #246
authorPatR <rankin@nethack.org>
Thu, 5 Dec 2019 10:33:47 +0000 (02:33 -0800)
committerPatR <rankin@nethack.org>
Sat, 14 Dec 2019 00:15:37 +0000 (16:15 -0800)
Cherry-pick 3.7.0's 565e020573d56afb3eefafa4e8975d24b677c80d.  Again,
conflict because the fixes entry goes into a different file.

When picking up from floor or removing from container fails because
there aren't any inventory slots available, pickup/take-out stops.
But the message
|Your knapsack can't accomodate any more items.
is inaccurate if there is gold beyond the stopping point.  Actually
continuing in order to pickup/take-out gold would require substantial
changes, but varying the message to be
|Your knapsack can't accomodate any more items (except gold).
when stopping is a one line fix.  The parenthesized remark is only
added if there is actually some gold after the current object and is
given regardless of whether autopickup happens to be targetting it.

Fixes #246

doc/fixes36.4
src/pickup.c

index c49854d28b700e9ef31b8710a0db54255733a25c..d42e88c8668eac6ac18072a8313db4d5f3360083 100644 (file)
@@ -1,4 +1,4 @@
-$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.2 $ $NHDT-Date: 1576281514 2019/12/13 23:58:34 $
+$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.3 $ $NHDT-Date: 1576282492 2019/12/14 00:14:52 $
 
 This fixes36.4 file is here to capture information about updates in the 3.6.x
 lineage following the release of 3.6.3 in December 2019.  Hypothetical version
@@ -11,6 +11,9 @@ GDBPATH and GREPPATH from sysconf or -D... on compilation command line were
        at end of game when that was enabled
 fix the article used in the message when your steed encounters a polymorph trap
 alloc teleporting onto the vibrating square
+message "your knapsack can't accomodate any more items" when picking stuff up
+       or removing such from container was inaccurate if there was some gold
+       pending; vary the message rather than add more convoluted pickup code
 dozen-ish assorted spelling/typo fixes in messages and source comments
 
 
index cd0fd118bb27cf9e9ba8aab85ef459d2fb862c23..76f35aa8badd908304cd51854a1aa600171c2a48 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 pickup.c        $NHDT-Date: 1570566381 2019/10/08 20:26:21 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.235 $ */
+/* NetHack 3.6 pickup.c        $NHDT-Date: 1576282488 2019/12/14 00:14:48 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.237 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2012. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -1424,7 +1424,14 @@ boolean telekinesis;
                /* [exception for gold coins will have to change
                    if silver/copper ones ever get implemented] */
                && inv_cnt(FALSE) >= 52 && !merge_choice(invent, obj)) {
-        Your("knapsack cannot accommodate any more items.");
+        /* if there is some gold here (and we haven't already skipped it),
+           we aren't limited by the 52 item limit for it, but caller and
+           "grandcaller" aren't prepared to skip stuff and then pickup
+           just gold, so the best we can do here is vary the message */
+        Your("knapsack cannot accommodate any more items%s.",
+             /* floor follows by nexthere, otherwise container so by nobj */
+             nxtobj(obj, GOLD_PIECE, (boolean) (obj->where == OBJ_FLOOR))
+                 ? " (except gold)" : "");
         result = -1; /* nothing lifted */
     } else {
         result = 1;