-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpropertySquare.cpp
More file actions
47 lines (47 loc) · 1.38 KB
/
propertySquare.cpp
File metadata and controls
47 lines (47 loc) · 1.38 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
#include <iostream>
#include <vector>
#include <string>
#include "player.h"
#include "propertySquare.h"
using namespace std;
//propertySquare constructor sets inherited variables and private variables
propertySquare::propertySquare(int position, string tileName, int cost) :boardTile(position, tileName) {
this->propertyCost = cost;
this->propertyOwner = NULL;
this->propertyAvailable = true;
}
//Getters and Setters
int propertySquare::getPropertyCost() {
return propertyCost;
}
player* propertySquare::getPropertyOwner() {
return propertyOwner;
}
bool propertySquare::getPropertyAvailable() {
return propertyAvailable;
}
void propertySquare::setPropertyCost(int cost) {
this->propertyCost = cost;
}
void propertySquare::setPropertyOwner(player* owner) {
this->propertyOwner = owner;
}
void propertySquare::setPropertyAvailable(bool available) {
this->propertyAvailable = available;
}
//Gets actions at current propertySquare
//THIS IS ALWAYS OVERRIDEN BY CHILD CLASSES
vector<string> propertySquare::getActions(player& player) {
vector<string> actionsVector;
if (this->getPropertyAvailable()) {
actionsVector.push_back("Buy Houses / Hotels");
actionsVector.push_back("Trade Property");
}
else {
if (this->getPropertyOwner() != &player) {
actionsVector.push_back("Pay Rent");
}
}
actionsVector.push_back("End Turn");
return actionsVector;
}