Angband
player-history.h
Go to the documentation of this file.
1 
19 #ifndef HISTORY_H
20 #define HISTORY_H
21 
22 #include "angband.h"
23 
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 
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 */
bool history_is_artifact_known(struct player *p, const struct artifact *artifact)
Returns true if the artifact is KNOWN in the history log.
Definition: player-history.c:139
byte a_idx
Definition: player-history.h:51
void history_clear(struct player *p)
Clear any existing history.
Definition: player-history.c:56
Includes basic includes.
void history_lose_artifact(struct player *p, const struct artifact *artifact)
Mark artifact number id as lost forever.
Definition: player-history.c:245
bool history_add_full(struct player *p, bitflag *type, int aidx, int dlev, int clev, int turn, const char *text)
Add an entry with text text to the history list, with type type ("HIST_xxx" in player-history.h), and artifact number id (0 for everything else).
Definition: player-history.c:76
#define HIST_SIZE
Definition: player-history.h:36
s32b turn
Definition: game-world.c:45
bool history_add(struct player *p, const char *text, int type)
Adds an entry to the history ledger.
Definition: player-history.c:127
s16b dlev
Definition: player-history.h:49
uint8_t byte
Definition: h-basic.h:167
Player history table.
Definition: player-history.h:47
void history_unmask_unknown(struct player *p)
Convert all ARTIFACT_UNKNOWN history items to HIST_ARTIFACT_KNOWN.
Definition: player-history.c:271
const char * text
Definition: player-attack.c:281
int type
Definition: mon-msg.c:80
const char ** p[]
Definition: name.c:40
byte bitflag
Definition: z-bitflag.h:27
Definition: player-history.h:49
int16_t s16b
Definition: h-basic.h:170
History message types.
s16b clev
Definition: player-history.h:50
s32b turn
Definition: player-history.h:52
size_t history_get_list(struct player *p, struct history_info **list)
Present a copy of the history fot UI use.
Definition: player-history.c:287
int32_t s32b
Definition: h-basic.h:173
bitflag type[HIST_SIZE]
Definition: player-history.h:48
void history_find_artifact(struct player *p, const struct artifact *artifact)
Add an artifact to the history log.
Definition: player-history.c:222
Most of the "player" information goes here.
Definition: player.h:452
Information about artifacts.
Definition: object.h:239