W_WEAPON -> W_WEAPONS

Report #H9243 misinterpreted W_WEAPON as W_WEP and attributed a
hypothetical ball and chain sanity checking problem to that.
Rename the former to W_WEAPONS to emphasize that it includes
alternate/secondary weapon and quivered stack as well as wielded
weapon.
This commit is contained in:
PatR
2019-10-08 13:26:39 -07:00
parent e92445810f
commit ba3004d6e2
7 changed files with 18 additions and 17 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 prop.h $NHDT-Date: 1547514641 2019/01/15 01:10:41 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.20 $ */ /* NetHack 3.6 prop.h $NHDT-Date: 1570566360 2019/10/08 20:26:00 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.21 $ */
/* Copyright (c) 1989 Mike Threepoint */ /* Copyright (c) 1989 Mike Threepoint */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -106,7 +106,7 @@ struct prop {
#define W_WEP 0x00000100L /* Wielded weapon */ #define W_WEP 0x00000100L /* Wielded weapon */
#define W_QUIVER 0x00000200L /* Quiver for (f)iring ammo */ #define W_QUIVER 0x00000200L /* Quiver for (f)iring ammo */
#define W_SWAPWEP 0x00000400L /* Secondary weapon */ #define W_SWAPWEP 0x00000400L /* Secondary weapon */
#define W_WEAPON (W_WEP | W_SWAPWEP | W_QUIVER) #define W_WEAPONS (W_WEP | W_SWAPWEP | W_QUIVER)
#define W_ART 0x00001000L /* Carrying artifact (not really worn) */ #define W_ART 0x00001000L /* Carrying artifact (not really worn) */
#define W_ARTI 0x00002000L /* Invoked artifact (not really worn) */ #define W_ARTI 0x00002000L /* Invoked artifact (not really worn) */
/* Amulets, rings, tools, and other items */ /* Amulets, rings, tools, and other items */
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 ball.c $NHDT-Date: 1559601027 2019/06/03 22:30:27 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.40 $ */ /* NetHack 3.6 ball.c $NHDT-Date: 1570566373 2019/10/08 20:26:13 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.43 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) David Cohrs, 2006. */ /*-Copyright (c) David Cohrs, 2006. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1074,7 +1074,7 @@ bc_sanity_check()
&& uball->where != OBJ_FREE) && uball->where != OBJ_FREE)
|| (freeball ^ freechain) || (freeball ^ freechain)
|| (uball->owornmask & W_BALL) == 0L || (uball->owornmask & W_BALL) == 0L
|| (uball->owornmask & ~(W_BALL | W_WEAPON)) != 0L)) { || (uball->owornmask & ~(W_BALL | W_WEAPONS)) != 0L)) {
otyp = uball->otyp; otyp = uball->otyp;
onam = safe_typename(otyp); onam = safe_typename(otyp);
impossible("uball: type %d (%s), where %d, wornmask=0x%08lx", impossible("uball: type %d (%s), where %d, wornmask=0x%08lx",
+4 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 do_wear.c $NHDT-Date: 1559670603 2019/06/04 17:50:03 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.109 $ */ /* NetHack 3.6 do_wear.c $NHDT-Date: 1570566377 2019/10/08 20:26:17 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.111 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1101,7 +1101,7 @@ struct obj *otmp;
boolean already_blind = Blind, changed = FALSE; boolean already_blind = Blind, changed = FALSE;
/* blindfold might be wielded; release it for wearing */ /* blindfold might be wielded; release it for wearing */
if (otmp->owornmask & W_WEAPON) if (otmp->owornmask & W_WEAPONS)
remove_worn_item(otmp, FALSE); remove_worn_item(otmp, FALSE);
setworn(otmp, W_TOOL); setworn(otmp, W_TOOL);
on_msg(otmp); on_msg(otmp);
@@ -1919,7 +1919,7 @@ struct obj *obj;
/* if the armor is wielded, release it for wearing (won't be /* if the armor is wielded, release it for wearing (won't be
welded even if cursed; that only happens for weapons/weptools) */ welded even if cursed; that only happens for weapons/weptools) */
if (obj->owornmask & W_WEAPON) if (obj->owornmask & W_WEAPONS)
remove_worn_item(obj, FALSE); remove_worn_item(obj, FALSE);
/* /*
* Setting obj->known=1 is done because setworn() causes hero's AC * Setting obj->known=1 is done because setworn() causes hero's AC
@@ -2545,7 +2545,7 @@ doddoremarm()
possibly combined with weapons */ possibly combined with weapons */
(void) strncpy(context.takeoff.disrobing, "disrobing", CONTEXTVERBSZ); (void) strncpy(context.takeoff.disrobing, "disrobing", CONTEXTVERBSZ);
/* specific activity when handling weapons only */ /* specific activity when handling weapons only */
if (!(context.takeoff.mask & ~W_WEAPON)) if (!(context.takeoff.mask & ~W_WEAPONS))
(void) strncpy(context.takeoff.disrobing, "disarming", (void) strncpy(context.takeoff.disrobing, "disarming",
CONTEXTVERBSZ); CONTEXTVERBSZ);
(void) take_off(); (void) take_off();
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 invent.c $NHDT-Date: 1570232224 2019/10/04 23:37:04 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.263 $ */ /* NetHack 3.6 invent.c $NHDT-Date: 1570566378 2019/10/08 20:26:18 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.264 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */ /*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1889,7 +1889,7 @@ boolean
is_worn(otmp) is_worn(otmp)
struct obj *otmp; struct obj *otmp;
{ {
return (otmp->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE | W_WEAPON)) return (otmp->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE | W_WEAPONS))
? TRUE ? TRUE
: FALSE; : FALSE;
} }
+3 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 mkobj.c $NHDT-Date: 1561588627 2019/06/26 22:37:07 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.151 $ */ /* NetHack 3.6 mkobj.c $NHDT-Date: 1570566379 2019/10/08 20:26:19 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.152 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */ /*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2572,7 +2572,7 @@ struct obj *obj;
} }
if (n == 2 && carried(obj) if (n == 2 && carried(obj)
&& obj == uball && (owornmask & W_BALL) != 0L && obj == uball && (owornmask & W_BALL) != 0L
&& (owornmask & W_WEAPON) != 0L) { && (owornmask & W_WEAPONS) != 0L) {
/* chained ball can be wielded/alt-wielded/quivered; if so, /* chained ball can be wielded/alt-wielded/quivered; if so,
pretend it's not chained in order to check the weapon pointer pretend it's not chained in order to check the weapon pointer
(we've already verified the ball pointer by successfully passing (we've already verified the ball pointer by successfully passing
@@ -2681,7 +2681,7 @@ struct obj *obj;
becoming embedded in poly'd hero's skin */ becoming embedded in poly'd hero's skin */
if (embedded && !Is_dragon_scales(obj)) if (embedded && !Is_dragon_scales(obj))
what = "skin"; what = "skin";
} else if (owornmask & W_WEAPON) { } else if (owornmask & W_WEAPONS) {
/* monsters don't maintain alternate weapon or quiver */ /* monsters don't maintain alternate weapon or quiver */
if (mcarried(obj) && (owornmask & (W_SWAPWEP | W_QUIVER)) != 0L) if (mcarried(obj) && (owornmask & (W_SWAPWEP | W_QUIVER)) != 0L)
what = (owornmask & W_SWAPWEP) != 0L ? "monst alt weapon?" what = (owornmask & W_SWAPWEP) != 0L ? "monst alt weapon?"
+3 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 pickup.c $NHDT-Date: 1570142736 2019/10/03 22:45:36 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.234 $ */ /* NetHack 3.6 pickup.c $NHDT-Date: 1570566381 2019/10/08 20:26:21 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.235 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1206,7 +1206,8 @@ int qflags;
for (curr = olist; curr; curr = FOLLOW(curr, qflags)) { for (curr = olist; curr; curr = FOLLOW(curr, qflags)) {
if (curr->oclass == *pack) { if (curr->oclass == *pack) {
if ((qflags & WORN_TYPES) if ((qflags & WORN_TYPES)
&& !(curr->owornmask & (W_ARMOR | W_ACCESSORY | W_WEAPON))) && !(curr->owornmask & (W_ARMOR | W_ACCESSORY
| W_WEAPONS)))
continue; continue;
if (!counted_category) { if (!counted_category) {
ccount++; ccount++;
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 steal.c $NHDT-Date: 1562806584 2019/07/11 00:56:24 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.74 $ */ /* NetHack 3.6 steal.c $NHDT-Date: 1570566382 2019/10/08 20:26:22 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.75 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -218,7 +218,7 @@ boolean unchain_ball; /* whether to unpunish or just unwield */
Ring_gone(obj); Ring_gone(obj);
} else if (obj->owornmask & W_TOOL) { } else if (obj->owornmask & W_TOOL) {
Blindf_off(obj); Blindf_off(obj);
} else if (obj->owornmask & W_WEAPON) { } else if (obj->owornmask & W_WEAPONS) {
if (obj == uwep) if (obj == uwep)
uwepgone(); uwepgone();
if (obj == uswapwep) if (obj == uswapwep)