File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,8 @@ bool GameController::nextTurn(ScreenCoordinate) {
160160bool GameController::handleBoardEvent (ScreenCoordinate screenCoord) {
161161 printPlayerInfo (model.getCurrentPlayer ());
162162 auto coord = screenToCoord (screenCoord);
163+ std::vector<Settlement*> neighbors;
164+ int resourceToSteal;
163165
164166 switch (getState ()){
165167 case BUILDROAD:
@@ -179,6 +181,12 @@ bool GameController::handleBoardEvent(ScreenCoordinate screenCoord) {
179181 storeClick (coord);
180182
181183 model.moveRobber (coord);
184+ neighbors = model.GetNeighboringSettlements (coord);
185+ if (!neighbors.empty ()) {
186+ resourceToSteal = neighbors[0 ]->getOwner ().getRandomResource ();
187+ neighbors[0 ]->getOwner ().addResource (resourceToSteal, -1 );
188+ model.getCurrentPlayer ().addResource (resourceToSteal, 1 );
189+ }
182190
183191 popState ();
184192 break ;
Original file line number Diff line number Diff line change @@ -124,11 +124,11 @@ void ResourceTile::Payout() const{
124124 while (it != neighbors.end ())
125125 {
126126 (*it)->getOwner ().addResource (resource, (*it)->getResourceModifier ());
127- std::cout << ((*it)->getOwner ().getWood ()) << " \n " ;
127+ /* std::cout << ((*it)->getOwner().getWood()) << "\n";
128128 std::cout << ((*it)->getOwner().getBrick()) << "\n";
129129 std::cout << ((*it)->getOwner().getOre()) << "\n";
130130 std::cout << ((*it)->getOwner().getWheat()) << "\n";
131- std::cout << ((*it)->getOwner ().getWool ()) << " \n " ;
131+ std::cout << ((*it)->getOwner().getWool()) << "\n";*/
132132
133133 it++;
134134 }
You can’t perform that action at this time.
0 commit comments