LI2 Roguelite
inventory.h
Go to the documentation of this file.
1 #ifndef _INVENTORY_H_
2 #define _INVENTORY_H_
3 
4 #define INVENTORY_SIZE 10
5 
6 typedef struct item Item;
7 typedef struct state State;
8 
9 
26 typedef struct inventory {
28  int nr_items;
29 
31  int equiped_index; // TODO remove this
32 
35 
36  int gold;
37  // ...
39 
41 void addItem(Inventory *i, Item *item);
42 // void equipItem(Inventory *i, Item *item); // removed deprecated
43 void removeItem(Inventory *i, Item *item);
44 void sellEquippedItem(State *st, Inventory *i);
46 void freeInventory(void *p);
47 void useEquippedItem(State *st);
48 
49 #endif
void useEquippedItem(State *st)
Uses the equipped item.
Definition: inventory.c:194
void sellEquippedItem(State *st, Inventory *i)
Sells the equipped item.
Definition: inventory.c:100
void switchEquippedItem(Inventory *i)
Switches the equipped item on a inventory.
Definition: inventory.c:141
void addItem(Inventory *i, Item *item)
Adds an item to the inventory.
Definition: inventory.c:39
Inventory * initInventory()
Initializes a new inventory. Allocates memory for a new inventory and initializes its fields.
Definition: inventory.c:17
void removeItem(Inventory *i, Item *item)
Removes an item from the inventory.
Definition: inventory.c:68
void freeInventory(void *p)
Frees the memory allocated for an inventory.
Definition: inventory.c:173
struct inventory Inventory
Inventory structure represents the player inventory.
Inventory structure represents the player inventory.
Definition: inventory.h:26
Item * equipped_item
Definition: inventory.h:30
int equiped_index
Definition: inventory.h:31
int gold
Definition: inventory.h:36
int nr_items
Definition: inventory.h:28
Item ** items
Definition: inventory.h:27
Item * equipped_sword
Definition: inventory.h:33
Item * equipped_armor
Definition: inventory.h:34
Item structure represents an item in the game.
Definition: item.h:28
Sructure of the game state.
Definition: state.h:38