]> git.lizzy.rs Git - dungeon_game.git/blob - plugins/inventory/inventory.h
4b13f94fbf2d19953098eabdb86be5be69b66b8a
[dungeon_game.git] / plugins / inventory / inventory.h
1 #ifndef _INVENTORY_H_
2 #define _INVENTORY_H_
3 #include "../game/game.h"
4
5 struct itemstack
6 {
7         struct item *item;
8         int count;
9         void *meta;
10 };
11
12 struct item
13 {
14         char *name;
15         bool stackable;
16
17         bool (*on_use)(struct itemstack *stack);
18         void (*on_destroy)(struct itemstack *stack);
19 };
20
21 struct inventory
22 {
23         struct list *stacks;
24 };
25
26 void inventory_add(struct inventory *self, struct itemstack stack);
27 bool inventory_remove(struct inventory *self, struct item *item);
28
29 extern struct inventory player_inventory;
30 #endif