Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
player.h File Reference

Player implementation. More...

#include "guid.h"
#include "obj-properties.h"
#include "object.h"
#include "option.h"
#include "player-calcs.h"
#include "list-magic-realms.h"

Go to the source code of this file.

Data Structures

struct  quest

Player structures

struct  player
 Most of the "player" information goes here. More...
struct  player_race
 Player racial info. More...
struct  start_item
 Items the player starts with. More...
struct  magic_realm
 Structure for magic realms. More...
struct  class_spell
 A structure to hold class-dependent information on spells. More...
struct  class_book
 A structure to hold class-dependent information on spell books. More...
struct  class_magic
 Information about class magic knowledge. More...
struct  player_class
 Player class info. More...
struct  history_entry
 Histories are a graph of charts; each chart contains a set of individual entries for that chart, and each entry contains a text description and a successor chart to move history generation to. More...
struct  history_chart
struct  player_other
 Some more player information This information is retained across player lives. More...


#define PY_MAX_EXP   99999999L /* Maximum exp */

Player constants

#define PY_MAX_LEVEL   50 /* Maximum level */
#define PY_SPELL_LEARNED   0x01 /* Spell has been learned */
 Flags for player.spell_flags[].
#define PY_SPELL_WORKED   0x02 /* Spell has been successfully tried */
#define PY_SPELL_FORGOTTEN   0x04 /* Spell has been forgotten */
#define BTH_PLUS_ADJ   3 /* Adjust BTH per plus-to-hit */
#define REALM(a, b, c, d, e, f)   REALM_##a,
#define NOSCORE_WIZARD   0x0002
 player_type.noscore flags
#define NOSCORE_DEBUG   0x0008
#define NOSCORE_JUMPING   0x0010


typedef struct player player_type
 Most of the "player" information goes here.
typedef struct player_class player_class
 Player class info.


enum  { REALM_MAX }
 Player magic realms. More...


struct player_classplayer_id2class (guid id)
int stat_name_to_idx (const char *name)
const char * stat_idx_to_name (int type)
bool player_stat_inc (struct player *p, int stat)
bool player_stat_dec (struct player *p, int stat, bool permanent)
void player_exp_gain (struct player *p, s32b amount)
void player_exp_lose (struct player *p, s32b amount, bool permanent)
void player_flags (struct player *p, bitflag f[OF_SIZE])
 Obtain object flags for the player.
byte player_hp_attr (struct player *p)
byte player_sp_attr (struct player *p)
bool player_restore_mana (struct player *p, int amt)
const char * player_safe_name (struct player *p, bool strip_suffix)
 Return a version of the player's name safe for use in filesystems.
struct player_raceplayer_id2race (guid id)


struct player_bodybodies
struct player_raceraces
struct magic_realm realms [REALM_MAX]
 Magic realms: index, spell stat, verb, spell noun, book noun, realm name.
struct player_classclasses
const s32b player_exp [PY_MAX_LEVEL]


 Pointer to the player other record.
 Pointer to the player struct.

Detailed Description

Player implementation.

Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke Copyright (c) 2011 See COPYING. Copyright (c) 2015 Nick McConnell

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 BTH_PLUS_ADJ   3 /* Adjust BTH per plus-to-hit */
#define NOSCORE_DEBUG   0x0008

Referenced by enter_score(), and textui_cmd_debug().

#define NOSCORE_JUMPING   0x0010

Referenced by choose_profile(), and do_cmd_wiz_jump().

#define NOSCORE_WIZARD   0x0002
#define PY_MAX_EXP   99999999L /* Maximum exp */

Player constants

Referenced by adjust_level(), do_cmd_wiz_advance(), and effect_handler_GAIN_EXP().

#define PY_MAX_LEVEL   50 /* Maximum level */
#define PY_SPELL_FORGOTTEN   0x04 /* Spell has been forgotten */

Referenced by calc_spells(), and spell_menu_display().

#define PY_SPELL_LEARNED   0x01 /* Spell has been learned */
#define PY_SPELL_WORKED   0x02 /* Spell has been successfully tried */

Referenced by spell_cast(), and spell_menu_display().

#define REALM (   a,
)    REALM_##a,

Typedef Documentation

typedef struct player_class player_class

Player class info.

typedef struct player player_type

Most of the "player" information goes here.

This stucture gives us a large collection of player variables.

This entire structure is wiped when a new character is born.

This structure is more or less laid out so that the information which must be saved in the savefile precedes all the information which can be recomputed as needed.

Enumeration Type Documentation

anonymous enum

Player magic realms.


Function Documentation

void player_exp_gain ( struct player p,
s32b  amount 
void player_exp_lose ( struct player p,
s32b  amount,
bool  permanent 
void player_flags ( struct player p,
bitflag  f[OF_SIZE] 

Obtain object flags for the player.

References player_race::flags, player::lev, of_on, player_has, and player::race.

Referenced by calc_bonuses(), display_player_sust_info(), and display_resistance_panel().

byte player_hp_attr ( struct player p)
struct player_class* player_id2class ( guid  id)
struct player_race* player_id2race ( guid  id)
bool player_restore_mana ( struct player p,
int  amt 
const char* player_safe_name ( struct player p,
bool  strip_suffix 
byte player_sp_attr ( struct player p)
bool player_stat_dec ( struct player p,
int  stat,
bool  permanent 
bool player_stat_inc ( struct player p,
int  stat 
const char* stat_idx_to_name ( int  type)

References STAT_MAX, stat_name_list, and type.

int stat_name_to_idx ( const char *  name)

References i, my_stricmp(), and stat_name_list.

Referenced by effect_param().

Variable Documentation

struct player_body* bodies
struct player_class* classes
player_other* op_ptr

Pointer to the player struct.

const s32b player_exp[PY_MAX_LEVEL]


Referenced by adjust_level(), prt_exp(), and show_adv_exp().

struct player_race* races
struct magic_realm realms[REALM_MAX]

Magic realms: index, spell stat, verb, spell noun, book noun, realm name.

Referenced by parse_class_magic().