Angband
Data Structures | Macros | Enumerations | Functions | Variables
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 (void)
 Clear any existing history.
size_t history_get_num (void)
 Return the number of history entries.
bool history_add_full (bitflag *type, struct artifact *artifact, s16b dlev, s16b clev, s32b turn, const char *text)
 Add an entry with text event to the history list, with type type ("HIST_xxx" in player-history.h), and artifact number id (0 for everything else).
bool history_add (const char *event, int type, struct artifact *art)
 Add an entry with text event to the history list, with type type ("HIST_xxx" in player-history.h), and artifact number id (0 for everything else).
bool history_add_artifact (struct artifact *art, bool known, bool found)
 Adding artifacts to the history list is trickier than other operations.
void history_unmask_unknown (void)
 Convert all ARTIFACT_UNKNOWN history items to HIST_ARTIFACT_KNOWN.
bool history_lose_artifact (struct artifact *art)
 Mark artifact number id as lost forever, either due to leaving it on a level, or due to a store purging its inventory after the player sold it.
bool history_is_artifact_known (struct artifact *art)
 Returns TRUE if the artifact is KNOWN in the history log.
size_t history_get_list (struct history_info **list)
 Present a copy of the history fot UI use.

Variables

struct history_infohistory_list

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)

Referenced by history_unmask_unknown().

#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 ( const char *  event,
int  type,
struct artifact artifact 
)

Add an entry with text event 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 player::depth, h, hist_on, HIST_SIZE, hist_wipe, history_add_full(), player::lev, and turn.

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

bool history_add_artifact ( struct artifact artifact,
bool  known,
bool  found 
)

Adding artifacts to the history list is trickier than other operations.

This is a wrapper function that gets some of the logic out of places where it really doesn't belong. Call this to add an artifact to the history list or make the history entry visible–history_add_artifact will make that determination depending on what object_is_known returns for the artifact.

References buf, player::depth, FALSE, hist_on, HIST_SIZE, hist_wipe, history_add(), history_add_full(), history_is_artifact_logged(), history_know_artifact(), player::lev, make_fake_artifact(), object_desc(), object_wipe(), ODESC_BASE, ODESC_PREFIX, ODESC_SPOIL, strnfmt(), TRUE, turn, and type.

Referenced by do_cmd_sell(), do_ident_item(), history_lose_artifact(), object_notice_everything(), object_notice_on_wield(), and player_pickup_aux().

bool history_add_full ( bitflag type,
struct artifact artifact,
s16b  dlev,
s16b  clev,
s32b  turnno,
const char *  text 
)

Add an entry with text event 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, artifact::aidx, history_info::clev, history_info::dlev, history_info::event, FALSE, hist_copy, HISTORY_BIRTH_SIZE, history_ctr, history_init(), history_set_num(), history_size, my_strcpy(), player::total_energy, TRUE, and history_info::turn.

Referenced by history_add(), history_add_artifact(), and rd_history().

void history_clear ( void  )

Clear any existing history.

References history_ctr, history_size, and mem_free().

Referenced by cleanup_angband(), do_cmd_accept_character(), and rd_history().

size_t history_get_list ( struct history_info **  list)

Present a copy of the history fot UI use.

References history_ctr, and history_list.

Referenced by dump_history(), and history_display().

size_t history_get_num ( void  )

Return the number of history entries.

References history_ctr.

Referenced by wr_history().

bool history_is_artifact_known ( struct artifact art)

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

References history_info::a_idx, artifact::aidx, FALSE, hist_has, history_ctr, i, TRUE, and type.

Referenced by desc_art_fake().

bool history_lose_artifact ( struct artifact art)

Mark artifact number id as lost forever, either due to leaving it on a level, or due to a store purging its inventory after the player sold it.

References history_info::a_idx, artifact::aidx, FALSE, hist_on, history_add_artifact(), history_ctr, i, TRUE, and type.

Referenced by store_delete_random().

void history_unmask_unknown ( void  )

Convert all ARTIFACT_UNKNOWN history items to HIST_ARTIFACT_KNOWN.

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

References hist_has, hist_off, hist_on, history_ctr, i, and type.

Referenced by death_knowledge().

Variable Documentation

struct history_info* history_list