diff options
Diffstat (limited to 'tools/mapedit/src/map.h')
| -rw-r--r-- | tools/mapedit/src/map.h | 44 |
1 files changed, 20 insertions, 24 deletions
| diff --git a/tools/mapedit/src/map.h b/tools/mapedit/src/map.h index 46e5790..c7f5b30 100644 --- a/tools/mapedit/src/map.h +++ b/tools/mapedit/src/map.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <list> | 7 | #include <list> |
| 8 | #include <memory> | 8 | #include <memory> |
| 9 | #include <wx/treectrl.h> | 9 | #include <wx/treectrl.h> |
| 10 | #include <map> | ||
| 10 | 11 | ||
| 11 | class MapObject; | 12 | class MapObject; |
| 12 | class World; | 13 | class World; |
| @@ -64,6 +65,13 @@ class Map { | |||
| 64 | Map& operator= (Map other); | 65 | Map& operator= (Map other); |
| 65 | friend void swap(Map& first, Map& second); | 66 | friend void swap(Map& first, Map& second); |
| 66 | 67 | ||
| 68 | enum class MoveDir { | ||
| 69 | Left, | ||
| 70 | Right, | ||
| 71 | Up, | ||
| 72 | Down | ||
| 73 | }; | ||
| 74 | |||
| 67 | enum class MoveType { | 75 | enum class MoveType { |
| 68 | Wall, | 76 | Wall, |
| 69 | Wrap, | 77 | Wrap, |
| @@ -71,11 +79,18 @@ class Map { | |||
| 71 | ReverseWarp | 79 | ReverseWarp |
| 72 | }; | 80 | }; |
| 73 | 81 | ||
| 82 | struct Adjacent { | ||
| 83 | MoveType type = MoveType::Wall; | ||
| 84 | int map = 0; | ||
| 85 | }; | ||
| 86 | |||
| 74 | static std::list<MoveType> listMoveTypes(); | 87 | static std::list<MoveType> listMoveTypes(); |
| 75 | static std::string stringForMoveType(MoveType type); | 88 | static std::string stringForMoveType(MoveType type); |
| 76 | static bool moveTypeTakesMap(MoveType type); | 89 | static bool moveTypeTakesMap(MoveType type); |
| 77 | static std::string shortForMoveType(MoveType type); | 90 | static std::string shortForMoveType(MoveType type); |
| 91 | static std::string shortForMoveDir(MoveDir dir); | ||
| 78 | static MoveType moveTypeForShort(std::string str); | 92 | static MoveType moveTypeForShort(std::string str); |
| 93 | static MoveDir moveDirForShort(std::string str); | ||
| 79 | 94 | ||
| 80 | int getID() const; | 95 | int getID() const; |
| 81 | std::string getTitle() const; | 96 | std::string getTitle() const; |
| @@ -86,14 +101,8 @@ class Map { | |||
| 86 | bool getExpanded() const; | 101 | bool getExpanded() const; |
| 87 | World* getWorld() const; | 102 | World* getWorld() const; |
| 88 | bool getHidden() const; | 103 | bool getHidden() const; |
| 89 | MoveType getLeftMoveType() const; | 104 | const std::map<MoveDir, Adjacent>& getAdjacents() const; |
| 90 | MoveType getRightMoveType() const; | 105 | const Adjacent& getAdjacent(MoveDir direction) const; |
| 91 | MoveType getUpMoveType() const; | ||
| 92 | MoveType getDownMoveType() const; | ||
| 93 | int getLeftMoveMapID() const; | ||
| 94 | int getRightMoveMapID() const; | ||
| 95 | int getUpMoveMapID() const; | ||
| 96 | int getDownMoveMapID() const; | ||
| 97 | 106 | ||
| 98 | void setTitle(std::string title, bool dirty = true); | 107 | void setTitle(std::string title, bool dirty = true); |
| 99 | void setTileAt(int x, int y, int tile, bool dirty = true); | 108 | void setTileAt(int x, int y, int tile, bool dirty = true); |
| @@ -104,14 +113,7 @@ class Map { | |||
| 104 | void addChild(int id); | 113 | void addChild(int id); |
| 105 | void setExpanded(bool exp); | 114 | void setExpanded(bool exp); |
| 106 | void setHidden(bool hid); | 115 | void setHidden(bool hid); |
| 107 | void setLeftMoveType(MoveType move, bool dirty = true); | 116 | void setAdjacent(MoveDir direction, MoveType type, int map = -1, bool dirty = true); |
| 108 | void setRightMoveType(MoveType move, bool dirty = true); | ||
| 109 | void setUpMoveType(MoveType move, bool dirty = true); | ||
| 110 | void setDownMoveType(MoveType move, bool dirty = true); | ||
| 111 | void setLeftMoveMapID(int id, bool dirty = true); | ||
| 112 | void setRightMoveMapID(int id, bool dirty = true); | ||
| 113 | void setUpMoveMapID(int id, bool dirty = true); | ||
| 114 | void setDownMoveMapID(int id, bool dirty = true); | ||
| 115 | 117 | ||
| 116 | private: | 118 | private: |
| 117 | int id; | 119 | int id; |
| @@ -123,14 +125,8 @@ class Map { | |||
| 123 | wxTreeItemId treeItemId; | 125 | wxTreeItemId treeItemId; |
| 124 | bool expanded = false; | 126 | bool expanded = false; |
| 125 | bool hidden = false; | 127 | bool hidden = false; |
| 126 | MoveType leftType = MoveType::Wall; | 128 | std::map<MoveDir, Adjacent> adjacents; |
| 127 | MoveType rightType = MoveType::Wall; | 129 | const Adjacent defaultAdjacent {}; |
| 128 | MoveType upType = MoveType::Wall; | ||
| 129 | MoveType downType = MoveType::Wall; | ||
| 130 | int leftMap = 0; | ||
| 131 | int rightMap = 0; | ||
| 132 | int upMap = 0; | ||
| 133 | int downMap = 0; | ||
| 134 | }; | 130 | }; |
| 135 | 131 | ||
| 136 | class MapPtrCtr : public wxTreeItemData { | 132 | class MapPtrCtr : public wxTreeItemData { |
