Skip to content

Commit 9b04caa

Browse files
committed
did some stuff with payout that we'll overwrite
1 parent c85e0e7 commit 9b04caa

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

include/GameBoard.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ class GameBoard {
7575

7676
void initializeGame();
7777

78+
GameDice getDice();
79+
7880
void save(std::ostream& out);
7981

8082
ResourceTile& getResourceTile(Coordinate location) const;

src/GameBoard.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ GameBoard::GameBoard(const std::vector<std::string>& playerNames, const std::map
131131
currentTurn = 0;
132132
}
133133

134+
GameDice GameBoard::getDice() {
135+
return dice;
136+
}
134137
/**
135138
* Construct a board by reading in an XML representation from a stream.
136139
* @param in The stream to read from.

src/GameController.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ void printPlayerInfo(const Player& player) {
143143
*/
144144
bool GameController::nextTurn(ScreenCoordinate) {
145145
model.endTurn();
146+
if (model.getDice().getFirst() + model.getDice().getSecond() == 7)
147+
pushState(ROBBER);
148+
146149
printPlayerInfo(model.getCurrentPlayer());
147150
return true;
148151
}

src/GamePiece.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,22 @@ void ResourceTile::Payout() const{
116116
if (getBoard().getRobber() == location) //no need to pay out
117117
return;
118118

119-
std::vector<CornerPiece*> neighbors = getBoard().GetNeighboringCorners(location);
120-
std::vector<CornerPiece*>::iterator it = neighbors.begin();
119+
//std::vector<CornerPiece*> neighbors = getBoard().GetNeighboringCorners(location);
120+
//std::vector<CornerPiece*>::iterator it = neighbors.begin();
121+
122+
std::vector<Settlement*> neighbors = getBoard().GetNeighboringSettlements(location);
123+
std::vector<Settlement*>::iterator it = neighbors.begin();
121124
while (it != neighbors.end())
122125
{
123126
(*it)->getOwner().addResource(resource, (*it)->getResourceModifier());
127+
std::cout << ((*it)->getOwner().getWood()) << "\n";
128+
std::cout << ((*it)->getOwner().getBrick()) << "\n";
129+
std::cout << ((*it)->getOwner().getOre()) << "\n";
130+
std::cout << ((*it)->getOwner().getWheat()) << "\n";
131+
std::cout << ((*it)->getOwner().getWool()) << "\n";
132+
124133
it++;
125134
}
135+
126136
}
127137

0 commit comments

Comments
 (0)