-
Notifications
You must be signed in to change notification settings - Fork 0
/
market.cpp
60 lines (48 loc) · 1.58 KB
/
market.cpp
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
#include <iostream>
#include <vector>
#include <cstdlib>
#include "structs.h"
#include "items.h"
#include "spells.h"
#include "inventory.h"
#include "market.h"
using namespace std;
Market::Market() {
inventory = new Inventory;
}
void Market::createMarket(vector<Item*> item, vector<Spell *> spells) { // creates market from two vectors
for (int i = 0; i < item.size(); i++) {
inventory->add_to_inventory(item[i]);
}
for(int i = 0; i < spells.size(); i++){
inventory->add_to_inventory(spells[i]);
}
}
void Market::createMarket(){ //creates inventory using the creation tool from the inventory
inventory->createInventory();
}
void Market::printMarket() {
inventory->checkItems();
inventory->checkSpells();
}
int Market::getItemNumber()const{
return inventory->getItemNumber();
}
int Market::getSpellNumber()const{
return inventory->getSpellNumber();
}
Item* Market::buy_from_market(int k) { // returns a pointer to the k-th item
return inventory->select(k);
}
Item* Market::remove(int k){ //removes item from vector and returns a pointer to it
return inventory->remove(k);
}
Spell* Market::buy_spell_from_market(int k){ //returns a pointer to the k-th spell
return inventory->equipSpell(k);
}
Spell *Market::remove_spell(int k){ //removes spell from vector and returns a pointer to it
return inventory->remove_spell(k);
}
Market::~Market(){
delete inventory;
}