inventory display after regaining sight (trunk only)
I suspect--but have no way to test--that there is a subtle difference in game play between perm_invent and !perm_invent involving object merging or other activity that depends on whether or not object->dknown is set. For objects pickup up while blind, where object->dknown is left as is, the perm_invent config would have such items marked as seen sooner (since there are umpteen places that call update_inventory() which will end up setting the seen bit while formatting objects). Non-perm_invent wouldn't have that done until the user examines invent (or asks to see a list of objects at the "which object?" prompt for various commands). This patch effectively examines inventory whenever blindness ends, so both modes get dknown set as soon as possible. And if we ever add an "effect known" flag for unseen objects which are used while blind, this would be a suitable place to perform deferred object discovery.
This commit is contained in:
@@ -907,11 +907,12 @@ E void NDECL(remove_gold_from_invent);
|
||||
#endif
|
||||
E struct obj *FDECL(getobj, (const char *,const char *));
|
||||
E int FDECL(ggetobj, (const char *,int (*)(OBJ_P),int,BOOLEAN_P,unsigned *));
|
||||
E int FDECL(askchain, (struct obj **,const char *,int,int (*)(OBJ_P),
|
||||
int (*)(OBJ_P),int,const char *));
|
||||
E void FDECL(fully_identify_obj, (struct obj *));
|
||||
E int FDECL(identify, (struct obj *));
|
||||
E void FDECL(identify_pack, (int,BOOLEAN_P));
|
||||
E int FDECL(askchain, (struct obj **,const char *,int,int (*)(OBJ_P),
|
||||
int (*)(OBJ_P),int,const char *));
|
||||
E void NDECL(learn_unseen_invent);
|
||||
E void FDECL(prinv, (const char *,struct obj *,long));
|
||||
E char *FDECL(xprname, (struct obj *,const char *,CHAR_P,BOOLEAN_P,long,long));
|
||||
E int NDECL(ddoinv);
|
||||
|
||||
21
src/invent.c
21
src/invent.c
@@ -1692,6 +1692,27 @@ boolean learning_id; /* true if we just read unknown identify scroll */
|
||||
update_inventory();
|
||||
}
|
||||
|
||||
/* called when regaining sight; mark inventory objects which were picked
|
||||
up while blind as now having been seen */
|
||||
void
|
||||
notice_unseen_invent()
|
||||
{
|
||||
struct obj *otmp;
|
||||
|
||||
if (Blind) return; /* sanity check */
|
||||
|
||||
for (otmp = invent; otmp; otmp = otmp->nobj) {
|
||||
if (otmp->dknown) continue; /* already seen */
|
||||
/* set dknown, perhaps bknown (for priest[ess]) */
|
||||
(void) xname(otmp);
|
||||
/*
|
||||
* If object->eknown gets implemented (see learnwand(zap.c)),
|
||||
* handle deferred discovery here.
|
||||
*/
|
||||
}
|
||||
update_inventory();
|
||||
}
|
||||
|
||||
STATIC_OVL char
|
||||
obj_to_let(obj) /* should of course only be called for things in invent */
|
||||
register struct obj *obj;
|
||||
|
||||
@@ -285,6 +285,9 @@ boolean talk;
|
||||
got the message "a door appears in the wall") */
|
||||
vision_recalc(0);
|
||||
if (Blind_telepat || Infravision) see_monsters();
|
||||
|
||||
/* update dknown flag for inventory picked up while blind */
|
||||
if (can_see_now) learn_unseen_invent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user