blob: 62de9dcacca8843957b907af606d7979e5b1f81e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#ifndef _INVENTORY_H_
#define _INVENTORY_H_
#include "../game/game.h"
struct itemstack
{
struct item *item;
int count;
void *meta;
};
struct item
{
char *name;
bool stackable;
bool (*on_use)(struct itemstack *stack);
void (*on_destroy)(struct itemstack *stack);
void (*on_create)(struct itemstack *stack);
};
struct inventory
{
struct list *stacks;
};
void inventory_add(struct inventory *self, struct itemstack stack);
bool inventory_remove(struct inventory *self, struct item *item);
struct itemstack *inventory_find(struct inventory *self, struct item *item);
extern struct inventory player_inventory;
#endif
|