From 565e020573d56afb3eefafa4e8975d24b677c80d Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 5 Dec 2019 02:33:47 -0800 Subject: [PATCH] kinda/sorta fix github issue #246 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/fixes37.0 | 5 ++++- src/pickup.c | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 003e9342d..f9f60be61 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.8 $ $NHDT-Date: 1557663358 2019/05/12 12:15:58 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.17 $ $NHDT-Date: 1575542023 2019/12/05 10:33:43 $ General Fixes and Modified Features ----------------------------------- @@ -10,6 +10,9 @@ hero polymorphed into a vampire can use #monster to shape-shift rather than adjust bones filename buffer sizes to accommodate suffix fix internal self-recover to work with recent fields added to checkpoint file improvements to pronoun usage when hallucinating +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 Fixes to Pre-3.7.0 Problems that Were Exposed Via git Repository diff --git a/src/pickup.c b/src/pickup.c index 67921de6f..49fbc609b 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pickup.c $NHDT-Date: 1574982023 2019/11/28 23:00:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.249 $ */ +/* NetHack 3.6 pickup.c $NHDT-Date: 1575542023 2019/12/05 10:33:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.251 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1412,7 +1412,14 @@ boolean telekinesis; /* [exception for gold coins will have to change if silver/copper ones ever get implemented] */ && inv_cnt(FALSE) >= 52 && !merge_choice(g.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;