22#define GAME_CONTROLLER_H
33
44#include " Util.h"
5+ #include < vector>
56
67#include < array>
78
@@ -10,18 +11,22 @@ class ClickCoordinateEvent;
1011class GameView ;
1112class Player ;
1213
14+
15+ enum ControlState {BASESTATE, MODALSTATE, BUILDROAD, BUILDSETTLEMENT, ROBBER,
16+ VICTORYPOINT_DEVCARD, BUILDROAD_DEVCARD, KNIGHT_DEVCARD, YEAROFPLENTY_DEVCARD, MONOPOLY_DEVCARD};
17+
18+
1319/* *
14- * Takes interpreted Catan events from the View and calls the appropriate functions on the model to changee the state
20+ * Takes interpreted Catan events from the View and calls the appropriate functions on the model to change the state
1521 * in response.
1622 */
1723class GameController {
1824private:
1925 GameBoard& model;
2026 GameView& view;
2127
22- bool placingRoads;
23- bool placingCities;
24- Coordinate lastCoordClick;
28+ std::vector<ControlState> stateStack;
29+ std::vector<Coordinate> clickHistory;
2530
2631 GameController (const GameController& o) : model(o.model), view(o.view) {} // deleted
2732 GameController& operator =(const GameController& o) { return *this ; } // deleted
@@ -33,6 +38,26 @@ class GameController {
3338 bool handleBoardEvent (ScreenCoordinate);
3439 bool handleRoadButtonEvent (ScreenCoordinate);
3540 bool handleSettlementButtonEvent (ScreenCoordinate);
41+ bool handleRoadCardButtonEvent (ScreenCoordinate);
42+ bool handleKnightCardButtonEvent (ScreenCoordinate);
43+ bool handleYearOfPlentyCardButtonEvent (ScreenCoordinate);
44+ bool handleMonopolyCardButtonEvent (ScreenCoordinate);
45+ bool handleVictoryPointCardButtonEvent (ScreenCoordinate);
46+ bool handleCancelButtonEvent (ScreenCoordinate);
47+
48+ bool handleConfirmRoadCard (ScreenCoordinate);
49+ bool handleCancelDialogueEvent (ScreenCoordinate);
50+
51+ void pushState (ControlState);
52+ ControlState getState ();
53+ ControlState popState ();
54+ void storeClick (Coordinate clickCoordinate);
55+ Coordinate getLastClick ();
56+ Coordinate getPastClick (int howLongAgo);
57+ void clearClickHistory ();
58+ bool hasClickHistory ();
59+ int getClickHistorySize ();
60+
3661 bool handlePlayerClick (ScreenCoordinate, Player&);
3762 bool handleTradeOffer (ScreenCoordinate, Player& initiating, std::array<int , 5 >, Player& receiving, std::array<int , 5 >);
3863};
0 commit comments