Angband
Macros | Functions | Variables
player.c File Reference

Player implementation. More...

#include "init.h"
#include "obj-pile.h"
#include "obj-util.h"
#include "player.h"
#include "player-birth.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-magic-realms.h"
#include "list-stats.h"

Macros

#define REALM(a, b, c, d, e, f)   { REALM_##a, b, c, d, e, f },
#define STAT(a, b, c, d, e, f, g, h)   #a,

Functions

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)
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.
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.
static void init_player (void)
 Initialise player struct.
static void cleanup_player (void)
 Free player struct.

Variables

static player_other player_other_body
 The player other record (static)
player_otherop_ptr = &player_other_body
 Pointer to the player other record.
player_typeplayer
 Pointer to the player struct.
struct player_bodybodies
struct player_raceraces
struct player_classclasses
struct magic_realm realms [REALM_MAX]
 Magic realms: index, spell stat, verb, spell noun, book noun, realm name.
const s32b player_exp [PY_MAX_LEVEL]
 Base experience levels, may be adjusted up for race and/or class.
static const char * stat_name_list []
struct init_module player_module

Detailed Description

Player implementation.

Copyright (c) 2011 elly+.nosp@m.angb.nosp@m.and@l.nosp@m.epto.nosp@m.quark.nosp@m..net. 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 REALM (   a,
  b,
  c,
  d,
  e,
 
)    { REALM_##a, b, c, d, e, f },
#define STAT (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)    #a,

Function Documentation

static void adjust_level ( struct player p,
bool  verbose 
)
static
static void cleanup_player ( void  )
static
static void init_player ( void  )
static
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 
)
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

Pointer to the player struct.

const s32b player_exp[PY_MAX_LEVEL]

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


Externs

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
}
player_other player_other_body
static

The player other record (static)

struct player_race* races
struct magic_realm realms[REALM_MAX]
Initial value:
{
#define REALM(a, b, c, d, e, f)
}

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

Referenced by parse_class_magic().

const char* stat_name_list[]
static
Initial value:
{
#define STAT(a, b, c, d, e, f, g, h)
"MAX",
NULL
}

Referenced by stat_idx_to_name(), and stat_name_to_idx().