diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-18 09:48:43 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-18 09:48:43 -0400 |
commit | 2ec163612042bfa5e4e1bf220b489506f7039677 (patch) | |
tree | ead735eb871c3faf813635d08a89ec48195dab35 /src/map.h | |
parent | dc0f0d6fa178403080658887af3ca1a6c0e41188 (diff) | |
download | therapy-2ec163612042bfa5e4e1bf220b489506f7039677.tar.gz therapy-2ec163612042bfa5e4e1bf220b489506f7039677.tar.bz2 therapy-2ec163612042bfa5e4e1bf220b489506f7039677.zip |
Game can now read map file from map editor (also added new map)
Diffstat (limited to 'src/map.h')
-rw-r--r-- | src/map.h | 56 |
1 files changed, 41 insertions, 15 deletions
diff --git a/src/map.h b/src/map.h index 3b3d42c..1234dbb 100644 --- a/src/map.h +++ b/src/map.h | |||
@@ -8,37 +8,63 @@ class Entity; | |||
8 | 8 | ||
9 | class Map { | 9 | class Map { |
10 | public: | 10 | public: |
11 | Map(); | 11 | Map(int id); |
12 | Map(std::string name); | 12 | Map() : Map(-1) {} |
13 | Map(const Map& map); | 13 | Map(const Map& map); |
14 | Map(Map&& map); | 14 | Map(Map&& map); |
15 | ~Map(); | 15 | ~Map(); |
16 | Map& operator= (Map other); | 16 | Map& operator= (Map other); |
17 | friend void swap(Map& first, Map& second); | 17 | friend void swap(Map& first, Map& second); |
18 | 18 | ||
19 | static Map& getNamedMap(std::string name); | 19 | enum class MoveType { |
20 | Wall, | ||
21 | Wrap, | ||
22 | Warp, | ||
23 | ReverseWarp | ||
24 | }; | ||
25 | |||
26 | struct EntityData { | ||
27 | std::string name; | ||
28 | std::pair<int, int> position; | ||
29 | }; | ||
30 | |||
31 | static MoveType moveTypeForShort(std::string str); | ||
32 | static bool moveTypeTakesMap(MoveType type); | ||
20 | 33 | ||
34 | int getID() const; | ||
21 | const int* getMapdata() const; | 35 | const int* getMapdata() const; |
22 | std::string getTitle() const; | 36 | std::string getTitle() const; |
23 | const Map* getLeftMap() const; | 37 | MoveType getLeftMoveType() const; |
24 | const Map* getRightMap() const; | 38 | MoveType getRightMoveType() const; |
25 | void setLeftMap(const Map* m); | 39 | MoveType getUpMoveType() const; |
26 | void setRightMap(const Map* m); | 40 | MoveType getDownMoveType() const; |
41 | int getLeftMapID() const; | ||
42 | int getRightMapID() const; | ||
43 | int getUpMapID() const; | ||
44 | int getDownMapID() const; | ||
45 | |||
27 | void createEntities(std::list<std::shared_ptr<Entity>>& entities) const; | 46 | void createEntities(std::list<std::shared_ptr<Entity>>& entities) const; |
28 | bool operator==(const Map& other) const; | 47 | bool operator==(const Map& other) const; |
29 | bool operator!=(const Map& other) const; | 48 | bool operator!=(const Map& other) const; |
30 | private: | ||
31 | struct EntityData { | ||
32 | std::string name; | ||
33 | std::pair<double, double> position; | ||
34 | }; | ||
35 | 49 | ||
50 | void setMapdata(int* mapdata); | ||
51 | void setTitle(std::string title); | ||
52 | void setLeftMoveType(MoveType type); | ||
53 | void setRightMoveType(MoveType type); | ||
54 | void setUpMoveType(MoveType type); | ||
55 | void setDownMoveType(MoveType type); | ||
56 | void setLeftMapID(int id); | ||
57 | void setRightMapID(int id); | ||
58 | void setUpMapID(int id); | ||
59 | void setDownMapID(int id); | ||
60 | void addEntity(EntityData& data); | ||
61 | private: | ||
36 | int* mapdata; | 62 | int* mapdata; |
37 | std::string title; | 63 | std::string title; |
38 | std::string name; | 64 | int id; |
39 | const Map* leftMap = nullptr; | ||
40 | const Map* rightMap = nullptr; | ||
41 | std::list<EntityData> entities; | 65 | std::list<EntityData> entities; |
66 | MoveType leftType, rightType, upType, downType; | ||
67 | int leftMap, rightMap, upMap, downMap; | ||
42 | }; | 68 | }; |
43 | 69 | ||
44 | #endif | 70 | #endif |