From 8142a9c87a13cecc7a3698e877f24d89f128c074 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 21 Apr 2018 14:50:52 -0400 Subject: Started working on prototype objects --- src/map.h | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 3 deletions(-) (limited to 'src/map.h') diff --git a/src/map.h b/src/map.h index 6fe1e62..0e11b9d 100644 --- a/src/map.h +++ b/src/map.h @@ -4,7 +4,6 @@ #include #include #include -#include #include class Map { @@ -44,6 +43,59 @@ public: int mapId_; }; + class Object { + public: + + Object( + std::string type, + double x, + double y, + size_t index, + std::map items) : + type_(std::move(type)), + x_(x), + y_(y), + index_(index), + items_(std::move(items)) + { + } + + inline const std::string& getType() const + { + return type_; + } + + inline double getX() const + { + return x_; + } + + inline double getY() const + { + return y_; + } + + inline size_t getIndex() const + { + return index_; + } + + inline const std::map& getItems() const + { + return items_; + } + + private: + + std::string type_; + double x_; + double y_; + size_t index_; + std::map items_; + }; + + using object_storage_type = std::list; + Map( int id, std::vector tiles, @@ -51,14 +103,16 @@ public: Adjacent leftAdjacent, Adjacent rightAdjacent, Adjacent upAdjacent, - Adjacent downAdjacent) : + Adjacent downAdjacent, + object_storage_type objects) : id_(id), tiles_(std::move(tiles)), title_(std::move(title)), leftAdjacent_(std::move(leftAdjacent)), rightAdjacent_(std::move(rightAdjacent)), upAdjacent_(std::move(upAdjacent)), - downAdjacent_(std::move(downAdjacent)) + downAdjacent_(std::move(downAdjacent)), + objects_(std::move(objects)) { } @@ -97,6 +151,11 @@ public: return downAdjacent_; } + inline const object_storage_type& getObjects() const + { + return objects_; + } + private: int id_; @@ -106,6 +165,7 @@ private: Adjacent rightAdjacent_; Adjacent upAdjacent_; Adjacent downAdjacent_; + object_storage_type objects_; }; #endif /* end of include guard: MAP_H_74055FC0 */ -- cgit 1.4.1