summary refs log tree commit diff stats
path: root/src/map.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-05-17 15:55:37 -0400
committerGitHub <noreply@github.com>2018-05-17 15:55:37 -0400
commit90aadf3844386824140a20d7fbb847bc16009a94 (patch)
tree6f83fce90e71abb22b1a8f3e09c79963b2a34d5d /src/map.h
parentbc63fa57ced1c7329f7fdcfd168eaf7e290158bc (diff)
parent86f0106d0523825549f1e74b835688c78a10cf6c (diff)
downloadtherapy-90aadf3844386824140a20d7fbb847bc16009a94.tar.gz
therapy-90aadf3844386824140a20d7fbb847bc16009a94.tar.bz2
therapy-90aadf3844386824140a20d7fbb847bc16009a94.zip
Merge pull request #7 from hatkirby/es-rewrite
The ECS rewrite exceeds the original branch in functionality, so it is time to merge it in.
Diffstat (limited to 'src/map.h')
-rw-r--r--src/map.h70
1 files changed, 0 insertions, 70 deletions
diff --git a/src/map.h b/src/map.h deleted file mode 100644 index 22333aa..0000000 --- a/src/map.h +++ /dev/null
@@ -1,70 +0,0 @@
1#ifndef MAP_H
2#define MAP_H
3
4#include <string>
5#include <list>
6#include <map>
7
8class Entity;
9
10class Map {
11 public:
12 Map(int id);
13 Map() : Map(-1) {}
14 Map(const Map& map);
15 Map(Map&& map);
16 ~Map();
17 Map& operator= (Map other);
18 friend void swap(Map& first, Map& second);
19
20 enum class MoveType {
21 Wall,
22 Wrap,
23 Warp,
24 ReverseWarp
25 };
26
27 enum class MoveDir {
28 Left,
29 Right,
30 Up,
31 Down
32 };
33
34 struct EntityData {
35 std::string name;
36 std::pair<int, int> position;
37 std::map<std::string, int> items;
38 };
39
40 struct Adjacent {
41 MoveType type = MoveType::Wall;
42 int map = -1;
43 };
44
45 static MoveType moveTypeForShort(std::string str);
46 static MoveDir moveDirForShort(std::string str);
47 static bool moveTypeTakesMap(MoveType type);
48
49 int getID() const;
50 const int* getMapdata() const;
51 std::string getTitle() const;
52 const Adjacent& getAdjacent(MoveDir dir) const;
53
54 void createEntities(std::list<std::shared_ptr<Entity>>& entities) const;
55 bool operator==(const Map& other) const;
56 bool operator!=(const Map& other) const;
57
58 void setMapdata(int* mapdata);
59 void setTitle(std::string title);
60 void setAdjacent(MoveDir dir, MoveType type, int map);
61 void addEntity(EntityData& data);
62 private:
63 int* mapdata;
64 std::string title;
65 int id;
66 std::list<EntityData> entities;
67 std::map<MoveDir, Adjacent> adjacents;
68};
69
70#endif