From: PatR Date: Mon, 25 Apr 2022 08:31:34 +0000 (-0700) Subject: "empty handed" vs "bare handed" X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9abec79df8dcd3168b59488a744496629945eae9;p=nethack "empty handed" vs "bare handed" When not wielding anything, ^X reports "you are empty handed" if wearing gloves or "you are bare handed" if no gloves. The ')', 'w-', and 'A)' commands were using "empty handed" unconditionally. Make them be consisitent with ^X. After this, body part HANDED is no longer used anywhere except in body_part(). --- diff --git a/include/extern.h b/include/extern.h index ed6205914..6c37313d1 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 extern.h $NHDT-Date: 1650838834 2022/04/24 22:20:34 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1108 $ */ +/* NetHack 3.7 extern.h $NHDT-Date: 1650875486 2022/04/25 08:31:26 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1109 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3134,6 +3134,7 @@ extern void set_ulycn(int); /* ### wield.c ### */ extern void setuwep(struct obj *); +extern const char *empty_handed(void); extern void setuqwep(struct obj *); extern void setuswapwep(struct obj *); extern int dowield(void); diff --git a/src/do_wear.c b/src/do_wear.c index 0659e257f..9a0bb13fc 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 do_wear.c $NHDT-Date: 1605578866 2020/11/17 02:07:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.136 $ */ +/* NetHack 3.7 do_wear.c $NHDT-Date: 1650875489 2022/04/25 08:31:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.156 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2655,7 +2655,7 @@ do_takeoff(void) if (was_twoweap) You("are no longer wielding either weapon."); else - You("are empty %s.", body_part(HANDED)); + You("are %s.", empty_handed()); } } else if (doff->what == W_SWAPWEP) { setuswapwep((struct obj *) 0); diff --git a/src/insight.c b/src/insight.c index bbcf66d72..a9cb20ebc 100644 --- a/src/insight.c +++ b/src/insight.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 insight.c $NHDT-Date: 1646428012 2022/03/04 21:06:52 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.56 $ */ +/* NetHack 3.7 insight.c $NHDT-Date: 1650875487 2022/04/25 08:31:27 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.60 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1203,13 +1203,7 @@ weapon_insight(int final) /* report being weaponless; distinguish whether gloves are worn [perhaps mention silver ring(s) when not wearning gloves?] */ if (!uwep) { - you_are(uarmg ? "empty handed" /* gloves imply hands */ - : humanoid(g.youmonst.data) - /* hands but no weapon and no gloves */ - ? "bare handed" - /* alternate phrasing for paws or lack of hands */ - : "not wielding anything", - ""); + you_are(empty_handed(), ""); /* two-weaponing implies hands and a weapon or wep-tool (not other odd stuff) in each hand */ diff --git a/src/invent.c b/src/invent.c index 6348b9ab1..4eec12d04 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 invent.c $NHDT-Date: 1650838836 2022/04/24 22:20:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.384 $ */ +/* NetHack 3.7 invent.c $NHDT-Date: 1650875487 2022/04/25 08:31:27 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.385 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -4400,7 +4400,7 @@ int doprwep(void) { if (!uwep) { - You("are empty %s.", body_part(HANDED)); + You("are %s.", empty_handed()); } else { prinv((char *) 0, uwep, 0L); if (u.twoweap) diff --git a/src/wield.c b/src/wield.c index 3c763a45e..605d3eb3b 100644 --- a/src/wield.c +++ b/src/wield.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 wield.c $NHDT-Date: 1607200367 2020/12/05 20:32:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.78 $ */ +/* NetHack 3.7 wield.c $NHDT-Date: 1650875488 2022/04/25 08:31:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.90 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2009. */ /* NetHack may be freely redistributed. See license for details. */ @@ -146,6 +146,19 @@ cant_wield_corpse(struct obj *obj) return TRUE; } +/* description of hands when not wielding anything; also used + by #seeweapon (')'), #attributes (^X), and #takeoffall ('A') */ +const char * +empty_handed(void) +{ + return uarmg ? "empty handed" /* gloves imply hands */ + : humanoid(g.youmonst.data) + /* hands but no weapon and no gloves */ + ? "bare handed" + /* alternate phrasing for paws or lack of hands */ + : "not wielding anything"; +} + static int ready_weapon(struct obj *wep) { @@ -156,11 +169,11 @@ ready_weapon(struct obj *wep) if (!wep) { /* No weapon */ if (uwep) { - You("are empty %s.", body_part(HANDED)); + You("are %s.", empty_handed()); setuwep((struct obj *) 0); res = ECMD_TIME; } else - You("are already empty %s.", body_part(HANDED)); + You("are already %s.", empty_handed()); } else if (wep->otyp == CORPSE && cant_wield_corpse(wep)) { /* hero must have been life-saved to get here; use a turn */ res = ECMD_TIME; /* corpse won't be wielded */ @@ -645,7 +658,7 @@ doquiver_core(const char *verb) /* "ready" or "fire" */ something we're wielding that's vulnerable to its damage) */ res = 0; if (was_uwep) { - You("are now empty %s.", body_part(HANDED)); + You("are now %s.", empty_handed()); res = 1; } else if (was_twoweap && !u.twoweap) { You("%s.", are_no_longer_twoweap);