Skip to content

Commit fabdcb8

Browse files
committed
Merge branch 'master' into serialization
2 parents 6f0c668 + a76c85b commit fabdcb8

File tree

12 files changed

+75
-83
lines changed

12 files changed

+75
-83
lines changed

include/City.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#ifndef CITY_H
22
#define CITY_H
33

4-
class City public CornerPiece {
4+
#include "CornerPiece.h"
5+
6+
class City : public CornerPiece {
57
private:
68

79
public:
8-
City();
10+
City(GameBoard& board, Coordinate location, Player& owner);
911
City(City&) = delete;
1012
~City();
1113
City& operator=(City&) = delete;

include/CornerPiece.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
#ifndef CORNERPIECE_H
22
#define CORNERPIECE_H
33

4-
class CornerPiece {
5-
private:
4+
#include "GamePiece.h"
5+
#include "Player.h"
66

7+
class CornerPiece : public GamePiece {
8+
private:
9+
Player& owner;
710
public:
8-
CornerPiece();
11+
CornerPiece(GameBoard& board, Coordinate location, Player& owner);
912
CornerPiece(CornerPiece&) = delete;
1013
~CornerPiece();
1114
CornerPiece& operator=(CornerPiece&) = delete;
15+
16+
Player& getOwner();
17+
const Player& getOwner() const;
1218
};
1319

1420
#endif

include/GameBoard.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313
#include "Util.h"
1414
#include "GamePiece.h"
15+
#include "Settlement.h"
1516
#include "tinyxml2.h"
17+
#include "Road.h"
1618

1719
class GameBoard {
1820
private:

include/GamePiece.h

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -40,30 +40,5 @@ class ResourceTile : public GamePiece {
4040
virtual ~ResourceTile();
4141
};
4242

43-
class Settlement : public GamePiece {
44-
private:
45-
Player& owner;
46-
public:
47-
Settlement(GameBoard& board, Coordinate location, Player& owner);
48-
Settlement(Settlement&) = delete;
49-
virtual ~Settlement();
50-
//virtual Settlement& operator=(Settlement&) = delete;
51-
52-
bool city;
53-
};
54-
55-
class Road {
56-
private:
57-
GameBoard& board;
58-
Player& owner;
59-
Coordinate start;
60-
Coordinate end;
61-
public:
62-
Road(GameBoard& board, Player& owner, Coordinate start, Coordinate end);
63-
Road(Road&);
64-
~Road();
65-
//Road& operator=(Road&) = delete;
66-
};
67-
6843
#endif
6944

include/Road.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#ifndef ROAD_H
22
#define ROAD_H
33

4-
class Road public CornerPiece {
5-
private:
4+
#include "Util.h"
65

6+
class Road {
7+
private:
8+
Coordinate start;
9+
Coordinate end;
710
public:
8-
Road();
11+
Road(Coordinate start, Coordinate end);
912
Road(Road&) = delete;
1013
~Road();
1114
Road& operator=(Road&) = delete;

include/Settlement.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#ifndef SETTLEMENT_H
22
#define SETTLEMENT_H
33

4-
class Settlement: public CornerPiece {
4+
#include "CornerPiece.h"
5+
6+
class Settlement : public CornerPiece {
57
private:
68

79
public:
8-
Settlement();
10+
Settlement(GameBoard& board, Coordinate location, Player& owner);
911
Settlement(Settlement&) = delete;
1012
~Settlement();
1113
Settlement& operator=(Settlement&) = delete;

src/City.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "City.h"
2+
3+
City::City(GameBoard& board, Coordinate location, Player& owner) : CornerPiece(board, location, owner) {
4+
5+
}
6+
7+
City::~City() {
8+
9+
}

src/CornerPiece.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "CornerPiece.h"
2+
3+
CornerPiece::CornerPiece(GameBoard& board, Coordinate location, Player& owner) : GamePiece(board, location), owner(owner) {
4+
5+
}
6+
7+
CornerPiece::~CornerPiece() {
8+
9+
}
10+
11+
Player& CornerPiece::getOwner() {
12+
return owner;
13+
}
14+
15+
const Player& CornerPiece::getOwner() const {
16+
return owner;
17+
}

src/GameBoard.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -128,33 +128,6 @@ void GameBoard::init_resources()
128128
}
129129
}
130130
#endif
131-
132-
/*
133-
#ifdef DUMMY_BOARD
134-
ADD_RESOURCE( 0, 1, BRICK, 2);
135-
ADD_RESOURCE(-2, 2, SHEEP, 5);
136-
ADD_RESOURCE(2, 0, WOOD, 6);
137-
ADD_RESOURCE(-3, 4, DESERT, 0);
138-
ADD_RESOURCE(-1, 3, SHEEP, 10);
139-
ADD_RESOURCE( 1, 2, WHEAT, 9);
140-
ADD_RESOURCE( 3, 1, WHEAT, 3);
141-
ADD_RESOURCE(-4, 6, WOOD, 8);
142-
ADD_RESOURCE(-2, 5, SHEEP, 3);
143-
ADD_RESOURCE( 0, 4, STONE, 11);
144-
ADD_RESOURCE( 2, 3, STONE, 4);
145-
ADD_RESOURCE( 4, 2, SHEEP, 8);
146-
ADD_RESOURCE(-3, 7, BRICK, 4);
147-
ADD_RESOURCE(-1, 6, WHEAT, 6);
148-
ADD_RESOURCE( 1, 5, WOOD, 5);
149-
ADD_RESOURCE( 3, 4, BRICK, 10);
150-
ADD_RESOURCE(-2, 8, WOOD, 11);
151-
ADD_RESOURCE( 0, 7, STONE, 12);
152-
ADD_RESOURCE( 2, 6, WHEAT, 9);
153-
#endif
154-
*/
155-
156-
157-
158131
}
159132

160133
void GameBoard::PlaceSettlement(Coordinate location, Player& Owner){

src/GamePiece.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,3 @@ void ResourceTile::Payout() {
4141
}
4242
}
4343
*/
44-
45-
Settlement::Settlement(GameBoard& board, Coordinate location, Player& owner) :
46-
GamePiece(board, location), owner(owner), city(0) {
47-
48-
}
49-
50-
Settlement::~Settlement() {
51-
52-
}
53-
54-
Road::Road(GameBoard& board, Player& owner, Coordinate start, Coordinate end) : board(board), owner(owner), start(start), end(end) {
55-
56-
}
57-
58-
Road::Road(Road& other) : board(other.board), owner(other.owner), start(other.start), end(other.end) {
59-
60-
}
61-
62-
Road::~Road() {
63-
64-
}

0 commit comments

Comments
 (0)