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:
@@ -834,6 +834,8 @@ static const char dknowns[] = { WAND_CLASS, RING_CLASS, POTION_CLASS,
|
||||
void
|
||||
clear_dknown(struct obj *obj)
|
||||
{
|
||||
/* note: this is an unobserving not an observing, so don't call
|
||||
observe_object even if dknown is being set to 1 */
|
||||
obj->dknown = strchr(dknowns, obj->oclass) ? 0 : 1;
|
||||
if ((obj->otyp >= ELVEN_SHIELD && obj->otyp <= ORCISH_SHIELD)
|
||||
|| obj->otyp == SHIELD_OF_REFLECTION
|
||||
@@ -960,6 +962,7 @@ mksobj_init(struct obj **obj, boolean artif)
|
||||
we initialize glob->owt explicitly so weight() doesn't
|
||||
need to perform any fix up and returns glob->owt as-is */
|
||||
otmp->owt = objects[otmp->otyp].oc_weight;
|
||||
/* dknown, but not observed */
|
||||
otmp->known = otmp->dknown = 1;
|
||||
otmp->corpsenm = PM_GRAY_OOZE + (otmp->otyp - GLOB_OF_GRAY_OOZE);
|
||||
start_glob_timeout(otmp, 0L);
|
||||
|
||||
Reference in New Issue
Block a user