Macros | Functions | Variables
player.c File Reference

Player implementation. More...

#include "effects.h"
#include "init.h"
#include "obj-pile.h"
#include "obj-util.h"
#include "player-birth.h"
#include "player-calcs.h"
#include "player-history.h"
#include "player-quest.h"
#include "player-spell.h"
#include "player-timed.h"
#include "z-color.h"
#include "z-util.h"
#include "list-stats.h"


#define STAT(a)   #a,


int stat_name_to_idx (const char *name)
const char * stat_idx_to_name (int type)
const struct magic_realmlookup_realm (const char *name)
bool player_stat_inc (struct player *p, int stat)
bool player_stat_dec (struct player *p, int stat, bool permanent)
static void adjust_level (struct player *p, bool verbose)
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. More...
byte player_hp_attr (struct player *p)
byte player_sp_attr (struct player *p)
bool player_restore_mana (struct player *p, int amt)
void player_safe_name (char *safe, size_t safelen, const char *name, bool strip_suffix)
 Return a version of the player's name safe for use in filesystems. More...
static void init_player (void)
 Initialise player struct. More...
static void cleanup_player (void)
 Free player struct. More...


struct playerplayer
 Pointer to the player struct. More...
struct player_bodybodies


struct player_raceraces
struct player_classclasses
struct magic_realmrealms
const s32b player_exp [PY_MAX_LEVEL]
 Base experience levels, may be adjusted up for race and/or class. More...
static const char * stat_name_list []
struct init_module player_module

Detailed Description

Player implementation.

Copyright (c) 2011 See COPYING.

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 STAT (   a)    #a,

Function Documentation

static void adjust_level ( struct player p,
bool  verbose 
static void cleanup_player ( void  )
static void init_player ( void  )
const struct magic_realm* lookup_realm ( const char *  name)
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)
bool player_restore_mana ( struct player p,
int  amt 
void player_safe_name ( char *  safe,
size_t  safelen,
const char *  name,
bool  strip_suffix 

Return a version of the player's name safe for use in filesystems.

XXX This does not belong here.

References find_roman_suffix_start(), i, MIN, my_strcpy(), and suffix().

Referenced by death_file(), do_cmd_change_name(), do_cmd_pref_file_hack(), get_pref_path(), process_character_pref_files(), and savefile_set_name().

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(), and parse_realm_stat().

Variable Documentation

struct player_body* bodies
struct player_class* classes
struct player* player

Pointer to the player struct.

const s32b player_exp[PY_MAX_LEVEL]

Base experience levels, may be adjusted up for race and/or class.

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

struct init_module player_module
Initial value:
= {
.name = "player",
.init = init_player,
.cleanup = cleanup_player
static void init_player(void)
Initialise player struct.
Definition: player.c:386
static void cleanup_player(void)
Free player struct.
Definition: player.c:407
struct player_race* races
struct magic_realm* realms
const char* stat_name_list[]
Initial value:
= {
#define STAT(a)
Definition: list-summon-types.h:18

Referenced by stat_idx_to_name(), and stat_name_to_idx().