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...
void player_flags_timed (struct player *p, bitflag f[OF_SIZE])
 Combine any flags due to timed effects on the player into those in f. 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...
void player_cleanup_members (struct player *p)
 Release resources allocated for fields in the player structure. More...
static void init_player (void)
 Initialise player struct. More...
static void cleanup_player (void)
 Free player struct. More...


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


struct player_raceraces
struct player_shapeshapes
struct player_classclasses
struct player_abilityplayer_abilities
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

◆ adjust_level()

static void adjust_level ( struct player p,
bool  verbose 

◆ cleanup_player()

static void cleanup_player ( void  )

Free player struct.

References mem_free(), and player_cleanup_members().

◆ init_player()

static void init_player ( void  )

◆ lookup_realm()

const struct magic_realm* lookup_realm ( const char *  name)

◆ player_cleanup_members()

void player_cleanup_members ( struct player p)

◆ player_exp_gain()

void player_exp_gain ( struct player p,
s32b  amount 

◆ player_exp_lose()

void player_exp_lose ( struct player p,
s32b  amount,
bool  permanent 

◆ player_flags()

void player_flags ( struct player p,
bitflag  f[OF_SIZE] 

◆ player_flags_timed()

void player_flags_timed ( struct player p,
bitflag  f[OF_SIZE] 

Combine any flags due to timed effects on the player into those in f.

References of_on, and player::timed.

Referenced by calc_bonuses(), and compute_ui_entry_values_for_player().

◆ player_hp_attr()

byte player_hp_attr ( struct player p)

◆ player_restore_mana()

bool player_restore_mana ( struct player p,
int  amt 

◆ player_safe_name()

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(), handle_key_equip_cmp_general(), process_character_pref_files(), and savefile_set_name().

◆ player_sp_attr()

byte player_sp_attr ( struct player p)

◆ player_stat_dec()

bool player_stat_dec ( struct player p,
int  stat,
bool  permanent 

◆ player_stat_inc()

bool player_stat_inc ( struct player p,
int  stat 

◆ stat_idx_to_name()

const char* stat_idx_to_name ( int  type)

References STAT_MAX, stat_name_list, and type.

◆ stat_name_to_idx()

int stat_name_to_idx ( const char *  name)

References i, my_stricmp(), and stat_name_list.

Referenced by effect_subtype(), and parse_realm_stat().

Variable Documentation

◆ bodies

struct player_body* bodies

◆ classes

struct player_class* classes

◆ player

struct player* player = NULL

Pointer to the player struct.

◆ player_abilities

struct player_ability* player_abilities

◆ player_exp

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().

◆ player_module

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:461
static void cleanup_player(void)
Free player struct.
Definition: player.c:482

◆ races

struct player_race* races

◆ realms

struct magic_realm* realms

◆ shapes

struct player_shape* shapes

◆ stat_name_list

const char* stat_name_list[]
Initial value:
= {
#define STAT(a)

Referenced by stat_idx_to_name(), and stat_name_to_idx().