fix #H8850 - bless/curse state in perm_invent

Changing an inventory item's bknown flag wasn't followed by a call to
update_inventory() in many circumstances, so information which should
have appeared wasn't showing up until some other event triggered an
update.
This commit is contained in:
PatR
2019-06-04 10:50:24 -07:00
parent ac79fedf60
commit 43afa91ff8
14 changed files with 75 additions and 54 deletions
+5 -1
View File
@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.34 $ $NHDT-Date: 1559664948 2019/06/04 16:15:48 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.35 $ $NHDT-Date: 1559670600 2019/06/04 17:50:00 $
This fixes36.3 file is here to capture information about updates in the 3.6.x This fixes36.3 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.2 in May 2019. Please note, however, lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -42,6 +42,10 @@ if you survive turning into green slime due to life-saving (surviving as a
green slime) then die again due to green slimes having been genocided, green slime) then die again due to green slimes having been genocided,
the feedback was strange because it assumed that the prior message the feedback was strange because it assumed that the prior message
came from answering No to "Really die?" in explore or wizard mode came from answering No to "Really die?" in explore or wizard mode
various cases where objects had their bless/curse state become known weren't
updating persistent inventory window, when enabled, to reflect changes
(cited case was trying to remove cursed armor and being told of the
curse but there were lots of other situations with the same issue)
Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository
+2 -1
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 extern.h $NHDT-Date: 1559601014 2019/06/03 22:30:14 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.708 $ */ /* NetHack 3.6 extern.h $NHDT-Date: 1559670600 2019/06/04 17:50:00 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.709 $ */
/* Copyright (c) Steve Creps, 1988. */ /* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1341,6 +1341,7 @@ E void FDECL(unbless, (struct obj *));
E void FDECL(curse, (struct obj *)); E void FDECL(curse, (struct obj *));
E void FDECL(uncurse, (struct obj *)); E void FDECL(uncurse, (struct obj *));
E void FDECL(blessorcurse, (struct obj *, int)); E void FDECL(blessorcurse, (struct obj *, int));
E void FDECL(set_bknown, (struct obj *, unsigned));
E boolean FDECL(is_flammable, (struct obj *)); E boolean FDECL(is_flammable, (struct obj *));
E boolean FDECL(is_rottable, (struct obj *)); E boolean FDECL(is_rottable, (struct obj *));
E void FDECL(place_object, (struct obj *, int, int)); E void FDECL(place_object, (struct obj *, int, int));
+4 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 apply.c $NHDT-Date: 1553363415 2019/03/23 17:50:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.272 $ */ /* NetHack 3.6 apply.c $NHDT-Date: 1559670602 2019/06/04 17:50:02 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.274 $ */
/* 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. */
@@ -668,7 +668,7 @@ struct obj *obj;
pline("This leash is not attached to that creature."); pline("This leash is not attached to that creature.");
} else if (obj->cursed) { } else if (obj->cursed) {
pline_The("leash would not come off!"); pline_The("leash would not come off!");
obj->bknown = 1; set_bknown(obj, 1);
} else { } else {
mtmp->mleashed = 0; mtmp->mleashed = 0;
obj->leashmon = 0; obj->leashmon = 0;
@@ -2773,7 +2773,7 @@ struct obj *obj;
pline("%s welded to %s %s%c", pline("%s welded to %s %s%c",
(otmp->quan == 1L) ? "It is" : "They are", mhis(mtmp), (otmp->quan == 1L) ? "It is" : "They are", mhis(mtmp),
mon_hand, !otmp->bknown ? '!' : '.'); mon_hand, !otmp->bknown ? '!' : '.');
otmp->bknown = 1; set_bknown(otmp, 1);
gotit = FALSE; /* can't pull it free */ gotit = FALSE; /* can't pull it free */
} }
if (gotit) { if (gotit) {
@@ -3629,7 +3629,7 @@ doapply()
if (!rn2(49)) { if (!rn2(49)) {
if (!Blind) { if (!Blind) {
pline("%s %s.", Yobjnam2(obj, "glow"), hcolor("brown")); pline("%s %s.", Yobjnam2(obj, "glow"), hcolor("brown"));
obj->bknown = 1; set_bknown(obj, 1);
} }
unbless(obj); unbless(obj);
} }
+4 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 do.c $NHDT-Date: 1559299314 2019/05/31 10:41:54 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.191 $ */ /* NetHack 3.6 do.c $NHDT-Date: 1559670603 2019/06/04 17:50:03 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.192 $ */
/* 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. */
@@ -286,11 +286,11 @@ register struct obj *obj;
an(hcolor(obj->blessed ? NH_AMBER : NH_BLACK)), doname(obj), an(hcolor(obj->blessed ? NH_AMBER : NH_BLACK)), doname(obj),
otense(obj, "hit")); otense(obj, "hit"));
if (!Hallucination) if (!Hallucination)
obj->bknown = 1; obj->bknown = 1; /* ok to bypass set_bknown() */
} else { } else {
pline("%s %s on the altar.", Doname2(obj), otense(obj, "land")); pline("%s %s on the altar.", Doname2(obj), otense(obj, "land"));
if (obj->oclass != COIN_CLASS) if (obj->oclass != COIN_CLASS)
obj->bknown = 1; obj->bknown = 1; /* ok to bypass set_bknown() */
} }
} }
@@ -575,7 +575,7 @@ const char *word;
obj->corpsenm ? " any of" : "", plur(obj->quan)); obj->corpsenm ? " any of" : "", plur(obj->quan));
} }
obj->corpsenm = 0; /* reset */ obj->corpsenm = 0; /* reset */
obj->bknown = 1; set_bknown(obj, 1);
return FALSE; return FALSE;
} }
if (obj->otyp == LEASH && obj->leashmon != 0) { if (obj->otyp == LEASH && obj->leashmon != 0) {
+8 -8
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 do_wear.c $NHDT-Date: 1551138255 2019/02/25 23:44:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.108 $ */ /* NetHack 3.6 do_wear.c $NHDT-Date: 1559670603 2019/06/04 17:50:03 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.109 $ */
/* 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. */
@@ -1515,7 +1515,7 @@ doremring()
/* Check if something worn is cursed _and_ unremovable. */ /* Check if something worn is cursed _and_ unremovable. */
int int
cursed(otmp) cursed(otmp)
register struct obj *otmp; struct obj *otmp;
{ {
if (!otmp) { if (!otmp) {
impossible("cursed without otmp"); impossible("cursed without otmp");
@@ -1527,7 +1527,7 @@ register struct obj *otmp;
|| otmp->otyp == LENSES || otmp->quan > 1L); || otmp->otyp == LENSES || otmp->quan > 1L);
You("can't. %s cursed.", use_plural ? "They are" : "It is"); You("can't. %s cursed.", use_plural ? "They are" : "It is");
otmp->bknown = TRUE; set_bknown(otmp, 1);
return 1; return 1;
} }
return 0; return 0;
@@ -1535,7 +1535,7 @@ register struct obj *otmp;
int int
armoroff(otmp) armoroff(otmp)
register struct obj *otmp; struct obj *otmp;
{ {
register int delay = -objects[otmp->otyp].oc_delay; register int delay = -objects[otmp->otyp].oc_delay;
@@ -1859,7 +1859,7 @@ struct obj *obj;
} }
if (uarmg && uarmg->cursed) { if (uarmg && uarmg->cursed) {
res = !uarmg->bknown; res = !uarmg->bknown;
uarmg->bknown = 1; set_bknown(uarmg, 1);
You("cannot remove your gloves to put on the ring."); You("cannot remove your gloves to put on the ring.");
return res; /* uses move iff we learned gloves are cursed */ return res; /* uses move iff we learned gloves are cursed */
} }
@@ -2249,7 +2249,7 @@ register struct obj *otmp;
} }
if (why) { if (why) {
You("cannot %s to remove the ring.", buf); You("cannot %s to remove the ring.", buf);
why->bknown = TRUE; set_bknown(why, 1);
return 0; return 0;
} }
} }
@@ -2258,7 +2258,7 @@ register struct obj *otmp;
if (welded(uwep)) { if (welded(uwep)) {
You("are unable to take off your %s while wielding that %s.", You("are unable to take off your %s while wielding that %s.",
c_gloves, is_sword(uwep) ? c_sword : c_weapon); c_gloves, is_sword(uwep) ? c_sword : c_weapon);
uwep->bknown = TRUE; set_bknown(uwep, 1);
return 0; return 0;
} else if (Glib) { } else if (Glib) {
You_cant("take off the slippery %s with your slippery %s.", You_cant("take off the slippery %s with your slippery %s.",
@@ -2296,7 +2296,7 @@ register struct obj *otmp;
} }
if (why) { if (why) {
You("cannot %s to take off %s.", buf, the(xname(otmp))); You("cannot %s to take off %s.", buf, the(xname(otmp)));
why->bknown = TRUE; set_bknown(why, 1);
return 0; return 0;
} }
} }
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 eat.c $NHDT-Date: 1542765357 2018/11/21 01:55:57 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.197 $ */ /* NetHack 3.6 eat.c $NHDT-Date: 1559670604 2019/06/04 17:50:04 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.202 $ */
/* 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. */
@@ -2503,7 +2503,7 @@ doeat()
* against the possibility just in case. * against the possibility just in case.
*/ */
if (welded(otmp) || (otmp->cursed && (otmp->owornmask & W_RING))) { if (welded(otmp) || (otmp->cursed && (otmp->owornmask & W_RING))) {
otmp->bknown = 1; /* for ring; welded() does this for weapon */ set_bknown(otmp, 1); /* for ring; welded() does this for weapon */
You("spit out %s.", the(xname(otmp))); You("spit out %s.", the(xname(otmp)));
} else { } else {
You("spit %s out onto the %s.", the(xname(otmp)), You("spit %s out onto the %s.", the(xname(otmp)),
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 files.c $NHDT-Date: 1546144856 2018/12/30 04:40:56 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.249 $ */ /* NetHack 3.6 files.c $NHDT-Date: 1559670605 2019/06/04 17:50:05 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.250 $ */
/* 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. */
@@ -2946,7 +2946,7 @@ struct obj *obj;
/* subset of starting inventory pre-ID */ /* subset of starting inventory pre-ID */
obj->dknown = 1; obj->dknown = 1;
if (Role_if(PM_PRIEST)) if (Role_if(PM_PRIEST))
obj->bknown = 1; obj->bknown = 1; /* ok to bypass set_bknown() */
/* same criteria as lift_object()'s check for available inventory slot */ /* same criteria as lift_object()'s check for available inventory slot */
if (obj->oclass != COIN_CLASS && inv_cnt(FALSE) >= 52 if (obj->oclass != COIN_CLASS && inv_cnt(FALSE) >= 52
&& !merge_choice(invent, obj)) { && !merge_choice(invent, obj)) {
+20 -7
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 mkobj.c $NHDT-Date: 1559476922 2019/06/02 12:02:02 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.149 $ */ /* NetHack 3.6 mkobj.c $NHDT-Date: 1559670606 2019/06/04 17:50:06 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.150 $ */
/* 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. */
@@ -698,7 +698,7 @@ int alter_type;
{ {
xchar ox, oy; xchar ox, oy;
char objroom; char objroom;
boolean set_bknown; boolean learn_bknown;
const char *those, *them; const char *those, *them;
struct monst *shkp = 0; struct monst *shkp = 0;
@@ -738,21 +738,21 @@ int alter_type;
/* when shopkeeper describes the object as being uncursed or unblessed /* when shopkeeper describes the object as being uncursed or unblessed
hero will know that it is now uncursed; will also make the feedback hero will know that it is now uncursed; will also make the feedback
from `I x' after bill_dummy_object() be more specific for this item */ from `I x' after bill_dummy_object() be more specific for this item */
set_bknown = (alter_type == COST_UNCURS || alter_type == COST_UNBLSS); learn_bknown = (alter_type == COST_UNCURS || alter_type == COST_UNBLSS);
switch (obj->where) { switch (obj->where) {
case OBJ_FREE: /* obj_no_longer_held() */ case OBJ_FREE: /* obj_no_longer_held() */
case OBJ_INVENT: case OBJ_INVENT:
if (set_bknown) if (learn_bknown)
obj->bknown = 1; set_bknown(obj, 1);
verbalize("You %s %s %s, you pay for %s!", verbalize("You %s %s %s, you pay for %s!",
alteration_verbs[alter_type], those, simpleonames(obj), alteration_verbs[alter_type], those, simpleonames(obj),
them); them);
bill_dummy_object(obj); bill_dummy_object(obj);
break; break;
case OBJ_FLOOR: case OBJ_FLOOR:
if (set_bknown) if (learn_bknown)
obj->bknown = 1; obj->bknown = 1; /* ok to bypass set_bknown() here */
if (costly_spot(u.ux, u.uy) && objroom == *u.ushops) { if (costly_spot(u.ux, u.uy) && objroom == *u.ushops) {
verbalize("You %s %s, you pay for %s!", verbalize("You %s %s, you pay for %s!",
alteration_verbs[alter_type], those, them); alteration_verbs[alter_type], those, them);
@@ -1389,6 +1389,19 @@ register struct obj *otmp;
return (!!otmp->blessed - !!otmp->cursed); return (!!otmp->blessed - !!otmp->cursed);
} }
/* set the object's bless/curse-state known flag */
void
set_bknown(obj, onoff)
struct obj *obj;
unsigned onoff; /* 1 or 0 */
{
if (obj->bknown != onoff) {
obj->bknown = onoff;
if (obj->where == OBJ_INVENT && moves > 1L)
update_inventory();
}
}
/* /*
* Calculate the weight of the given object. This will recursively follow * Calculate the weight of the given object. This will recursively follow
* and calculate the weight of any containers. * and calculate the weight of any containers.
+6 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 objnam.c $NHDT-Date: 1558485650 2019/05/22 00:40:50 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.241 $ */ /* NetHack 3.6 objnam.c $NHDT-Date: 1559670607 2019/06/04 17:50:07 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.242 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -450,9 +450,12 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
if (!nn && ocl->oc_uses_known && ocl->oc_unique) if (!nn && ocl->oc_uses_known && ocl->oc_unique)
obj->known = 0; obj->known = 0;
if (!Blind && !distantname) if (!Blind && !distantname)
obj->dknown = TRUE; obj->dknown = 1;
if (Role_if(PM_PRIEST)) if (Role_if(PM_PRIEST))
obj->bknown = TRUE; obj->bknown = 1; /* actively avoid set_bknown();
* we mustn't call update_inventory() now because
* it would call xname() (via doname()) recursively
* and could end up clobbering all the obufs... */
if (iflags.override_ID) { if (iflags.override_ID) {
known = dknown = bknown = TRUE; known = dknown = bknown = TRUE;
+4 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 pickup.c $NHDT-Date: 1559130050 2019/05/29 11:40:50 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.226 $ */ /* NetHack 3.6 pickup.c $NHDT-Date: 1559670608 2019/06/04 17:50:08 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.227 $ */
/* 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. */
@@ -408,8 +408,8 @@ struct obj *obj;
? TRUE : FALSE) ? TRUE : FALSE)
: TRUE; /* catchall: no filters specified, so accept */ : TRUE; /* catchall: no filters specified, so accept */
if (Role_if(PM_PRIEST)) if (Role_if(PM_PRIEST) && !obj->bknown)
obj->bknown = TRUE; set_bknown(obj, 1);
/* /*
* There are three types of filters possible and the first and * There are three types of filters possible and the first and
@@ -2113,7 +2113,7 @@ register struct obj *obj;
Icebox ? "refrigerate" : "stash", something); Icebox ? "refrigerate" : "stash", something);
return 0; return 0;
} else if ((obj->otyp == LOADSTONE) && obj->cursed) { } else if ((obj->otyp == LOADSTONE) && obj->cursed) {
obj->bknown = 1; set_bknown(obj, 1);
pline_The("stone%s won't leave your person.", plur(obj->quan)); pline_The("stone%s won't leave your person.", plur(obj->quan));
return 0; return 0;
} else if (obj->otyp == AMULET_OF_YENDOR } else if (obj->otyp == AMULET_OF_YENDOR
+9 -9
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 pray.c $NHDT-Date: 1549074257 2019/02/02 02:24:17 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.110 $ */ /* NetHack 3.6 pray.c $NHDT-Date: 1559670608 2019/06/04 17:50:08 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.112 $ */
/* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -499,7 +499,7 @@ int trouble;
what ? what : (const char *) Yobjnam2(otmp, "softly glow"), what ? what : (const char *) Yobjnam2(otmp, "softly glow"),
hcolor(NH_AMBER)); hcolor(NH_AMBER));
iflags.last_msg = PLNMSG_OBJ_GLOWS; iflags.last_msg = PLNMSG_OBJ_GLOWS;
otmp->bknown = !Hallucination; otmp->bknown = !Hallucination; /* ok to skip set_bknown() */
} }
uncurse(otmp); uncurse(otmp);
update_inventory(); update_inventory();
@@ -558,7 +558,7 @@ int trouble;
otmp = which_armor(u.usteed, W_SADDLE); otmp = which_armor(u.usteed, W_SADDLE);
if (!Blind) { if (!Blind) {
pline("%s %s.", Yobjnam2(otmp, "softly glow"), hcolor(NH_AMBER)); pline("%s %s.", Yobjnam2(otmp, "softly glow"), hcolor(NH_AMBER));
otmp->bknown = TRUE; set_bknown(otmp, 1);
} }
uncurse(otmp); uncurse(otmp);
break; break;
@@ -805,7 +805,7 @@ gcrownu()
make_splbk: make_splbk:
obj = mksobj(class_gift, TRUE, FALSE); obj = mksobj(class_gift, TRUE, FALSE);
bless(obj); bless(obj);
obj->bknown = TRUE; obj->bknown = 1; /* ok to skip set_bknown() */
at_your_feet("A spellbook"); at_your_feet("A spellbook");
dropy(obj); dropy(obj);
u.ugifts++; u.ugifts++;
@@ -892,7 +892,7 @@ gcrownu()
bless(obj); bless(obj);
obj->oeroded = obj->oeroded2 = 0; obj->oeroded = obj->oeroded2 = 0;
obj->oerodeproof = TRUE; obj->oerodeproof = TRUE;
obj->bknown = obj->rknown = TRUE; obj->bknown = obj->rknown = 1; /* ok to skip set_bknown() */
if (obj->spe < 1) if (obj->spe < 1)
obj->spe = 1; obj->spe = 1;
/* acquire skill in this weapon */ /* acquire skill in this weapon */
@@ -1024,7 +1024,7 @@ aligntyp g_align;
You_feel("the power of %s over %s.", u_gname(), You_feel("the power of %s over %s.", u_gname(),
yname(uwep)); yname(uwep));
uncurse(uwep); uncurse(uwep);
uwep->bknown = TRUE; uwep->bknown = 1; /* ok to bypass set_bknown() */
*repair_buf = '\0'; *repair_buf = '\0';
} else if (!uwep->blessed) { } else if (!uwep->blessed) {
if (!Blind) { if (!Blind) {
@@ -1036,7 +1036,7 @@ aligntyp g_align;
You_feel("the blessing of %s over %s.", u_gname(), You_feel("the blessing of %s over %s.", u_gname(),
yname(uwep)); yname(uwep));
bless(uwep); bless(uwep);
uwep->bknown = TRUE; uwep->bknown = 1; /* ok to bypass set_bknown() */
*repair_buf = '\0'; *repair_buf = '\0';
} }
@@ -1127,7 +1127,7 @@ aligntyp g_align;
pline("%s %s.", Yobjnam2(otmp, "softly glow"), pline("%s %s.", Yobjnam2(otmp, "softly glow"),
hcolor(NH_AMBER)); hcolor(NH_AMBER));
iflags.last_msg = PLNMSG_OBJ_GLOWS; iflags.last_msg = PLNMSG_OBJ_GLOWS;
otmp->bknown = TRUE; otmp->bknown = 1; /* ok to bypass set_bknown() */
++any; ++any;
} }
uncurse(otmp); uncurse(otmp);
@@ -1234,7 +1234,7 @@ boolean bless_water;
&& (bless_water ? !otmp->blessed : !otmp->cursed)) { && (bless_water ? !otmp->blessed : !otmp->cursed)) {
otmp->blessed = bless_water; otmp->blessed = bless_water;
otmp->cursed = !bless_water; otmp->cursed = !bless_water;
otmp->bknown = bc_known; otmp->bknown = bc_known; /* ok to bypass set_bknown() */
changed += otmp->quan; changed += otmp->quan;
} else if (otmp->oclass == POTION_CLASS) } else if (otmp->oclass == POTION_CLASS)
other = TRUE; other = TRUE;
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 sit.c $NHDT-Date: 1544442714 2018/12/10 11:51:54 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.59 $ */ /* NetHack 3.6 sit.c $NHDT-Date: 1559670609 2019/06/04 17:50:09 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.61 $ */
/* 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. */
@@ -392,7 +392,7 @@ rndcurse()
if (!Blind) { if (!Blind) {
pline("%s %s.", Yobjnam2(otmp, "glow"), pline("%s %s.", Yobjnam2(otmp, "glow"),
hcolor(otmp->cursed ? NH_BLACK : (const char *) "brown")); hcolor(otmp->cursed ? NH_BLACK : (const char *) "brown"));
otmp->bknown = TRUE; otmp->bknown = 1; /* ok to bypass set_bknown() here */
} }
} }
} }
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 steed.c $NHDT-Date: 1559422254 2019/06/01 20:50:54 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.64 $ */ /* NetHack 3.6 steed.c $NHDT-Date: 1559670610 2019/06/04 17:50:10 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.66 $ */
/* Copyright (c) Kevin Hugo, 1998-1999. */ /* Copyright (c) Kevin Hugo, 1998-1999. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -525,7 +525,7 @@ int reason; /* Player was thrown off etc. */
if (otmp && otmp->cursed) { if (otmp && otmp->cursed) {
You("can't. The saddle %s cursed.", You("can't. The saddle %s cursed.",
otmp->bknown ? "is" : "seems to be"); otmp->bknown ? "is" : "seems to be");
otmp->bknown = TRUE; otmp->bknown = 1; /* ok to skip set_bknown() here */
return; return;
} }
if (!have_spot) { if (!have_spot) {
+5 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 wield.c $NHDT-Date: 1543492132 2018/11/29 11:48:52 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.58 $ */ /* NetHack 3.6 wield.c $NHDT-Date: 1559670611 2019/06/04 17:50:11 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.59 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2009. */ /*-Copyright (c) Robert Patrick Rankin, 2009. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -171,7 +171,7 @@ struct obj *wep;
(wep->quan == 1L) ? "itself" : "themselves", /* a3 */ (wep->quan == 1L) ? "itself" : "themselves", /* a3 */
bimanual(wep) ? (const char *) makeplural(body_part(HAND)) bimanual(wep) ? (const char *) makeplural(body_part(HAND))
: body_part(HAND)); : body_part(HAND));
wep->bknown = TRUE; set_bknown(wep, 1);
} else { } else {
/* The message must be printed before setuwep (since /* The message must be printed before setuwep (since
* you might die and be revived from changing weapons), * you might die and be revived from changing weapons),
@@ -628,7 +628,7 @@ can_twoweapon()
; /* must be life-saved to reach here; return FALSE */ ; /* must be life-saved to reach here; return FALSE */
} else if (Glib || uswapwep->cursed) { } else if (Glib || uswapwep->cursed) {
if (!Glib) if (!Glib)
uswapwep->bknown = TRUE; set_bknown(uswapwep, 1);
drop_uswapwep(); drop_uswapwep();
} else } else
return TRUE; return TRUE;
@@ -736,7 +736,7 @@ register int amount;
if (!Blind) { if (!Blind) {
Sprintf(buf, "%s with %s aura.", Sprintf(buf, "%s with %s aura.",
Yobjnam2(uwep, "glow"), an(hcolor(NH_AMBER))); Yobjnam2(uwep, "glow"), an(hcolor(NH_AMBER)));
uwep->bknown = !Hallucination; uwep->bknown = !Hallucination; /* ok to bypass set_bknown() */
} else { } else {
/* cursed tin opener is wielded in right hand */ /* cursed tin opener is wielded in right hand */
Sprintf(buf, "Your right %s tingles.", body_part(HAND)); Sprintf(buf, "Your right %s tingles.", body_part(HAND));
@@ -859,7 +859,7 @@ welded(obj)
register struct obj *obj; register struct obj *obj;
{ {
if (obj && obj == uwep && will_weld(obj)) { if (obj && obj == uwep && will_weld(obj)) {
obj->bknown = TRUE; set_bknown(obj, 1);
return 1; return 1;
} }
return 0; return 0;