1 /**
2  * \file player-history.h
3  * \brief Character auto-history creation and management
4  *
5  * Copyright (c) 2007 J.D. White
6  *
7  * This work is free software; you can redistribute it and/or modify it
8  * under the terms of either:
9  *
10  * a) the GNU General Public License as published by the Free Software
11  *    Foundation, version 2, or
12  *
13  * b) the "Angband licence":
14  *    This software may be copied and distributed for educational, research,
15  *    and not for profit purposes provided that this copyright and statement
16  *    are included in all such copies.  Other copyrights may also apply.
17  */
18 
19 #ifndef HISTORY_H
20 #define HISTORY_H
21 
22 #include "angband.h"
23 
24 /**
25  * History message types
26  */
27 enum {
28 	#define HIST(a, b) HIST_##a,
29 	#include "list-history-types.h"
30 	#undef HIST
31 
32 	HIST_MAX
33 };
34 
35 
36 #define HIST_SIZE			FLAG_SIZE(HIST_MAX)
37 
38 #define hist_has(f, flag)	flag_has_dbg(f, HIST_SIZE, flag, #f, #flag)
39 #define hist_on(f, flag)	flag_on_dbg(f, HIST_SIZE, flag, #f, #flag)
40 #define hist_off(f, flag)	flag_off(f, HIST_SIZE, flag)
41 #define hist_wipe(f)		flag_wipe(f, HIST_SIZE)
42 #define hist_copy(f1, f2)	flag_copy(f1, f2, HIST_SIZE)
43 
44 /**
45  * Player history table
46  */
47 struct history_info {
48 	bitflag type[HIST_SIZE];/* Kind of history item */
49 	s16b dlev;				/* Dungeon level when this item was recorded */
50 	s16b clev;				/* Character level when this item was recorded */
51 	byte a_idx;				/* Artifact this item relates to */
52 	s32b turn;				/* Turn this item was recorded on */
53 	char event[80];			/* The text of the item */
54 };
55 
56 void history_clear(struct player *p);
57 bool history_add_full(struct player *p,
58 		bitflag *type,
59 		int aidx,
60 		int dlev,
61 		int clev,
62 		int turn,
63 		const char *text);
64 bool history_add(struct player *p, const char *text, int type);
65 bool history_is_artifact_known(struct player *p, const struct artifact *artifact);
66 void history_find_artifact(struct player *p, const struct artifact *artifact);
67 void history_lose_artifact(struct player *p, const struct artifact *artifact);
68 void history_unmask_unknown(struct player *p);
69 size_t history_get_list(struct player *p, struct history_info **list);
70 
71 #endif /* !HISTORY_H */
72