@@ -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);
@@ -209,13 +209,10 @@ bool GameController::handleBoardEvent(ScreenCoordinate screenCoord) {
209209 }
210210 break ;
211211 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);
212+ if (!hasClickHistory ()){
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+ }
219216 break ;
220217 case BUILDSETTLEMENT:
221218 std::cout << " attempting to buy a settlement" << std::endl;
@@ -405,15 +402,15 @@ bool GameController::handleMonopolyCardButtonEvent(ScreenCoordinate coord){
405402}
406403
407404/* *
408- * Handles a click on the VictoryPoint card button. Will push the victory point card state to the control stack
405+ * Handles a click on the VictoryPoint card button. Currently does nothing because victory point cards don't do anything
409406 * @param coord The place the user clicked
410407 * @return true
411408 */
412409bool GameController::handleVictoryPointCardButtonEvent (ScreenCoordinate coord){
413410 if (getState () != BASESTATE){
414- return true ;
411+ return false ;
415412 }
416- pushState (VICTORYPOINT_DEVCARD);
413+ // pushState(VICTORYPOINT_DEVCARD);
417414 return true ;
418415}
419416
@@ -455,13 +452,17 @@ bool GameController::handlePlayerClick(ScreenCoordinate coord, Player& player) {
455452 view.addElement (priority, std::unique_ptr<ViewElement>(new TradingView (initiating, receiving, tradeFunction, cancelFunction, initial)));
456453 std::cout << player.getName () << std::endl;
457454 return true ;
455+
456+ // KNIGHT
458457 }else if (getState () == KNIGHT_DEVCARD){
459458 if (hasClickHistory ()){
460- model.getCurrentPlayer ().playKnight (getPastClick ( 0 ), player);
459+ model.getCurrentPlayer ().playKnight (getLastClick ( ), player);
461460 return handleCancelButtonEvent (coord);
462461 }
462+
463+ // ROBBER
463464 }else if (getState () == ROBBER){
464- if (hasClickHistory () && (model.canRobberRob (player, getPastClick ( 0 )) || player == model.getCurrentPlayer ()) &&
465+ if (hasClickHistory () && (model.canRobberRob (player, getLastClick ( )) || player == model.getCurrentPlayer ()) &&
465466 model.moveRobber (getPastClick (0 ))){
466467
467468 int resourceToSteal = player.getRandomResource ();
@@ -511,6 +512,9 @@ bool GameController::handleTradeOffer(ScreenCoordinate coord, Player& initiating
511512 return true ;
512513}
513514
515+ /* *
516+ * Handles clicks on the resource button for Wood
517+ */
514518bool GameController::handleWoodButtonEvent (ScreenCoordinate coord){
515519 if (getState () == YEAROFPLENTY_DEVCARD){
516520 model.getCurrentPlayer ().playYearOfPlenty (WOOD);
@@ -521,6 +525,10 @@ bool GameController::handleWoodButtonEvent(ScreenCoordinate coord){
521525 }
522526 return false ;
523527}
528+
529+ /* *
530+ * Handles clicks on the resource button for Sheep
531+ */
524532bool GameController::handleSheepButtonEvent (ScreenCoordinate coord){
525533 if (getState () == YEAROFPLENTY_DEVCARD){
526534 model.getCurrentPlayer ().playYearOfPlenty (SHEEP);
@@ -532,6 +540,10 @@ bool GameController::handleSheepButtonEvent(ScreenCoordinate coord){
532540 return false ;
533541
534542}
543+
544+ /* *
545+ * Handles clicks on the resource button for Wheat
546+ */
535547bool GameController::handleWheatButtonEvent (ScreenCoordinate coord){
536548 if (getState () == YEAROFPLENTY_DEVCARD){
537549 model.getCurrentPlayer ().playYearOfPlenty (WHEAT);
@@ -543,6 +555,10 @@ bool GameController::handleWheatButtonEvent(ScreenCoordinate coord){
543555 return false ;
544556
545557}
558+
559+ /* *
560+ * Handles clicks on the resource button for Ore
561+ */
546562bool GameController::handleOreButtonEvent (ScreenCoordinate coord){
547563 if (getState () == YEAROFPLENTY_DEVCARD){
548564 model.getCurrentPlayer ().playYearOfPlenty (STONE);
@@ -554,6 +570,10 @@ bool GameController::handleOreButtonEvent(ScreenCoordinate coord){
554570 return false ;
555571
556572}
573+
574+ /* *
575+ * Handles clicks on the resource button for Brick
576+ */
557577bool GameController::handleBrickButtonEvent (ScreenCoordinate coord){
558578 if (getState () == YEAROFPLENTY_DEVCARD){
559579 model.getCurrentPlayer ().playYearOfPlenty (BRICK);
0 commit comments