-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayer.cpp
More file actions
73 lines (70 loc) · 1.77 KB
/
player.cpp
File metadata and controls
73 lines (70 loc) · 1.77 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
65
66
67
68
69
70
71
72
73
#include <iostream>
#include <vector>
#include "player.h"
using namespace std;
//player class constructor
player::player(string name, int money, string token) {
this->playerName = name;
this->playerMoney = money;
this->playerToken = token;
this->playerDebt = 0;
this->playerProperty = vector<int>();
this->playerMortgage = vector<int>();
this->playerActions = vector<string>();
}
//Setters and getters
void player::setPlayerName(string name) {
this->playerName = name;
}
void player::setPlayerMoney(int money) {
this->playerMoney = money;
}
void player::setPlayerToken(string icon) {
this->playerToken = icon;
}
void player::setPlayerDebt(int debt) {
this->playerDebt = debt;
}
void player::addPlayerProperty(int property) {
this->playerProperty.push_back(property);
}
void player::removePlayerProperty(int property) {
for (int i = 0; i < this->playerProperty.size(); i++) {
if (this->playerProperty[i] == property) {
this->playerProperty.erase(this->playerProperty.begin() + i);
}
}
}
string player::getPlayerName() {
return this->playerName;
}
int player::getPlayerMoney() {
return this->playerMoney;
}
string player::getPlayerToken() {
return this->playerToken;
}
int player::getPlayerDebt() {
return this->playerDebt;
}
vector<int> player::getPlayerProperty() {
return this->playerProperty;
}
vector<int> player::getPlayerMortgage() {
return this->playerMortgage;
}
void player::setPlayerPosition(int position) {
this->boardPosition = position;
}
void player::setPlayerProperty(vector<int> property) {
this->playerProperty = property;
}
int player::getPlayerPostion() {
return this->boardPosition;
}
bool player::getBankrupt() {
if (this->getPlayerMoney() <= 0) {
return true;
}
return false;
}