-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathitems.h
More file actions
38 lines (30 loc) · 998 Bytes
/
items.h
File metadata and controls
38 lines (30 loc) · 998 Bytes
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
33
34
35
36
37
38
// inclusion guards
#ifndef _ITEMS_H_
#define _ITEMS_H_
#define MAXINVENTORY 50
#include <string.h>
// structs for individual items and inventories
struct item {
char name[25];
int quantity;
int goldValue;
};
struct inventory {
struct item items[MAXINVENTORY];
int amt;
int gold;
};
struct item sword = {"sword", 1, 100};
struct item torch = {"torch", 1 , 2};
struct item key = {"key", 1, 5};
struct item grappler = {"grapple", 1, 10};
//initialize player inv
struct inventory playerInventory = {0,0,0};
struct inventory shop1 = {{{"key",1,5}},1,0};
int itemIndex(struct inventory* i, char itemName[]);
int quantityItem(struct inventory* i, char itemName[]);
void addItem(struct inventory* i, char itemName[], int quantity);
void removeItem(struct inventory* i, char itemName[], int quantity);
int buyItem(struct inventory* shopInventory, struct inventory* playerInventory, struct item item);
void shopMenu(struct inventory* shopInventory, struct inventory* playerInventory);
#endif