@@ -22,51 +22,70 @@ class GameVisitor;
2222class GameBoard {
2323private:
2424 std::map<Coordinate, std::unique_ptr<CornerPiece>> corners;
25+
2526 std::map<Coordinate, std::unique_ptr<ResourceTile>> resources;
27+
28+
29+ std::map<Coordinate, std::vector<std::shared_ptr<Road>>> roads;
30+
2631 std::vector<std::unique_ptr<Player>> players;
2732 Coordinate robber;
2833
2934
3035 void addResource (int x, int y, resourceType res, int val);
3136 bool checkRolls (int * rolls);
3237
33- std::map<Coordinate, std::vector<std::shared_ptr<Road>>> roads ;
38+ bool isValidBoard () const ;
3439
35- bool verifyRoadPlacement (Coordinate start, Coordinate end, Player& Owner);
36- bool outOfBounds (const Coordinate& coord);
37- bool roadExists (Coordinate start, Coordinate end);
38- bool isRoadConnectionPoint (Coordinate start, Coordinate end, Player& Owner);
40+ bool verifyRoadPlacement (Coordinate start, Coordinate end, Player& Owner) const ;
41+ bool outOfBounds (const Coordinate& coord) const ;
42+ bool roadExists (Coordinate start, Coordinate end) const ;
43+ bool isRoadConnectionPoint (Coordinate point, Player& Owner) const ;
3944
4045 int constructBoardFromFile (std::ifstream &file);
4146 int constructFileFromBoard (std::ofstream &file);
4247
4348 void removeRoadEnd (std::shared_ptr<Road> startRoad);
44- int FindLongestRoad_FromPoint (Coordinate curr, Player & owner, std::map<Coordinate, bool >& marked, int length);
45-
49+ int FindLongestRoad_FromPoint (Coordinate curr, const Player & owner, std::map<Coordinate, bool >& marked, std::map<Road*, bool >& markedRoads, int length) const ;
50+
51+ void createRing (Coordinate topRight, int sideLength, std::vector<resourceType>& resources, std::vector<int >& rolls);
52+ void insertTile (Coordinate location, std::vector<resourceType>& resources, std::vector<int >& rolls);
4653public:
4754 GameBoard (std::vector<std::unique_ptr<Player>>&& players);
55+ GameBoard (std::vector<std::unique_ptr<Player>>&& players, const std::map<Coordinate, std::pair<resourceType, int >>& resourceLocations);
4856 GameBoard (std::istream& in);
4957 GameBoard (GameBoard&) = delete ;
5058 ~GameBoard ();
5159 GameBoard& operator =(GameBoard&) = delete ;
5260
5361 void save (std::ostream& out);
5462
63+
5564 const std::map<Coordinate, std::unique_ptr<ResourceTile>>& getResources () const ;
56- std::shared_ptr<Road> getRoad (Coordinate start, Coordinate end);
65+
66+
67+
68+ const std::shared_ptr<Road> getRoad (Coordinate start, Coordinate end) const ;
69+
5770
58- int FindLongestRoad (Player & owner);
71+ int FindLongestRoad (const Player & owner) const ;
5972
6073 std::vector<Settlement*> GetNeighboringSettlements (Coordinate location) const ;
6174 std::vector<CornerPiece*> GetNeighboringCorners (Coordinate location) const ;
6275
6376
77+
6478 void PlaceSettlement (Coordinate location, Player& Owner);
6579 void UpgradeSettlement (Coordinate location);
66- void PlaceRoad (Coordinate start, Coordinate end, Player& Owner);
80+ // void PlaceRoad(Coordinate start, Coordinate end, Player& Owner);
81+
82+
83+ bool buyRoad (Coordinate start, Coordinate end, Player& Owner);
6784
6885
69- void init_resources ();
86+ // void PlaceSettlement(Coordinate location, Player& Owner);
87+ void PlaceCity (Coordinate location, Player& Owner);
88+ bool PlaceRoad (Coordinate start, Coordinate end, Player& Owner);
7089
7190 void accept (GameVisitor& visitor);
7291
0 commit comments