summary refs log tree commit diff stats
path: root/src/map.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-04-28 09:22:44 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-04-28 09:22:44 -0400
commit8016a7146fec3f6f43ca05723441750e5aae3d4d (patch)
tree0d527c1af80cf9ac34a027f9ee6f1acbb95db9f4 /src/map.h
parentf782b81ba10c9b7a1e221b16de0aaa7b6c521729 (diff)
downloadtherapy-8016a7146fec3f6f43ca05723441750e5aae3d4d.tar.gz
therapy-8016a7146fec3f6f43ca05723441750e5aae3d4d.tar.bz2
therapy-8016a7146fec3f6f43ca05723441750e5aae3d4d.zip
Restructured the way the world is loaded
The World class was removed and replaced by the RealizingSystem and RealizableComponent. The realizable entity is intended to be a singleton and to represent the world. The Map class was also removed and integrated into the MappableComponent.

These changes are to facilitate implementation of map objects without needing special intermediary objects (including the Map class). Now, map entities are created as soon as the world is created, and map object entities will be as well. They will simply be deactivated while the map is not active. Multiple players are now slightly better supported, which will be important in the future.

This will likely become inefficient as the world becomes bigger, and some sort of sector-loading process will have to be designed. This also reduces the usefulness of EntityManager's entity-searching capabilities (which are not the most efficiently implemented currently anyway), and will likely in the future require some added functionality to better search subsets of entities.

A lot of the components were also rewritten to use bare member variables instead of accessor methods, as they never had special functionality and just took up space. These components were also documented.
Diffstat (limited to 'src/map.h')
-rw-r--r--src/map.h111
1 files changed, 0 insertions, 111 deletions
diff --git a/src/map.h b/src/map.h deleted file mode 100644 index 6fe1e62..0000000 --- a/src/map.h +++ /dev/null
@@ -1,111 +0,0 @@
1#ifndef MAP_H_74055FC0
2#define MAP_H_74055FC0
3
4#include <vector>
5#include <string>
6#include <list>
7#include <stdexcept>
8#include <map>
9
10class Map {
11public:
12
13 class Adjacent {
14 public:
15
16 enum class Type {
17 wall,
18 wrap,
19 warp,
20 reverse
21 };
22
23 Adjacent(
24 Type type = Type::wall,
25 int mapId = -1) :
26 type_(type),
27 mapId_(mapId)
28 {
29 }
30
31 inline Type getType() const
32 {
33 return type_;
34 }
35
36 inline int getMapId() const
37 {
38 return mapId_;
39 }
40
41 private:
42
43 Type type_;
44 int mapId_;
45 };
46
47 Map(
48 int id,
49 std::vector<int> tiles,
50 std::string title,
51 Adjacent leftAdjacent,
52 Adjacent rightAdjacent,
53 Adjacent upAdjacent,
54 Adjacent downAdjacent) :
55 id_(id),
56 tiles_(std::move(tiles)),
57 title_(std::move(title)),
58 leftAdjacent_(std::move(leftAdjacent)),
59 rightAdjacent_(std::move(rightAdjacent)),
60 upAdjacent_(std::move(upAdjacent)),
61 downAdjacent_(std::move(downAdjacent))
62 {
63 }
64
65 inline size_t getId() const
66 {
67 return id_;
68 }
69
70 inline const std::vector<int>& getTiles() const
71 {
72 return tiles_;
73 }
74
75 inline const std::string& getTitle() const
76 {
77 return title_;
78 }
79
80 inline const Adjacent& getLeftAdjacent() const
81 {
82 return leftAdjacent_;
83 }
84
85 inline const Adjacent& getRightAdjacent() const
86 {
87 return rightAdjacent_;
88 }
89
90 inline const Adjacent& getUpAdjacent() const
91 {
92 return upAdjacent_;
93 }
94
95 inline const Adjacent& getDownAdjacent() const
96 {
97 return downAdjacent_;
98 }
99
100private:
101
102 int id_;
103 std::vector<int> tiles_;
104 std::string title_;
105 Adjacent leftAdjacent_;
106 Adjacent rightAdjacent_;
107 Adjacent upAdjacent_;
108 Adjacent downAdjacent_;
109};
110
111#endif /* end of include guard: MAP_H_74055FC0 */