/** * Notice things about an object that would be noticed in time. */ static void object_notice_after_time(void) { int i; int flag; object_type *o_ptr; char o_name[80]; bitflag f[OF_SIZE], timed_mask[OF_SIZE]; flags_init(timed_mask, OF_SIZE, OF_NOTICE_TIMED_MASK, FLAG_END); /* Check every item the player is wearing */ for (i = INVEN_WIELD; i < ALL_INVEN_TOTAL; i++) { o_ptr = &p_ptr->inventory[i]; if (!o_ptr->k_idx || object_is_known(o_ptr)) continue; /* Check for timed notice flags */ object_desc(o_name, sizeof(o_name), o_ptr, ODESC_BASE); object_flags(o_ptr, f); of_inter(f, timed_mask); for (flag = of_next(f, FLAG_START); flag != FLAG_END; flag = of_next(f, flag + 1)) { if (!of_has(o_ptr->known_flags, flag)) { /* Message */ if (!streq(msgs[flag], "")) msg_format(msgs[flag], o_name); /* Notice the flag */ object_notice_flag(o_ptr, flag); if (object_is_jewelry(o_ptr) && (!object_effect(o_ptr) || object_effect_is_known(o_ptr))) { /* XXX this is a small hack, but jewelry with anything noticeable really is obvious */ /* XXX except, wait until learn activation if that is only clue */ object_flavor_aware(o_ptr); object_check_for_ident(o_ptr); } } else { /* Notice the flag is absent */ object_notice_flag(o_ptr, flag); } } /* XXX Is this necessary? */ object_check_for_ident(o_ptr); } }
/** * Notice any slays on a particular object which are in mask. * * \param o_ptr is the object on which we are noticing slays * \param mask is the flagset within which we are noticing them */ void object_notice_slays(object_type *o_ptr, const bitflag mask[OF_SIZE]) { bool learned; bitflag f[OF_SIZE]; char o_name[40]; int i; /* We are only interested in the flags specified in mask */ object_flags(o_ptr, f); of_inter(f, mask); /* if you learn a slay, learn the ego and print a message */ for (i = 0; i < SL_MAX; i++) { const struct slay *s_ptr = &slay_table[i]; if (of_has(f, s_ptr->object_flag)) { learned = object_notice_flag(o_ptr, s_ptr->object_flag); if (EASY_LEARN && learned) { object_notice_ego(o_ptr); object_desc(o_name, sizeof(o_name), o_ptr, ODESC_BASE | ODESC_SINGULAR); msg("Your %s %s!", o_name, s_ptr->active_verb); } } } object_check_for_ident(o_ptr); }
/** * Notice a given special flag on wielded items. * * \param flag is the flag to notice */ void wieldeds_notice_flag(int flag) { int i; /* XXX Eddie need different naming conventions for starting wieldeds at INVEN_WIELD vs INVEN_WIELD+2 */ for (i = INVEN_WIELD; i < ALL_INVEN_TOTAL; i++) { object_type *o_ptr = &p_ptr->inventory[i]; bitflag f[OF_SIZE]; if (!o_ptr->k_idx) continue; object_flags(o_ptr, f); if (of_has(f, flag) && !of_has(o_ptr->known_flags, flag)) { char o_name[80]; object_desc(o_name, sizeof(o_name), o_ptr, ODESC_BASE); /* Notice the flag */ object_notice_flag(o_ptr, flag); /* XXX Eddie should this go before noticing the flag to avoid learning twice? */ if (EASY_LEARN && object_is_jewelry(o_ptr)) { /* XXX Eddie EASY_LEARN Possible concern: gets =teleportation just from +2 speed */ object_flavor_aware(o_ptr); object_check_for_ident(o_ptr); } /* Message */ if (!streq(msgs[flag], "")) msg_format(msgs[flag], o_name); } else { /* Notice that flag is absent */ object_notice_flag(o_ptr, flag); } /* XXX Eddie should not need this, should be done in noticing, but will remove later */ object_check_for_ident(o_ptr); } return; }
/* * Notice slays on a particular object. * * \param known_f0 is the list of flags to notice */ void object_notice_slay(object_type *o_ptr, int flag) { const slay_t *s_ptr; bool learned = object_notice_flag(o_ptr, flag); /* if you learn a slay, learn the ego and print a message */ if (EASY_LEARN && learned) { object_notice_ego(o_ptr); for (s_ptr = slay_table; s_ptr->slay_flag; s_ptr++) { if (s_ptr->slay_flag == flag) { char o_name[40]; object_desc(o_name, sizeof(o_name), o_ptr, ODESC_BASE); msg_format("Your %s %s!", o_name, s_ptr->active_verb); } } } object_check_for_ident(o_ptr); }