From ff817b55e1626e64e757a9626782827161144aa8 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 2 Sep 2016 02:38:10 -0700 Subject: [PATCH] fix bz623 - 'D' when not carrying anything 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 | 2 ++ src/do.c | 13 ++++++++++--- src/invent.c | 10 ++++++---- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/doc/fixes36.1 b/doc/fixes36.1 index c9eaf19c8..d4f6e6bfe 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -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 diff --git a/src/do.c b/src/do.c index 94ef36ee3..9fdece91f 100644 --- 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); diff --git a/src/invent.c b/src/invent.c index 5aa99ce6c..fa478b516 100644 --- a/src/invent.c +++ b/src/invent.c @@ -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; -- 2.40.0