aboutsummaryrefslogtreecommitdiff
path: root/plugins/inventory/inventory.h
blob: 437ffb646d427c1cc071a3d8b212efbc043a116f (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
#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);

extern struct inventory player_inventory;
#endif