-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcornerSquare.cpp
More file actions
56 lines (54 loc) · 1.63 KB
/
cornerSquare.cpp
File metadata and controls
56 lines (54 loc) · 1.63 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
#include <iostream>
#include <vector>
#include <string>
#include "player.h"
#include "cornerSquare.h"
using namespace std;
//cornerSquare constructor with parameters
cornerSquare::cornerSquare(int tilePosition, string tileName) : inherited(tilePosition, tileName)
{
}
//Gets actions at current square
vector<string> cornerSquare::getActions(player& player)
{
vector<string> actionsVector;
if (player.getPlayerProperty().size() > 0) {
actionsVector.push_back("Buy Houses / Hotels");
actionsVector.push_back("Trade Property");
}
actionsVector.push_back("End Turn");
return actionsVector;
}
//Required actions at current square
void cornerSquare::required(player& player)
{
}
//Gets player selection from actions vector
int cornerSquare::getPlayerSelection(vector<string> actions) {
int playerSelection = 0;
for (string action : actions) {
cout << "\t" << playerSelection << ": " << action << endl;
playerSelection++;
}
cout << "Please select an action: ";
cin >> playerSelection;
if (playerSelection > actions.size() - 1) {
cout << "Invalid Selection\n";
return getPlayerSelection(actions);
}
return playerSelection;
}
//Responds to player selection
void cornerSquare::replyToPlayerSelection(vector<string>& actions, int selection, player& player) {
if (actions[selection] == "Buy Houses / Hotels") {
cout << "Sorry this feature has not been added yet" << endl;
actions.erase(actions.begin() + selection);
}
else if (actions[selection] == "End Turn") {
cout << "Ending Turn" << endl;
actions.erase(actions.begin() + selection);
}
else {
cout << "Invalid Selection" << endl;
}
}