]> granicus.if.org Git - nethack/commitdiff
fix github issue #154 - #loot in A-autoselect all
authorPatR <rankin@nethack.org>
Sun, 4 Nov 2018 00:45:31 +0000 (17:45 -0700)
committerPatR <rankin@nethack.org>
Sun, 4 Nov 2018 00:45:31 +0000 (17:45 -0700)
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
src/pickup.c

index 7e84a61c560de5f4ddee2d8d8aba8415a00c6545..8f3a00c7083f21a83deb040284522f8d0ff78d5c 100644 (file)
@@ -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
index fae1e2f03c776d9a73c937ff4a66b012bfdda786..1c9d9d6810d502f5934554cc465308905f91b361 100644 (file)
@@ -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;