@@ -28,7 +28,7 @@ GameController::GameController(GameBoard& model, GameView& view) : model(model),
2828 view.addElement (makeViewButtonText (std::bind (&GameController::handleSettlementButtonEvent, this , _1), {{0.20 , 0.0 }, {0.33 , 0.1 }}, font, fontSize, " Settlement" ));
2929 view.addElement (makeViewButtonText (std::bind (&GameController::nextTurn, this , _1), {{0 , 0.3 }, {0.1 , 0.4 }}, font, fontSize, " End Turn" ));
3030
31- auto playerTopY = 0.9 ;
31+ auto playerTopY = 0.82 ;
3232 for (auto i = 0 ; i < model.getNoOfPlayers (); i++) {
3333 auto width = 0.15 ;
3434 Player& player = model.getPlayer (i);
@@ -174,7 +174,6 @@ bool GameController::handleBoardEvent(ScreenCoordinate screenCoord) {
174174 printPlayerInfo (model.getCurrentPlayer ());
175175 auto coord = screenToCoord (screenCoord);
176176 std::vector<Settlement*> neighbors;
177- int resourceToSteal;
178177
179178 switch (getState ()){
180179 case BUILDROAD:
@@ -209,13 +208,10 @@ bool GameController::handleBoardEvent(ScreenCoordinate screenCoord) {
209208 }
210209 break ;
211210 case KNIGHT_DEVCARD:
212-
213- storeClick (coord);
214- view.setControlStateText (" Select a player around that tile to steal from (Select yourself if you don't want to rob anyone)" );
215- break ;
216- case VICTORYPOINT_DEVCARD:
217- model.getCurrentPlayer ().playVictoryCard ();
218- handleCancelButtonEvent (screenCoord);
211+ if (!hasClickHistory ()){
212+ storeClick (coord);
213+ view.setControlStateText (" Select a player around that tile to steal from (Select yourself if you don't want to rob anyone)" );
214+ }
219215 break ;
220216 case BUILDSETTLEMENT:
221217 std::cout << " attempting to buy a settlement" << std::endl;
@@ -405,15 +401,15 @@ bool GameController::handleMonopolyCardButtonEvent(ScreenCoordinate coord){
405401}
406402
407403/* *
408- * Handles a click on the VictoryPoint card button. Will push the victory point card state to the control stack
404+ * Handles a click on the VictoryPoint card button. Currently does nothing because victory point cards don't do anything
409405 * @param coord The place the user clicked
410406 * @return true
411407 */
412408bool GameController::handleVictoryPointCardButtonEvent (ScreenCoordinate coord){
413409 if (getState () != BASESTATE){
414- return true ;
410+ return false ;
415411 }
416- pushState (VICTORYPOINT_DEVCARD);
412+ // pushState(VICTORYPOINT_DEVCARD);
417413 return true ;
418414}
419415
@@ -455,13 +451,17 @@ bool GameController::handlePlayerClick(ScreenCoordinate coord, Player& player) {
455451 view.addElement (priority, std::unique_ptr<ViewElement>(new TradingView (initiating, receiving, tradeFunction, cancelFunction, initial)));
456452 std::cout << player.getName () << std::endl;
457453 return true ;
454+
455+ // KNIGHT
458456 }else if (getState () == KNIGHT_DEVCARD){
459457 if (hasClickHistory ()){
460- model.getCurrentPlayer ().playKnight (getPastClick ( 0 ), player);
458+ model.getCurrentPlayer ().playKnight (getLastClick ( ), player);
461459 return handleCancelButtonEvent (coord);
462460 }
461+
462+ // ROBBER
463463 }else if (getState () == ROBBER){
464- if (hasClickHistory () && (model.canRobberRob (player, getPastClick ( 0 )) || player == model.getCurrentPlayer ()) &&
464+ if (hasClickHistory () && (model.canRobberRob (player, getLastClick ( )) || player == model.getCurrentPlayer ()) &&
465465 model.moveRobber (getPastClick (0 ))){
466466
467467 int resourceToSteal = player.getRandomResource ();
@@ -511,6 +511,9 @@ bool GameController::handleTradeOffer(ScreenCoordinate coord, Player& initiating
511511 return true ;
512512}
513513
514+ /* *
515+ * Handles clicks on the resource button for Wood
516+ */
514517bool GameController::handleWoodButtonEvent (ScreenCoordinate coord){
515518 if (getState () == YEAROFPLENTY_DEVCARD){
516519 model.getCurrentPlayer ().playYearOfPlenty (WOOD);
@@ -521,6 +524,10 @@ bool GameController::handleWoodButtonEvent(ScreenCoordinate coord){
521524 }
522525 return false ;
523526}
527+
528+ /* *
529+ * Handles clicks on the resource button for Sheep
530+ */
524531bool GameController::handleSheepButtonEvent (ScreenCoordinate coord){
525532 if (getState () == YEAROFPLENTY_DEVCARD){
526533 model.getCurrentPlayer ().playYearOfPlenty (SHEEP);
@@ -532,6 +539,10 @@ bool GameController::handleSheepButtonEvent(ScreenCoordinate coord){
532539 return false ;
533540
534541}
542+
543+ /* *
544+ * Handles clicks on the resource button for Wheat
545+ */
535546bool GameController::handleWheatButtonEvent (ScreenCoordinate coord){
536547 if (getState () == YEAROFPLENTY_DEVCARD){
537548 model.getCurrentPlayer ().playYearOfPlenty (WHEAT);
@@ -543,6 +554,10 @@ bool GameController::handleWheatButtonEvent(ScreenCoordinate coord){
543554 return false ;
544555
545556}
557+
558+ /* *
559+ * Handles clicks on the resource button for Ore
560+ */
546561bool GameController::handleOreButtonEvent (ScreenCoordinate coord){
547562 if (getState () == YEAROFPLENTY_DEVCARD){
548563 model.getCurrentPlayer ().playYearOfPlenty (STONE);
@@ -554,6 +569,10 @@ bool GameController::handleOreButtonEvent(ScreenCoordinate coord){
554569 return false ;
555570
556571}
572+
573+ /* *
574+ * Handles clicks on the resource button for Brick
575+ */
557576bool GameController::handleBrickButtonEvent (ScreenCoordinate coord){
558577 if (getState () == YEAROFPLENTY_DEVCARD){
559578 model.getCurrentPlayer ().playYearOfPlenty (BRICK);
0 commit comments