-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShop.h
More file actions
64 lines (52 loc) · 1.62 KB
/
Shop.h
File metadata and controls
64 lines (52 loc) · 1.62 KB
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
#ifndef TEXAS_TRAIL_SHOP_H
#define TEXAS_TRAIL_SHOP_H
#include "DialoguePrompt.h"
#include "inventory/Stack.h"
#include "inventory/Inventory.h"
#include "Party.h"
#include <string>
#include <list>
#include <vector>
using std::string;
class Shop {
public:
enum class EnumShopRet {
SUCCESS,
NOT_ENOUGH_SPACE,
NOT_ENOUGH_MONEY
};
public:
class Stock {
public:
Stock(Stack* stack, int count, double price) : _stack(stack), _count(count), _price(price) {}
~Stock() { delete _stack; }
Stack& getStack() { return *(_stack); }
int getCount() const { return _count; }
void setCount(int count) { _count = count; }
double getPrice() const { return _price; }
void setPrice(double price) { _price = price; }
private:
Stack* _stack;
int _count;
double _price;
};
public:
using StringList = std::vector<std::string>;
using StockList = std::vector<Stock*>;
public:
Shop();
Shop(string name);
Shop(string name, StockList stocks);
virtual ~Shop();
virtual string name() const;
virtual int stockSize() const;
virtual Stock& stockAtIndex(int index);
virtual void addStock(Stock* stock);
virtual void removeStock(int index);
EnumShopRet purchaseStock(int index, int amount, Party& party);
private:
string _name;
int _size = 0;
StockList _stocks;
};
#endif