diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-13 11:00:02 -0400 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-17 15:39:39 -0400 |
| commit | 046ee24a341468e9b3ea2983a731dbce18b52ac6 (patch) | |
| tree | 554a645bbc9dac63433cf06e1a5168eb2551d02a /src/systems/realizing.h | |
| parent | 5269e7c09a0b17c8c972c8ad996b04d42dbcd9cb (diff) | |
| download | therapy-046ee24a341468e9b3ea2983a731dbce18b52ac6.tar.gz therapy-046ee24a341468e9b3ea2983a731dbce18b52ac6.tar.bz2 therapy-046ee24a341468e9b3ea2983a731dbce18b52ac6.zip | |
Integrated RealizableComponent into RealizingSystem
Diffstat (limited to 'src/systems/realizing.h')
| -rw-r--r-- | src/systems/realizing.h | 66 |
1 files changed, 53 insertions, 13 deletions
| diff --git a/src/systems/realizing.h b/src/systems/realizing.h index 595c58f..ab5a150 100644 --- a/src/systems/realizing.h +++ b/src/systems/realizing.h | |||
| @@ -2,29 +2,56 @@ | |||
| 2 | #define REALIZING_H_6853748C | 2 | #define REALIZING_H_6853748C |
| 3 | 3 | ||
| 4 | #include <string> | 4 | #include <string> |
| 5 | #include <map> | ||
| 5 | #include "system.h" | 6 | #include "system.h" |
| 7 | #include "vector.h" | ||
| 6 | 8 | ||
| 7 | class RealizingSystem : public System { | 9 | class RealizingSystem : public System { |
| 8 | public: | 10 | public: |
| 9 | 11 | ||
| 10 | RealizingSystem(Game& game) : System(game) | ||
| 11 | { | ||
| 12 | } | ||
| 13 | |||
| 14 | /** | 12 | /** |
| 15 | * Creates the singleton realizable entity and initializes it with the | 13 | * Constructs the realizing system. |
| 16 | * provided world definition and map object prototype definition. | 14 | * |
| 15 | * Note that this must be constructed after the following system: | ||
| 16 | * - Mapping | ||
| 17 | * - Animating | ||
| 18 | * - Pondering | ||
| 19 | * - Scripting | ||
| 17 | */ | 20 | */ |
| 18 | id_type initSingleton( | 21 | RealizingSystem( |
| 22 | Game& game, | ||
| 19 | std::string worldFile, | 23 | std::string worldFile, |
| 20 | std::string prototypeFile); | 24 | std::string prototypeFile); |
| 21 | 25 | ||
| 22 | /** | 26 | id_type getActiveMap() const |
| 23 | * Helper method that returns the entity ID of the (assumed) singleton entity | 27 | { |
| 24 | * with a RealizableComponent. Throws an exception if the number of realizable | 28 | return activeMap_; |
| 25 | * entities is not exactly one. | 29 | } |
| 26 | */ | 30 | |
| 27 | id_type getSingleton() const; | 31 | int getStartingMapId() const |
| 32 | { | ||
| 33 | return startingMapId_; | ||
| 34 | } | ||
| 35 | |||
| 36 | vec2i getStartingPos() const | ||
| 37 | { | ||
| 38 | return startingPos_; | ||
| 39 | } | ||
| 40 | |||
| 41 | id_type getEntityByMapId(size_t mapId) const | ||
| 42 | { | ||
| 43 | return entityByMapId_.at(mapId); | ||
| 44 | } | ||
| 45 | |||
| 46 | id_type getActivePlayer() const | ||
| 47 | { | ||
| 48 | return activePlayer_; | ||
| 49 | } | ||
| 50 | |||
| 51 | void setActivePlayer(id_type entity) | ||
| 52 | { | ||
| 53 | activePlayer_ = entity; | ||
| 54 | } | ||
| 28 | 55 | ||
| 29 | /** | 56 | /** |
| 30 | * Loads the given map. | 57 | * Loads the given map. |
| @@ -41,6 +68,19 @@ public: | |||
| 41 | */ | 68 | */ |
| 42 | void leaveActiveMap(id_type entity); | 69 | void leaveActiveMap(id_type entity); |
| 43 | 70 | ||
| 71 | private: | ||
| 72 | |||
| 73 | void deactivateMap(); | ||
| 74 | |||
| 75 | void activateMap(id_type mapEntity); | ||
| 76 | |||
| 77 | std::string worldFile_; | ||
| 78 | std::string prototypeFile_; | ||
| 79 | int startingMapId_; | ||
| 80 | vec2i startingPos_; | ||
| 81 | std::map<size_t, id_type> entityByMapId_; | ||
| 82 | id_type activeMap_; | ||
| 83 | id_type activePlayer_; | ||
| 44 | }; | 84 | }; |
| 45 | 85 | ||
| 46 | #endif /* end of include guard: REALIZING_H_6853748C */ | 86 | #endif /* end of include guard: REALIZING_H_6853748C */ |
