Angband
Data Structures | Macros | Enumerations | Functions
player-history.h File Reference

Character auto-history creation and management. More...

#include "angband.h"
#include "list-history-types.h"

Go to the source code of this file.

Data Structures

struct  history_info
 Player history table. More...
 

Macros

#define HIST(a, b)   HIST_##a,
 
#define HIST_SIZE   FLAG_SIZE(HIST_MAX)
 
#define hist_has(f, flag)   flag_has_dbg(f, HIST_SIZE, flag, #f, #flag)
 
#define hist_on(f, flag)   flag_on_dbg(f, HIST_SIZE, flag, #f, #flag)
 
#define hist_off(f, flag)   flag_off(f, HIST_SIZE, flag)
 
#define hist_wipe(f)   flag_wipe(f, HIST_SIZE)
 
#define hist_copy(f1, f2)   flag_copy(f1, f2, HIST_SIZE)
 

Enumerations

enum  { HIST_MAX }
 History message types. More...
 

Functions

void history_clear (struct player *p)
 Clear any existing history. More...
 
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). More...
 
bool history_add (struct player *p, const char *text, int type)
 Adds an entry to the history ledger. More...
 
bool history_is_artifact_known (struct player *p, const struct artifact *artifact)
 Returns true if the artifact is KNOWN in the history log. More...
 
void history_find_artifact (struct player *p, const struct artifact *artifact)
 Add an artifact to the history log. More...
 
void history_lose_artifact (struct player *p, const struct artifact *artifact)
 Mark artifact number id as lost forever. More...
 
void history_unmask_unknown (struct player *p)
 Convert all ARTIFACT_UNKNOWN history items to HIST_ARTIFACT_KNOWN. More...
 
size_t history_get_list (struct player *p, struct history_info **list)
 Present a copy of the history fot UI use. More...
 

Detailed Description

Character auto-history creation and management.

Copyright (c) 2007 J.D. White

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Macro Definition Documentation

#define HIST (   a,
 
)    HIST_##a,
#define hist_copy (   f1,
  f2 
)    flag_copy(f1, f2, HIST_SIZE)

Referenced by history_add_full().

#define hist_has (   f,
  flag 
)    flag_has_dbg(f, HIST_SIZE, flag, #f, #flag)
#define hist_off (   f,
  flag 
)    flag_off(f, HIST_SIZE, flag)
#define hist_on (   f,
  flag 
)    flag_on_dbg(f, HIST_SIZE, flag, #f, #flag)
#define HIST_SIZE   FLAG_SIZE(HIST_MAX)
#define hist_wipe (   f)    flag_wipe(f, HIST_SIZE)

Enumeration Type Documentation

anonymous enum

History message types.

Enumerator
HIST_MAX 

Function Documentation

bool history_add ( struct player p,
const char *  text,
int  type 
)

Adds an entry to the history ledger.

References flags, hist_on, HIST_SIZE, hist_wipe, history_add_with_flags(), and NULL.

Referenced by adjust_level(), do_cmd_accept_character(), do_cmd_note(), and mon_take_hit().

bool history_add_full ( struct player p,
bitflag type,
int  aidx,
int  dlev,
int  clev,
int  turnno,
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).

Return true on success.

References history_info::a_idx, history_info::clev, history_info::dlev, player_history::entries, history_info::event, h, player::hist, hist_copy, history_init(), history_realloc(), player_history::length, my_strcpy(), player_history::next, history_info::turn, and history_info::type.

Referenced by history_add_with_flags(), and rd_history().

void history_clear ( struct player p)
void history_find_artifact ( struct player p,
const struct artifact artifact 
)

Add an artifact to the history log.

Call this to add an artifact to the history list or make the history entry visible.

References flags, get_artifact_name(), player::hist, hist_on, HIST_SIZE, hist_wipe, history_add_with_flags(), history_mark_artifact_known(), NULL, and strnfmt().

Referenced by do_cmd_sell(), and object_touch().

size_t history_get_list ( struct player p,
struct history_info **  list 
)

Present a copy of the history fot UI use.

References player_history::entries, h, player::hist, and player_history::next.

Referenced by dump_history(), history_display(), and wr_history().

bool history_is_artifact_known ( struct player p,
const struct artifact artifact 
)

Returns true if the artifact is KNOWN in the history log.

References history_info::a_idx, artifact::aidx, player_history::entries, h, player::hist, hist_has, i, player_history::next, and history_info::type.

Referenced by desc_art_fake().

void history_lose_artifact ( struct player p,
const struct artifact artifact 
)
void history_unmask_unknown ( struct player p)

Convert all ARTIFACT_UNKNOWN history items to HIST_ARTIFACT_KNOWN.

Use only after player retirement/death for the final character dump.

References player_history::entries, h, player::hist, hist_has, hist_off, hist_on, i, player_history::next, and history_info::type.

Referenced by death_knowledge().