]> granicus.if.org Git - nethack/commitdiff
fix bz623 - 'D' when not carrying anything
authorPatR <rankin@nethack.org>
Fri, 2 Sep 2016 09:38:10 +0000 (02:38 -0700)
committerPatR <rankin@nethack.org>
Fri, 2 Sep 2016 09:38:10 +0000 (02:38 -0700)
With menustyle set to "full" or "partial", using 'D' when not
carrying anything gave no feedback.  (Modes "traditional" and
"combination" give "you have nothing to drop" via ggetobj().)

Also, there's no need to reset in-progress armor removal, lock
picking, or trap setting if you don't actually drop anything.
The inventory they're set to operate on or with stays intact.

doc/fixes36.1
src/do.c
src/invent.c

index c9eaf19c8d658229b3820f7ca3b09a66e66f7b6f..d4f6e6bfe4ecf387b92b6b2fcf14dd9fe425eec7 100644 (file)
@@ -336,6 +336,8 @@ if user supplied a specific monster name when asked to choose a monster class,
        S_quadruped due to being preceded by "titanothere" in mons[])
 change ing_suffix() to not double final 'w' when adding 'ing' ('t=' yielded
        "You mime throwwing something.")
+using 'D' to drop when not carrying anything finished (after doing nothing)
+       without giving any feedback for menustyles "full" and "partial"
 
 
 Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository
index 94ef36ee3bc917cfea2019a201ef5429e4a3de09..9fdece91f7d19275b1c0d0c97a0705817928accc 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -1,4 +1,4 @@
-/* NetHack 3.6 do.c    $NHDT-Date: 1464487100 2016/05/29 01:58:20 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.156 $ */
+/* NetHack 3.6 do.c    $NHDT-Date: 1472809073 2016/09/02 09:37:53 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.158 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -34,7 +34,8 @@ dodrop()
     result = drop(getobj(&drop_types[i], "drop"));
     if (*u.ushops)
         sellobj_state(SELL_NORMAL);
-    reset_occupations();
+    if (result)
+        reset_occupations();
 
     return result;
 }
@@ -739,6 +740,10 @@ doddrop()
 {
     int result = 0;
 
+    if (!invent) {
+        You("have nothing to drop.");
+        return 0;
+    }
     add_valid_menu_class(0); /* clear any classes already there */
     if (*u.ushops)
         sellobj_state(SELL_DELIBERATE);
@@ -747,7 +752,8 @@ doddrop()
         result = menu_drop(result);
     if (*u.ushops)
         sellobj_state(SELL_NORMAL);
-    reset_occupations();
+    if (result)
+        reset_occupations();
 
     return result;
 }
@@ -785,6 +791,7 @@ int retry;
         free((genericptr_t) pick_list);
     } else if (flags.menu_style == MENU_COMBINATION) {
         unsigned ggoresults = 0;
+
         all_categories = FALSE;
         /* Gather valid classes via traditional NetHack method */
         i = ggetobj("drop", drop, 0, TRUE, &ggoresults);
index 5aa99ce6c655eb3467e9389edbf8e108b9f1b9f5..fa478b516a2ce18b5d96c89d498f737de64b3c4b 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 invent.c        $NHDT-Date: 1461967848 2016/04/29 22:10:48 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.208 $ */
+/* NetHack 3.6 invent.c        $NHDT-Date: 1472809075 2016/09/02 09:37:55 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.210 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1573,13 +1573,15 @@ unsigned *resultflags;
     char extra_removeables[3 + 1]; /* uwep,uswapwep,uquiver */
     char buf[BUFSZ], qbuf[QBUFSZ];
 
-    if (resultflags)
-        *resultflags = 0;
-    takeoff = ident = allflag = m_seen = FALSE;
     if (!invent) {
         You("have nothing to %s.", word);
+        if (resultflags)
+            *resultflags = ALL_FINISHED;
         return 0;
     }
+    if (resultflags)
+        *resultflags = 0;
+    takeoff = ident = allflag = m_seen = FALSE;
     add_valid_menu_class(0); /* reset */
     if (taking_off(word)) {
         takeoff = TRUE;