diff options
Diffstat (limited to 'src/map.h')
| -rw-r--r-- | src/map.h | 70 |
1 files changed, 68 insertions, 2 deletions
| diff --git a/src/map.h b/src/map.h index 9177870..6fe1e62 100644 --- a/src/map.h +++ b/src/map.h | |||
| @@ -10,13 +10,55 @@ | |||
| 10 | class Map { | 10 | class Map { |
| 11 | public: | 11 | public: |
| 12 | 12 | ||
| 13 | class Adjacent { | ||
| 14 | public: | ||
| 15 | |||
| 16 | enum class Type { | ||
| 17 | wall, | ||
| 18 | wrap, | ||
| 19 | warp, | ||
| 20 | reverse | ||
| 21 | }; | ||
| 22 | |||
| 23 | Adjacent( | ||
| 24 | Type type = Type::wall, | ||
| 25 | int mapId = -1) : | ||
| 26 | type_(type), | ||
| 27 | mapId_(mapId) | ||
| 28 | { | ||
| 29 | } | ||
| 30 | |||
| 31 | inline Type getType() const | ||
| 32 | { | ||
| 33 | return type_; | ||
| 34 | } | ||
| 35 | |||
| 36 | inline int getMapId() const | ||
| 37 | { | ||
| 38 | return mapId_; | ||
| 39 | } | ||
| 40 | |||
| 41 | private: | ||
| 42 | |||
| 43 | Type type_; | ||
| 44 | int mapId_; | ||
| 45 | }; | ||
| 46 | |||
| 13 | Map( | 47 | Map( |
| 14 | int id, | 48 | int id, |
| 15 | std::vector<int> tiles, | 49 | std::vector<int> tiles, |
| 16 | std::string title) : | 50 | std::string title, |
| 51 | Adjacent leftAdjacent, | ||
| 52 | Adjacent rightAdjacent, | ||
| 53 | Adjacent upAdjacent, | ||
| 54 | Adjacent downAdjacent) : | ||
| 17 | id_(id), | 55 | id_(id), |
| 18 | tiles_(std::move(tiles)), | 56 | tiles_(std::move(tiles)), |
| 19 | title_(std::move(title)) | 57 | title_(std::move(title)), |
| 58 | leftAdjacent_(std::move(leftAdjacent)), | ||
| 59 | rightAdjacent_(std::move(rightAdjacent)), | ||
| 60 | upAdjacent_(std::move(upAdjacent)), | ||
| 61 | downAdjacent_(std::move(downAdjacent)) | ||
| 20 | { | 62 | { |
| 21 | } | 63 | } |
| 22 | 64 | ||
| @@ -35,11 +77,35 @@ public: | |||
| 35 | return title_; | 77 | return title_; |
| 36 | } | 78 | } |
| 37 | 79 | ||
| 80 | inline const Adjacent& getLeftAdjacent() const | ||
| 81 | { | ||
| 82 | return leftAdjacent_; | ||
| 83 | } | ||
| 84 | |||
| 85 | inline const Adjacent& getRightAdjacent() const | ||
| 86 | { | ||
| 87 | return rightAdjacent_; | ||
| 88 | } | ||
| 89 | |||
| 90 | inline const Adjacent& getUpAdjacent() const | ||
| 91 | { | ||
| 92 | return upAdjacent_; | ||
| 93 | } | ||
| 94 | |||
| 95 | inline const Adjacent& getDownAdjacent() const | ||
| 96 | { | ||
| 97 | return downAdjacent_; | ||
| 98 | } | ||
| 99 | |||
| 38 | private: | 100 | private: |
| 39 | 101 | ||
| 40 | int id_; | 102 | int id_; |
| 41 | std::vector<int> tiles_; | 103 | std::vector<int> tiles_; |
| 42 | std::string title_; | 104 | std::string title_; |
| 105 | Adjacent leftAdjacent_; | ||
| 106 | Adjacent rightAdjacent_; | ||
| 107 | Adjacent upAdjacent_; | ||
| 108 | Adjacent downAdjacent_; | ||
| 43 | }; | 109 | }; |
| 44 | 110 | ||
| 45 | #endif /* end of include guard: MAP_H_74055FC0 */ | 111 | #endif /* end of include guard: MAP_H_74055FC0 */ |
