From 44324ba5d6cac01048cc5cbecbff255ee56f2fc0 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 14 Mar 2015 16:13:11 -0400 Subject: Wrote simple factory to read map and entity data from XML files --- src/map.h | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'src/map.h') 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 @@ #ifndef MAP_H #define MAP_H +#include +#include + +class Entity; + class Map { public: - Map(const char* filename); - Map(Map& map); + Map(); + Map(const std::string name); + Map(const Map& map); Map(Map&& map); ~Map(); Map& operator= (Map other); friend void swap(Map& first, Map& second); - const int* mapdata() const; - const char* title() const; + static Map& getNamedMap(const std::string name); + + const int* getMapdata() const; + const char* getTitle() const; const Map* getLeftMap() const; const Map* getRightMap() const; void setLeftMap(const Map* m); void setRightMap(const Map* m); + void createEntities(std::list>& entities) const; private: - Map(); + struct EntityData { + std::string name; + std::pair position; + }; - int* m_mapdata; - char* m_title; - const Map* m_leftMap = nullptr; - const Map* m_rightMap = nullptr; + int* mapdata; + char* title; + const Map* leftMap = nullptr; + const Map* rightMap = nullptr; + std::list entities; }; #endif -- cgit 1.4.1