]> granicus.if.org Git - nethack/commitdiff
Wield and swapweapon ext cmd fail return values
authorPasi Kallinen <paxed@alt.org>
Thu, 17 Feb 2022 09:06:28 +0000 (11:06 +0200)
committerPasi Kallinen <paxed@alt.org>
Thu, 17 Feb 2022 09:06:35 +0000 (11:06 +0200)
src/wield.c

index 1c3b549c0f5acfe292d6e03c2f58a7f083020dfc..4a7eb83228dc7e4cfd746c1c20080ab1628af8ca 100644 (file)
@@ -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 */