Accurately track which items have been discovered, even if not #named

This fixes a couple of bugs: a long-standing bug in which writing a
scroll by label could fail even if you've already seen a scroll with
that label (due to the game not tracking whether or not you've seen a
scroll if it doesn't have a name); and a somewhat newer bug in which
spellbooks auto-identified by Wizard knowledge were marked as having
been encountered (rather than as known but not encountered).

Breaks save file compatibility, but not bones files.
This commit is contained in:
Alex Smith
2025-11-25 22:42:38 +00:00
parent 10a5e67478
commit 8c29b20010
38 changed files with 155 additions and 122 deletions

View File

@@ -2733,10 +2733,10 @@ potion_dip(struct obj *obj, struct obj *potion)
else
singlepotion->cursed = obj->cursed; /* odiluted left as-is */
singlepotion->bknown = FALSE;
if (Blind) {
singlepotion->dknown = FALSE;
} else {
singlepotion->dknown = !Hallucination;
singlepotion->dknown = FALSE; /* provisionally */
if (!Blind) {
if (!Hallucination)
observe_object(singlepotion);
*newbuf = '\0';
if (mixture == POT_WATER && singlepotion->dknown)
Sprintf(newbuf, "clears");
@@ -2756,7 +2756,7 @@ potion_dip(struct obj *obj, struct obj *potion)
struct obj fakeobj;
fakeobj = cg.zeroobj;
fakeobj.dknown = 1;
fakeobj.dknown = 1; /* no need to observe_object */
fakeobj.otyp = old_otyp;
fakeobj.oclass = POTION_CLASS;
docall(&fakeobj);