player.c File Reference

#include <libintl.h>
#include <locale.h>
#include "player.h"
#include "level.h"
#include "monster.h"
#include "functions.h"
#include "quest.h"
#include "genmacro.h"
#include <stdlib.h>
#include <math.h>
Include dependency graph for player.c:

Functions

void createplayer (struct cell *level, int size, int race, int profession)
 Creates player and puts it into world.
int getplayer (struct cell *level, int size)
 Finds a player in the world.
struct playergetplayer_pointer (struct cell *level, int size)
 Wrapper around getplayer ().
int moveplayer (struct cell *level, int columns, int rows, int dir)
 Moves player on one square in specified direction.
int opendoor (struct leveldata ld, int columns, int rows, int dir)
 Opens a door.
int closedoor (struct cell *level, int columns, int rows, int dir)
 Closes a door.
struct itemget_item_by_key (struct player pl, char key)
 Gets item by its key (you can see it in inventory window).
void addexp (struct player *pl, int dif)
 Adds expirience points to player.
int checklevel (struct player *pl)
 Checks if player is able to get new level.
struct exit_code dodmg_topl (struct player *pl, int dmg)
 Does damage to player.
void add_item_toinv (struct player *pl, struct item itm)
 Adds item to inventory.
void remove_item_frominv (struct player *pl, struct item itm)
 Removes item from inventory.

Function Documentation

void add_item_toinv ( struct player pl,
struct item  itm 
)

Adds item to inventory.

Parameters:
pl - Player
itm - item

Here is the call graph for this function:

void addexp ( struct player pl,
int  dif 
)

Adds expirience points to player.

Parameters:
dif - difficulty of killed monster

Warning: use this function instead of accessing player::xp directly

int checklevel ( struct player pl  ) 

Checks if player is able to get new level.

int closedoor ( struct cell level,
int  columns,
int  rows,
int  dir 
)

Closes a door.

See opendoor ()

Here is the call graph for this function:

void createplayer ( struct cell level,
int  size,
int  race,
int  profession 
)

Creates player and puts it into world.

Parameters:
level - Level
size - Size of level
race - Race of new player

- profession of new player

Here is the call graph for this function:

struct exit_code dodmg_topl ( struct player pl,
int  dmg 
) [read]

Does damage to player.

Hits player when monster has turn

Parameters:
pl - Player
dmg - Damage without respect to player's AC
struct item* get_item_by_key ( struct player  pl,
char  key 
) [read]

Gets item by its key (you can see it in inventory window).

Parameters:
player - Owner of inventory
key - symbolic key
Returns:
pointer to item in inventory on success or NULL
int getplayer ( struct cell level,
int  size 
)

Finds a player in the world.

Parameters:
level - Level where player can be found
size - Size of level
Returns:
Number of cell where player is stored
struct player* getplayer_pointer ( struct cell level,
int  size 
) [read]

Wrapper around getplayer ().

Returns:
Pointer to player

Here is the call graph for this function:

int moveplayer ( struct cell level,
int  columns,
int  rows,
int  dir 
)

Moves player on one square in specified direction.

Parameters:
level - See above
columns - Columns in the field of the game
rows - Rows in the field of the game
dir - Direction (e.g. K, L, U or something else)
Returns:
1 on success

Here is the call graph for this function:

int opendoor ( struct leveldata  ld,
int  columns,
int  rows,
int  dir 
)

Opens a door.

Arguments like in function above

Returns:
OK on success, TRY_AGAIN if fails

Here is the call graph for this function:

void remove_item_frominv ( struct player pl,
struct item  itm 
)

Removes item from inventory.

See above

Here is the call graph for this function:

Generated on Mon Nov 15 10:27:05 2010 for Tales of Paraverse by  doxygen 1.6.3