@@ -23,9 +23,10 @@ GameController::GameController(GameBoard& model, GameView& view) : model(model),
2323 auto font = getGraphicsConfig ()[" font.path" ];
2424 auto fontSize = getGraphicsConfig ()[" font.size" ];
2525
26- view.addElement (makeViewButtonText (std::bind (&GameController::nextTurn, this , _1), {{0 , 0.2 }, {0.1 , 0.3 }}, font, fontSize, " Turn" ));
2726 view.addElement (makeViewButtonText (std::bind (&GameController::handleRoadButtonEvent, this , _1), {{0 , 0 }, {0.1 , 0.1 }}, font, fontSize, " Road" ));
2827 view.addElement (makeViewButtonText (std::bind (&GameController::handleSettlementButtonEvent, this , _1), {{0 , 0.1 }, {0.1 , 0.2 }}, font, fontSize, " Stlm" ));
28+ view.addElement (makeViewButtonText (std::bind (&GameController::handleCityButtonEvent, this , _1), {{0 , 0.2 }, {0.1 , 0.3 }}, font, fontSize, " City" ));
29+ view.addElement (makeViewButtonText (std::bind (&GameController::nextTurn, this , _1), {{0 , 0.3 }, {0.1 , 0.4 }}, font, fontSize, " Turn" ));
2930
3031 auto playerTopY = 0.9 ;
3132 for (auto i = 0 ; i < model.getNoOfPlayers (); i++) {
@@ -204,6 +205,11 @@ bool GameController::handleBoardEvent(ScreenCoordinate screenCoord) {
204205 model.buySettlement (coord, model.getCurrentPlayer ());
205206 popState ();
206207 break ;
208+ case BUILDCITY:
209+ std::cout << " attempting to build a city" << std::endl;
210+ model.buyUpgradeOnSettlement (coord, model.getCurrentPlayer ());
211+ popState ();
212+ break ;
207213 default :
208214 break ;
209215 }
@@ -238,7 +244,7 @@ bool GameController::handleRoadButtonEvent(ScreenCoordinate coord) {
238244}
239245
240246/* *
241- * Handles a click on the "create settlement" button. Changes the internal state to indicate the user is going to be making roads on the board.
247+ * Handles a click on the "create settlement" button. Changes the internal state to indicate the user is going to be making settlements on the board.
242248 * @param coord The place the user clicked on screen.
243249 * @return Whether this event was handled by this element. Always true.
244250 */
@@ -250,6 +256,18 @@ bool GameController::handleSettlementButtonEvent(ScreenCoordinate coord) {
250256 return true ;
251257}
252258
259+ /* *
260+ * Handles a click on the "create city" button. Changes the internal state to indicate the user is going to be upgrading settlements to cities on the board.
261+ * @param coord The place the user clicked on screen.
262+ * @return Whether this event was handled by this element. Always true.
263+ */
264+ bool GameController::handleCityButtonEvent (ScreenCoordinate coord) {
265+ if (getState () == BASESTATE) {
266+ pushState (BUILDCITY);
267+ }
268+ return true ;
269+ }
270+
253271
254272/* *
255273 * Handles a click on the road Building Card button. This changes the control state to indicate the user is going to be building roads on the board.
0 commit comments