diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-14 16:13:11 -0400 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-14 16:13:11 -0400 |
| commit | 44324ba5d6cac01048cc5cbecbff255ee56f2fc0 (patch) | |
| tree | 63e859067d214bfccf1d75520e1cedece0e91963 /src/map.h | |
| parent | 5990e7802c84b3f407de3934a1d75721115d1da7 (diff) | |
| download | therapy-44324ba5d6cac01048cc5cbecbff255ee56f2fc0.tar.gz therapy-44324ba5d6cac01048cc5cbecbff255ee56f2fc0.tar.bz2 therapy-44324ba5d6cac01048cc5cbecbff255ee56f2fc0.zip | |
Wrote simple factory to read map and entity data from XML files
Diffstat (limited to 'src/map.h')
| -rw-r--r-- | src/map.h | 31 |
1 files changed, 22 insertions, 9 deletions
| diff --git a/src/map.h b/src/map.h index 071b6f2..fa2edcc 100644 --- a/src/map.h +++ b/src/map.h | |||
| @@ -1,28 +1,41 @@ | |||
| 1 | #ifndef MAP_H | 1 | #ifndef MAP_H |
| 2 | #define MAP_H | 2 | #define MAP_H |
| 3 | 3 | ||
| 4 | #include <string> | ||
| 5 | #include <list> | ||
| 6 | |||
| 7 | class Entity; | ||
| 8 | |||
| 4 | class Map { | 9 | class Map { |
| 5 | public: | 10 | public: |
| 6 | Map(const char* filename); | 11 | Map(); |
| 7 | Map(Map& map); | 12 | Map(const std::string name); |
| 13 | Map(const Map& map); | ||
| 8 | Map(Map&& map); | 14 | Map(Map&& map); |
| 9 | ~Map(); | 15 | ~Map(); |
| 10 | Map& operator= (Map other); | 16 | Map& operator= (Map other); |
| 11 | friend void swap(Map& first, Map& second); | 17 | friend void swap(Map& first, Map& second); |
| 12 | 18 | ||
| 13 | const int* mapdata() const; | 19 | static Map& getNamedMap(const std::string name); |
| 14 | const char* title() const; | 20 | |
| 21 | const int* getMapdata() const; | ||
| 22 | const char* getTitle() const; | ||
| 15 | const Map* getLeftMap() const; | 23 | const Map* getLeftMap() const; |
| 16 | const Map* getRightMap() const; | 24 | const Map* getRightMap() const; |
| 17 | void setLeftMap(const Map* m); | 25 | void setLeftMap(const Map* m); |
| 18 | void setRightMap(const Map* m); | 26 | void setRightMap(const Map* m); |
| 27 | void createEntities(std::list<std::shared_ptr<Entity>>& entities) const; | ||
| 19 | private: | 28 | private: |
| 20 | Map(); | 29 | struct EntityData { |
| 30 | std::string name; | ||
| 31 | std::pair<double, double> position; | ||
| 32 | }; | ||
| 21 | 33 | ||
| 22 | int* m_mapdata; | 34 | int* mapdata; |
| 23 | char* m_title; | 35 | char* title; |
| 24 | const Map* m_leftMap = nullptr; | 36 | const Map* leftMap = nullptr; |
| 25 | const Map* m_rightMap = nullptr; | 37 | const Map* rightMap = nullptr; |
| 38 | std::list<EntityData> entities; | ||
| 26 | }; | 39 | }; |
| 27 | 40 | ||
| 28 | #endif | 41 | #endif |
