-
Notifications
You must be signed in to change notification settings - Fork 0
/
Spot.cpp
64 lines (51 loc) · 893 Bytes
/
Spot.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
61
62
#include "Player.hpp"
#include "Spot.hpp"
//constructors/destructors
Spot::Spot()
{
}
Spot::Spot(int locationIn, bool isTakenIn, Player* takenByIn)
{
location = locationIn;
isTaken = isTakenIn;
takenBy = takenByIn;
}
//initializers
//getters/setters
bool Spot::getIsTaken() const
{
return isTaken;
}
int Spot::getLocation() const
{
return location;
}
Player* Spot::getTakenBy() const
{
return takenBy;
}
void Spot::setIsTaken()
{
isTaken = true;
}
void Spot::setTakenBy(Player* playerIn)
{
takenBy = playerIn;
}
//misc functions
bool Spot::operator== (const Spot& spotB) const
{
return (this->getIsTaken() && spotB.getIsTaken() &&
this->getTakenBy() == spotB.getTakenBy());
}
void Spot::sendSpot()
{
if (isTaken)
{
io.send(takenBy->getSymbol());
}
else
{
io.send(untakenPlaceholder);
}
}