Skip to content

Commit b6056ae

Browse files
committed
robber now renders on the desert tile at the start of the game
1 parent fa2f10c commit b6056ae

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/GameBoard.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,15 @@ GameBoard::GameBoard(const vector<std::string>& playerNames) {
6565
}
6666
valid = isValidBoard();
6767
}
68-
moveRobber(Coordinate(0,4));
68+
//moveRobber(Coordinate(0,4));
69+
auto it = getResources().begin();
70+
while(it != getResources().end()) {
71+
if ((it->second)->getType() == DESERT)
72+
moveRobber(it->first);
73+
it++;
74+
}
75+
std::cout << getRobber().first << "\n";
76+
std::cout << getRobber().second << "\n";
6977

7078
}
7179

src/GameView.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,6 @@ void drawTexturedRectangle(std::pair<float, float> texTopLeft, float sideLength,
562562
void DrawingGameVisitor::visit(GameDice& dice) {
563563

564564
static const GLuint diceTextures = loadImageAsTexture("resources/catan_dice_new.bmp");
565-
static const GLuint gameTextures = loadImageAsTexture("resources/catan_sprite_sheet_thatnewnew.bmp");
566565
glBindTexture(GL_TEXTURE_2D, diceTextures);
567566

568567
glColor3d(1.0, 1.0, 1.0);
@@ -647,7 +646,8 @@ void DrawingGameVisitor::visit(ResourceTile& tile) {
647646
vertexPair(Coordinate(coord.first + adjacentCoordDiffs[0].first, coord.second + adjacentCoordDiffs[0].second));
648647
glEnd();
649648

650-
if(tile.getDiceValue() != 0) {
649+
if(tile.getDiceValue() != 0 ||
650+
tile.getBoard().getResourceTile(tile.getBoard().getRobber()).getType() == DESERT) {
651651
if (tile.getBoard().getRobber() == coord) { //draw the robber on this tile
652652
//static const GLuint robberTextures = loadImageAsTexture("resource/catan_sprite_sheet_thatnewnew.bmp");
653653

0 commit comments

Comments
 (0)