summary refs log tree commit diff stats
path: root/src/systems/realizing.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/systems/realizing.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/systems/realizing.h')
-rw-r--r--src/systems/realizing.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/systems/realizing.h b/src/systems/realizing.h new file mode 100644 index 0000000..c681892 --- /dev/null +++ b/src/systems/realizing.h
@@ -0,0 +1,43 @@
1#ifndef REALIZING_H_6853748C
2#define REALIZING_H_6853748C
3
4#include "system.h"
5
6class RealizingSystem : public System {
7public:
8
9 RealizingSystem(Game& game) : System(game)
10 {
11 }
12
13 /**
14 * Creates the singleton realizable entity and initializes it with the
15 * provided world definition.
16 */
17 id_type initSingleton(std::string filename);
18
19 /**
20 * Helper method that returns the entity ID of the (assumed) singleton entity
21 * with a RealizableComponent. Throws an exception if the number of realizable
22 * entities is not exactly one.
23 */
24 id_type getSingleton() const;
25
26 /**
27 * Loads the given map.
28 */
29 void loadMap(id_type mapEntity);
30
31 /**
32 * Treats the given entity as part of the active map.
33 */
34 void enterActiveMap(id_type entity);
35
36 /**
37 * Stops treating the given entity as part of the active map.
38 */
39 void leaveActiveMap(id_type entity);
40
41};
42
43#endif /* end of include guard: REALIZING_H_6853748C */