Skip to content

Commit be4e02e

Browse files
committed
Stuff compiles yay
1 parent d232290 commit be4e02e

File tree

14 files changed

+62
-200
lines changed

14 files changed

+62
-200
lines changed

include/CornerPiece.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@ class CornerPiece : public GamePiece {
1616
CornerPiece(CornerPiece&) = delete;
1717
~CornerPiece();
1818
CornerPiece& operator=(CornerPiece&) = delete;
19-
19+
2020
Player& getOwner();
2121
const Player& getOwner() const;
2222

23+
virtual void accept(GameVisitor& visitor)=0;
24+
2325
virtual int getResourceModifier();
2426

2527
virtual int getVictoryPoints();
28+
29+
virtual bool operator==(const GamePiece&) const;
2630
};
2731

2832
#endif

include/GameBoard.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121
class GameVisitor;
2222

23-
class GameVisitor;
24-
2523
/**
2624
* A game of Settlers of Catan, including resource tiles, settlements, cities, roads, and players.
2725
*/

include/GameController.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,13 @@ class GameController {
5050
void pushState(ControlState);
5151
ControlState getState();
5252
ControlState popState();
53-
bool handleTradeOffer(ScreenCoordinate, Player& initiating, std::array<int, 5>, Player& receiving, std::array<int, 5>);
5453
void storeClick(Coordinate clickCoordinate);
5554
Coordinate getLastClick();
5655
Coordinate getPastClick(int howLongAgo);
5756
void clearClickHistory();
5857
bool hasClickHistory();
5958
int getClickHistorySize();
6059

61-
62-
63-
64-
6560
bool handlePlayerClick(ScreenCoordinate, Player&);
6661
bool handleTradeOffer(ScreenCoordinate, Player& initiating, std::array<int, 5>, Player& receiving, std::array<int, 5>);
6762
};

include/GameDice.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
#define GAMEDICE_H
33

44

5-
6-
7-
85
class GameVisitor;
96

107
class GameDice {
@@ -25,4 +22,4 @@ class GameDice {
2522

2623
};
2724

28-
#endif
25+
#endif

include/GameView.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class GameView {
6464

6565
void addPointOfInterest(ScreenCoordinate);
6666
void clearPointsOfInterest();
67+
void addElement(std::unique_ptr<ViewElement> element);
6768
void addElement(int priority, std::unique_ptr<ViewElement>);
6869

6970
std::unique_ptr<ViewElement> removeElement(int priority);

include/GameVisitor.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ class Road;
88
class City;
99
class Player;
1010
class DevelopmentCard;
11+
class GameDice;
12+
class Wonder;
1113

1214
/**
1315
* A class to be extended with callbacks to handle the different classes in the model.
@@ -28,6 +30,8 @@ class GameVisitor {
2830
virtual void visit(Player&) = 0;
2931
virtual void visit(ResourceTile&) = 0;
3032
virtual void visit(DevelopmentCard&) = 0;
33+
virtual void visit(GameDice&) = 0;
34+
virtual void visit(Wonder&) = 0;
3135
};
3236

33-
#endif
37+
#endif

include/Player.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,9 @@ class Player {
109109
int getWoolModifier();
110110
void setWoolModifier();
111111

112-
void setGenralModifier(); //3:1 port
113-
114-
bool offerBankTrade(int offer[], int demand[]);
112+
void setGeneralModifier();
115113

116-
void setGeneralModifier(); //3:1 port
114+
void setGenralModifier(); //3:1 port
117115

118116
bool offerBankTrade(std::array<int, 5> offer, std::array<int, 5> demand);
119117

include/Serialization.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ class XMLVisitor : public GameVisitor {
3131
virtual void visit(Player&);
3232
virtual void visit(ResourceTile&);
3333
virtual void visit(DevelopmentCard&);
34+
virtual void visit(GameDice&);
35+
virtual void visit(Wonder&);
3436

3537
const tinyxml2::XMLDocument& getXMLDoc() const;
3638
};
3739

3840
Coordinate xmlElementToCoord(const tinyxml2::XMLElement& element);
3941

40-
#endif
42+
#endif

src/GameController.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ bool GameController::handleBoardEvent(ScreenCoordinate screenCoord) {
136136
storeClick(coord);
137137
if(getClickHistorySize() >= 4){
138138
using namespace std::placeholders;
139-
view.addElement(makeConfirmationDialogue(
139+
view.addElement(28, makeConfirmationDialogue(
140140
std::bind(&GameController::handleConfirmRoadCard, this, _1),
141141
std::bind(&GameController::handleCancelDialogueEvent, this, _1), {{.2, .3}, {.8, .6}}));
142142
pushState(MODALSTATE);
@@ -216,12 +216,12 @@ bool GameController::handleRoadCardButtonEvent(ScreenCoordinate coord){
216216

217217
bool GameController::handleConfirmRoadCard(ScreenCoordinate coord){
218218
model.getCurrentPlayer().playRoadBuilding(getPastClick(3), getPastClick(2), getPastClick(1), getPastClick(0));
219-
view.removeLastElement();
219+
view.removeElement(28);
220220
return handleCancelButtonEvent(coord);
221221
}
222222

223223
bool GameController::handleCancelDialogueEvent(ScreenCoordinate coord){
224-
view.removeLastElement();
224+
view.removeElement(28);
225225
return handleCancelButtonEvent(coord);
226226
}
227227

src/GameView.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -302,26 +302,6 @@ void ViewButtonText::render() {
302302
glBindTexture(GL_TEXTURE_2D, 0);
303303
}
304304

305-
/**
306-
* Removes the element pointed to so that it will no longer be rendered
307-
* @param a pointer to the element we want to remove
308-
*/
309-
bool GameView::removeElement(ViewElement* element_sought){
310-
for (std::vector<std::unique_ptr<ViewElement>>::iterator element = viewElements.begin() ; element != viewElements.end(); ++element)
311-
{
312-
if (element->get() == element_sought){
313-
viewElements.erase(element);
314-
return true;
315-
}
316-
}
317-
return false;
318-
}
319-
320-
bool GameView::removeLastElement(){
321-
viewElements.pop_back();
322-
return true;
323-
}
324-
325305
void GameView::addPointOfInterest(ScreenCoordinate coord){
326306
pointsOfInterest.push_back(coord);
327307
}

0 commit comments

Comments
 (0)