]> git.lizzy.rs Git - dungeon_game.git/blobdiff - plugins/inventory/inventory.h
Add inventory and cherries (collectable food)
[dungeon_game.git] / plugins / inventory / inventory.h
diff --git a/plugins/inventory/inventory.h b/plugins/inventory/inventory.h
new file mode 100644 (file)
index 0000000..4b13f94
--- /dev/null
@@ -0,0 +1,30 @@
+#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);
+};
+
+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