Civilization
Map.hpp
1 // Generated by dia2code
2 #ifndef SHARED__MAP__H
3 #define SHARED__MAP__H
4 
5 #include <vector>
6 #include <memory>
7 #include <boost/serialization/access.hpp>
8 #include <boost/serialization/vector.hpp>
9 
10 namespace shared {
11  class PerlinNoise;
12  class Hexagon;
13 }
14 
15 #include "ResourceEnum.hpp"
16 #include "PerlinNoise.hpp"
17 #include "Hexagon.hpp"
18 
19 namespace shared {
20 
22  class Map {
23  // Associations
24  // Attributes
25  private:
26  std::vector<std::shared_ptr<Hexagon>> mapOfTheGame;
27  unsigned height = 0;
28  unsigned width = 0;
29  friend class boost::serialization::access ;
30  bool isInizialize = false;
31  // Operations
32  public:
33  Map (unsigned width = 15, unsigned height = 11);
34  std::shared_ptr<Hexagon> operator() (unsigned x, unsigned y);
35  unsigned getMapHeight ();
36  unsigned getMapWidth ();
37  void setMapHeight (unsigned height);
38  void setMapWidth (unsigned width);
39  void setWater (int x, int y);
40  void generateRandomMap (int seed);
41  void init ();
42  void addResource (int x, int y, int procent, ResourceEnum resource);
43  private:
44  template <class Archive> void serialize (Archive & ar, const unsigned int version);
45  template <class Archive> void save (Archive& ar, const unsigned int version) const;
46  template <class Archive> void load (Archive& ar, const unsigned int version);
47  // Setters and Getters
48  };
49 
50 };
51 
52 #endif
class Map -
Definition: Map.hpp:22
std::shared_ptr< Hexagon > operator()(unsigned x, unsigned y)
Operator to access a specific hexagon of the map.
Definition: Map.cpp:229
Map(unsigned width=15, unsigned height=11)
Map constructor.
Definition: Map.cpp:33
void generateRandomMap(int seed)
Function to generate a random map based on Perlin Noise.
Definition: Map.cpp:87