-
Notifications
You must be signed in to change notification settings - Fork 0
/
Item.cpp
51 lines (41 loc) · 839 Bytes
/
Item.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
#include "Item.h"
#include "REEnums.h"
#include "string"
Item::Item(std::string na, REEnums::ItemType ty, unsigned us) :
name(na),
description(),
type(ty),
uses(us)
{}
std::string Item::getName() const {
return name;
}
std::string getDescription() const {
return description;
}
REEnums::ItemType Item::getType() const {
return type;
}
unsigned Item::getUses() const {
return uses;
}
void Item::setName(const std::string newNa) {
name = newNa;
}
void Item::setDescription(const std::string newDe) {
description = newDe;
}
void Item::setUses(const unsigned newUs) {
uses = newUs;
}
void Item::addUses(const unsigned addUs) {
uses += addUs;
}
void Item::subUses(const unsigned subUs) {
if (subUs > uses) {
uses = 0;
}
else {
uses -= subUs;
}
}