From: Pasi Kallinen Date: Thu, 17 Feb 2022 09:06:28 +0000 (+0200) Subject: Wield and swapweapon ext cmd fail return values X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=390429545eca0a16b92a9279fe6137d0e701acad;p=nethack Wield and swapweapon ext cmd fail return values --- diff --git a/src/wield.c b/src/wield.c index 1c3b549c0..4a7eb8322 100644 --- a/src/wield.c +++ b/src/wield.c @@ -322,8 +322,7 @@ dowield(void) g.multi = 0; if (cantwield(g.youmonst.data)) { pline("Don't be ridiculous!"); - cmdq_clear(); - return ECMD_OK; + return ECMD_FAIL; } /* Prompt for a new weapon */ @@ -336,8 +335,7 @@ dowield(void) You("are already wielding that!"); if (is_weptool(wep) || is_wet_towel(wep)) g.unweapon = FALSE; /* [see setuwep()] */ - cmdq_clear(); - return ECMD_OK; + return ECMD_FAIL; } else if (welded(uwep)) { weldmsg(uwep); /* previously interrupted armor removal mustn't be resumed */ @@ -345,8 +343,7 @@ dowield(void) /* if player chose a partial stack but can't wield it, undo split */ if (wep->o_id && wep->o_id == g.context.objsplit.child_oid) unsplitobj(wep); - cmdq_clear(); - return ECMD_OK; + return ECMD_FAIL; } else if (wep->o_id && wep->o_id == g.context.objsplit.child_oid) { /* if wep is the result of supplying a count to getobj() we don't want to split something already wielded; for @@ -401,8 +398,7 @@ dowield(void) setuqwep((struct obj *) 0); } else if (wep->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) { You("cannot wield that!"); - cmdq_clear(); - return ECMD_OK; + return ECMD_FAIL; } wielding: @@ -435,13 +431,11 @@ doswapweapon(void) g.multi = 0; if (cantwield(g.youmonst.data)) { pline("Don't be ridiculous!"); - cmdq_clear(); - return ECMD_OK; + return ECMD_FAIL; } if (welded(uwep)) { weldmsg(uwep); - cmdq_clear(); - return ECMD_OK; + return ECMD_FAIL; } /* Unwield your current secondary weapon */