diff options
Diffstat (limited to 'tools/mapedit/src/map.h')
-rw-r--r-- | tools/mapedit/src/map.h | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/tools/mapedit/src/map.h b/tools/mapedit/src/map.h index a2b9cb8..5753cae 100644 --- a/tools/mapedit/src/map.h +++ b/tools/mapedit/src/map.h | |||
@@ -1,12 +1,16 @@ | |||
1 | #ifndef MAP_H | 1 | #ifndef MAP_H |
2 | #define MAP_H | 2 | #define MAP_H |
3 | 3 | ||
4 | class Map; | ||
5 | |||
4 | #include <string> | 6 | #include <string> |
5 | #include <exception> | 7 | #include <exception> |
6 | #include <utility> | 8 | #include <utility> |
7 | #include <list> | 9 | #include <list> |
8 | #include "object.h" | 10 | #include "object.h" |
9 | #include <memory> | 11 | #include <memory> |
12 | #include "world.h" | ||
13 | #include <wx/treectrl.h> | ||
10 | 14 | ||
11 | class MapeditFrame; | 15 | class MapeditFrame; |
12 | 16 | ||
@@ -57,36 +61,45 @@ struct MapObjectEntry { | |||
57 | 61 | ||
58 | class Map { | 62 | class Map { |
59 | public: | 63 | public: |
60 | Map(); | 64 | Map(int id, World* world); |
61 | Map(std::string name); | ||
62 | Map(const Map& map); | 65 | Map(const Map& map); |
63 | Map(Map&& map); | 66 | Map(Map&& map); |
64 | ~Map(); | 67 | ~Map(); |
65 | Map& operator= (Map other); | 68 | Map& operator= (Map other); |
66 | friend void swap(Map& first, Map& second); | 69 | friend void swap(Map& first, Map& second); |
67 | 70 | ||
71 | int getID() const; | ||
68 | std::string getTitle() const; | 72 | std::string getTitle() const; |
69 | void setTitle(std::string title); | ||
70 | void save(std::string name); | ||
71 | bool hasUnsavedChanges() const; | ||
72 | void setTileAt(int x, int y, int tile); | ||
73 | int getTileAt(int x, int y) const; | 73 | int getTileAt(int x, int y) const; |
74 | const std::list<std::shared_ptr<MapObjectEntry>>& getObjects() const; | 74 | const std::list<std::shared_ptr<MapObjectEntry>>& getObjects() const; |
75 | void addObject(std::shared_ptr<MapObjectEntry>& obj); | 75 | std::shared_ptr<Map> getLeftmap() const; |
76 | void removeObject(std::shared_ptr<MapObjectEntry>& obj); | 76 | std::shared_ptr<Map> getRightmap() const; |
77 | bool getDirty() const; | 77 | wxTreeItemId getTreeItemId() const; |
78 | std::list<std::shared_ptr<Map>> getChildren() const; | ||
79 | bool getExpanded() const; | ||
78 | 80 | ||
79 | MapeditFrame* frame; | 81 | void setTitle(std::string title, bool dirty = true); |
82 | void setTileAt(int x, int y, int tile, bool dirty = true); | ||
83 | void setMapdata(int* mapdata, bool dirty = true); | ||
84 | void addObject(std::shared_ptr<MapObjectEntry>& obj, bool dirty = true); | ||
85 | void removeObject(std::shared_ptr<MapObjectEntry>& obj, bool dirty = true); | ||
86 | void setLeftmap(int id, bool dirty = true); | ||
87 | void setRightmap(int id, bool dirty = true); | ||
88 | void setTreeItemId(wxTreeItemId id); | ||
89 | void addChild(int id); | ||
90 | void setExpanded(bool exp); | ||
80 | 91 | ||
81 | private: | 92 | private: |
82 | void setDirty(bool dirty); | 93 | int id; |
83 | 94 | World* world; | |
84 | std::list<std::shared_ptr<MapObjectEntry>> objects; | 95 | std::list<std::shared_ptr<MapObjectEntry>> objects; |
85 | int* mapdata; | 96 | int* mapdata; |
86 | std::string title; | 97 | std::string title {"Untitled Map"}; |
87 | std::string leftmap; | 98 | std::list<int> children; |
88 | std::string rightmap; | 99 | int leftmap = -1; |
89 | bool dirty; | 100 | int rightmap = -1; |
101 | wxTreeItemId treeItemId; | ||
102 | bool expanded = false; | ||
90 | }; | 103 | }; |
91 | 104 | ||
92 | #endif | 105 | #endif |