forked from Whales/Cataclysm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinventory.h
75 lines (61 loc) · 1.97 KB
/
inventory.h
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef _INVENTORY_H_
#define _INVENTORY_H_
#include "item.h"
#include <string>
#include <vector>
class game;
class map;
class inventory
{
public:
item& operator[] (int i);
std::vector<item>& stack_at(int i);
std::vector<item> const_stack(int i) const;
std::vector<item> as_vector();
item& front();
item& back();
int size() const;
inventory& operator= (inventory &rhs);
inventory& operator= (const inventory &rhs);
inventory& operator+= (const inventory &rhs);
inventory& operator+= (const item &rhs);
inventory& operator+= (const std::vector<item> &rhs);
inventory operator+ (const inventory &rhs);
inventory operator+ (const item &rhs);
inventory operator+ (const std::vector<item> &rhs);
void clear();
void add_stack(std::vector<item> newits);
void push_back(std::vector<item> newits);
void add_item (item newit);
void push_back(item newit);
/* Check all items for proper stacking, rearranging as needed
* game pointer is not necessary, but if supplied, will ensure no overlap with
* the player's worn items / weapon
*/
void restack(game *g = NULL);
void form_from_map(game *g, point origin, int distance);
std::vector<item> remove_stack(int index);
item remove_item(int index);
item remove_item(int stack, int index);
item remove_item_by_letter(char ch);
item& item_by_letter(char ch);
int index_by_letter(char ch);
// Below, "amount" refers to quantity
// "charges" refers to charges
int amount_of (itype_id it);
int charges_of(itype_id it);
void use_amount (itype_id it, int quantity, bool use_container = false);
void use_charges(itype_id it, int quantity);
bool has_amount (itype_id it, int quantity);
bool has_charges(itype_id it, int quantity);
bool has_item(item *it); // Looks for a specific item
/* TODO: This stuff, I guess?
std::string save();
void load(std::string data);
*/
item nullitem;
std::vector<item> nullstack;
private:
std::vector< std::vector<item> > items;
};
#endif