From 2caf2423c5590803b1f731b2b66053d3e1171476 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 21 Oct 2022 14:31:33 -0700 Subject: [PATCH] menu_drop() vs ECMD_TIME Some routines return ECMD_TIME|ECMD_CANCEL (for instance when 'a'pply wields an item and player cancels the attempt to use it) so change drop_menu() to test that properly. I don't think drop() ever returns that combined mask value but be prepared to handle time passage if it ever does. --- src/do.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/do.c b/src/do.c index b9dde1656..5ee281b6b 100644 --- a/src/do.c +++ b/src/do.c @@ -941,7 +941,7 @@ menu_drop(int retry) bypass_objlist(g.invent, FALSE); /* clear bypass bit for invent */ while ((otmp = nxt_unbypassed_obj(g.invent)) != 0) { if (drop_everything || all_categories || allow_category(otmp)) - n_dropped += ((drop(otmp) == ECMD_TIME) ? 1 : 0); + n_dropped += ((drop(otmp) & ECMD_TIME) != 0) ? 1 : 0; } /* we might not have dropped everything (worn armor, welded weapon, cursed loadstones), so reset any remaining inventory to normal */ @@ -950,7 +950,8 @@ menu_drop(int retry) /* drop the just picked item automatically, if only one stack */ otmp = find_justpicked(g.invent); if (otmp) - n_dropped += ((menudrop_split(otmp, justpicked_quan) == ECMD_TIME) ? 1 : 0); + n_dropped += ((menudrop_split(otmp, justpicked_quan) & ECMD_TIME) + != 0) ? 1 : 0; } else { /* should coordinate with perm invent, maybe not show worn items */ n = query_objlist("What would you like to drop?", &g.invent, @@ -979,8 +980,8 @@ menu_drop(int retry) if (!otmp2 || !otmp2->bypass) continue; /* found next selected invent item */ - n_dropped += (menudrop_split(otmp, pick_list[i].count) - == ECMD_TIME) ? 1 : 0; + n_dropped += ((menudrop_split(otmp, pick_list[i].count) + & ECMD_TIME) != 0) ? 1 : 0; } bypass_objlist(g.invent, FALSE); /* reset g.invent to normal */ free((genericptr_t) pick_list);