From 6002db106c5342e273979ab1d160e67a02efc8f3 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 3 Nov 2018 17:45:31 -0700 Subject: [PATCH] fix github issue #154 - #loot in A-autoselect all Fixes #154 With menustyle:Full, picking 'A - autoselect all' when putting items into a container ran code for taking things out and there wasn't any corresponding code for putting things in. Add some put-in-everything code. Taking things out doesn't offer 'A - autoselect all' as a choice so the code mentioned above may now be dead. Taking everything out seems like something that's much more likely to be desired than putting everything in. --- doc/fixes36.2 | 2 ++ src/pickup.c | 25 ++++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 7e84a61c5..8f3a00c70 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -181,6 +181,8 @@ death from something other than loss of hit points could leave hero with added several special cases for genocide and/or wishing prompt: (cookie, pie, genie, watchmen) lightning strike from Mjollnir did not make any noise +with menustyle:Full, picking 'A - autoselect all' when putting items into a + container actually took everything out of that container Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/pickup.c b/src/pickup.c index fae1e2f03..1c9d9d681 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pickup.c $NHDT-Date: 1516581051 2018/01/22 00:30:51 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.194 $ */ +/* NetHack 3.6 pickup.c $NHDT-Date: 1541292247 2018/11/04 00:44:07 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.200 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2739,12 +2739,23 @@ boolean put_in; } if (loot_everything) { - current_container->cknown = 1; - for (otmp = current_container->cobj; otmp; otmp = otmp2) { - otmp2 = otmp->nobj; - res = out_container(otmp); - if (res < 0) - break; + if (!put_in) { + current_container->cknown = 1; + for (otmp = current_container->cobj; otmp; otmp = otmp2) { + otmp2 = otmp->nobj; + res = out_container(otmp); + if (res < 0) + break; + n_looted += res; + } + } else { + for (otmp = invent; otmp && current_container; otmp = otmp2) { + otmp2 = otmp->nobj; + res = in_container(otmp); + if (res < 0) + break; + n_looted += res; + } } } else { mflags = INVORDER_SORT; -- 2.40.0