diff --git a/include/extern.h b/include/extern.h index 8ad793291..699d9bf8c 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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); diff --git a/src/invent.c b/src/invent.c index c98c2fe5d..369fddcda 100644 --- a/src/invent.c +++ b/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; diff --git a/src/potion.c b/src/potion.c index b0819b8e3..31b53af3d 100644 --- a/src/potion.c +++ b/src/potion.c @@ -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(); } }