/** * Convert all ARTIFACT_UNKNOWN history items to HIST_ARTIFACT_KNOWN. * Use only after player retirement/death for the final character dump. */ void history_unmask_unknown(void) { size_t i = history_ctr; while (i--) { if (hist_has(history_list[i].type, HIST_ARTIFACT_UNKNOWN)) { hist_off(history_list[i].type, HIST_ARTIFACT_UNKNOWN); hist_on(history_list[i].type, HIST_ARTIFACT_KNOWN); } } }
/** * Convert all ARTIFACT_UNKNOWN history items to HIST_ARTIFACT_KNOWN. * Use only after player retirement/death for the final character dump. */ void history_unmask_unknown(struct player *p) { struct player_history *h = &p->hist; size_t i = h->next; while (i--) { if (hist_has(h->entries[i].type, HIST_ARTIFACT_UNKNOWN)) { hist_off(h->entries[i].type, HIST_ARTIFACT_UNKNOWN); hist_on(h->entries[i].type, HIST_ARTIFACT_KNOWN); } } }
/** * Returns true if the artifact is KNOWN in the history log. */ bool history_is_artifact_known(struct artifact *artifact) { size_t i = history_ctr; assert(artifact); while (i--) { if (hist_has(history_list[i].type, HIST_ARTIFACT_KNOWN) && history_list[i].a_idx == artifact->aidx) return true; } return false; }
/** * Returns true if the artifact is KNOWN in the history log. */ bool history_is_artifact_known(struct player *p, const struct artifact *artifact) { struct player_history *h = &p->hist; size_t i = h->next; assert(artifact); while (i--) { if (hist_has(h->entries[i].type, HIST_ARTIFACT_KNOWN) && h->entries[i].a_idx == artifact->aidx) return true; } return false; }
/** * Returns true if the artifact denoted by a_idx is an active entry in * the history log (i.e. is not marked HIST_ARTIFACT_LOST). This permits * proper handling of the case where the player loses an artifact but (in * preserve mode) finds it again later. */ static bool history_is_artifact_logged(struct artifact *artifact) { size_t i = history_ctr; assert(artifact); while (i--) { /* Don't count ARTIFACT_LOST entries; then we can handle * re-finding previously lost artifacts in preserve mode */ if (hist_has(history_list[i].type, HIST_ARTIFACT_LOST)) continue; if (history_list[i].a_idx == artifact->aidx) return true; } return false; }