item.c File Reference

#include "item.h"
#include "level.h"
#include "generalfunc.h"
#include "backpack.h"
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <libintl.h>
#include <locale.h>
Include dependency graph for item.c:

Functions

char get_key (struct item *inv, int n, struct item itm)
 Returns/generates struct item::key value for item.
int compare_items (struct item i1, struct item i2, int mode)
 Compares 2 items.
char * makesuggestion (struct item *inv, int n, int class)
 Retuns keys of items with current class.
int find_item (struct item *inv, int n, struct item itm)
 Finds an item.
int remove_item (struct item *inv, int *n, struct item itm)
 Removes an item from inventory.
void add_item (struct item *inv, int *n, struct item itm)
 Adds an item to inventory.
void generate_items (struct leveldata ld)
 Generates items on level.
void place_random (struct leveldata ld, struct item it)
 Puts an item onto random free cell on level.

Function Documentation

void add_item ( struct item inv,
int *  n,
struct item  itm 
)

Adds an item to inventory.

Arguments as for get_key

Here is the call graph for this function:

int compare_items ( struct item  i1,
struct item  i2,
int  mode 
)

Compares 2 items.

Use KEY_CMP mode to make this function be key-sensitive

int find_item ( struct item inv,
int  n,
struct item  itm 
)

Finds an item.

Arguments as for get_key

Returns:
Number of item in inventory

Here is the call graph for this function:

void generate_items ( struct leveldata  ld  ) 

Generates items on level.

Parameters:
ld - Level structure
char get_key ( struct item inv,
int  n,
struct item  itm 
)

Returns/generates struct item::key value for item.

Use this function every time you want to place new item in inventory

Parameters:
inv - player's inventory
n - number of items in inventory
itm - new item

Here is the call graph for this function:

char* makesuggestion ( struct item inv,
int  n,
int  class 
)

Retuns keys of items with current class.

Parameters:
inv - inventory
n - number of items in inventory
class - class of items
Returns:
string with keys
void place_random ( struct leveldata  ld,
struct item  it 
)

Puts an item onto random free cell on level.

Parameters:
ld - Level structure
it - Item to work with
int remove_item ( struct item inv,
int *  n,
struct item  itm 
)

Removes an item from inventory.

Arguments as for get_key

Returns:
Number of remove item (if successful) or -1 if not

Here is the call graph for this function:

Generated on Mon Nov 15 10:26:51 2010 for Tales of Paraverse by  doxygen 1.6.3