diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2015-10-02 08:47:11 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2015-10-02 08:47:11 -0400 |
commit | a277430f0ddde9ea2583f4b0c44fcafe8a2528bf (patch) | |
tree | 32a4bf8f1b6a32e237a9c486555f8215a2213ca9 /include/inventory.h | |
parent | aa73352387af9efc77495ebdac6d19fb276dd75a (diff) |
added inventories
Diffstat (limited to 'include/inventory.h')
-rw-r--r-- | include/inventory.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/inventory.h b/include/inventory.h new file mode 100644 index 0000000..8f42cc5 --- /dev/null +++ b/include/inventory.h @@ -0,0 +1,29 @@ +#ifndef INVENTORY_H +#define INVENTORY_H + +#include <cstdlib> + +enum ITEM_ID { // Contains item IDs for every item in the game, this is how items are stored. IDs are also used to lookup item strings + TEST_ITEM = 1 // A test item (duh) +}; + +struct item_t { // Used to define entries in an entity's inventory + short count; // Quantity of the item in this slot + ITEM_ID id; // ID of the item +} __attribute__ ((packed)); + +class Inventory { +private: + unsigned int size; // Size of 'item' array + struct item_t *item; // An array of the items contained in this inventory. +public: + Inventory(unsigned int s); // Creates an inventory of size 's' + ~Inventory(void); // Free's 'item' + + int addItem(ITEM_ID id,unsigned char count); // Add 'count' items with an id of 'id' to the inventory + int takeItem(ITEM_ID id,unsigned char count); // Take 'count' items with an id of 'id' from the inventory + + void draw(void); // Draws a text list of items in this inventory (should only be called for the player for now) +}; + +#endif // INVENTORY_H |