-
Notifications
You must be signed in to change notification settings - Fork 0
/
Buildable.hpp
68 lines (58 loc) · 1.76 KB
/
Buildable.hpp
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
/*
* Email: sam.lazareanu@gmail.com
* ID: ****6281
* @SamuraiPolix - Samuel Lazareanu
*/
#pragma once
#include <iostream>
#include "Types.hpp"
using std::ostream;
namespace ariel {
class Player;
class Tile;
class Buildable
{
protected: // to allow access for inheriting classes
BuildableTypes type;
Player* owner;
Tile* tile;
size_t index;
size_t pos;
public:
Buildable();
~Buildable() = default;
Buildable(size_t index);
Buildable(BuildableTypes type, Player& owner, size_t index);
virtual void setSettlement(Player& owner) = 0;
virtual void setRoad(Player& owner) = 0;
void setPos(size_t pos);
size_t getPos() const;
Player* getOwner();
Tile& getTile() const;
BuildableTypes getType() const;
size_t getIndex() const;
// friend ostream& operator<<(ostream& os, const Buildable& buildable);
};
class BuildableVertex : public Buildable
{
public:
BuildableVertex();
~BuildableVertex() = default;
BuildableVertex(size_t index);
BuildableVertex(BuildableTypes type, Player& owner, size_t index);
void setSettlement(Player& owner);
void setRoad(Player& owner);
friend ostream& operator<<(ostream& os, const BuildableVertex& buildable);
};
class BuildableEdge : public Buildable
{
public:
BuildableEdge();
~BuildableEdge() = default;
BuildableEdge(size_t index);
BuildableEdge(BuildableTypes type, Player& owner, size_t index);
void setSettlement(Player& owner);
void setRoad(Player& owner);
friend ostream& operator<<(ostream& os, const BuildableEdge& buildable);
};
}