summary refs log tree commit diff stats
path: root/src/system.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-02-07 14:13:32 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-02-07 14:13:32 -0500
commit97d7fb425da906947cc45e11fadb35f708da50d6 (patch)
treeae1a4a5bbbce97e5dcf50e7390f005fe9be61356 /src/system.h
parentda3df061699203eccc9a0c98becaee3ce8050a4f (diff)
downloadtherapy-97d7fb425da906947cc45e11fadb35f708da50d6.tar.gz
therapy-97d7fb425da906947cc45e11fadb35f708da50d6.tar.bz2
therapy-97d7fb425da906947cc45e11fadb35f708da50d6.zip
Changed EntityManager to dense vector
This should improve speed, because entity lookup will be O(1) instead of O(log n). Deletion is also O(1). Insert stays at potentially O(n), but still should be overall faster than the previous method.

Also replaced some asserts with exceptions.

Also made Component polymorphic so that deletion actually works properly.
Diffstat (limited to 'src/system.h')
-rw-r--r--src/system.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/system.h b/src/system.h index af3fb77..489afd0 100644 --- a/src/system.h +++ b/src/system.h
@@ -4,14 +4,17 @@
4class Game; 4class Game;
5 5
6class System { 6class System {
7 public: 7public:
8 System(Game& game) 8 System(Game& game)
9 : game(game) {} 9 : game(game) {}
10 10
11 virtual void tick(double dt) = 0; 11 virtual ~System() = default;
12 12
13 protected: 13 virtual void tick(double dt) = 0;
14 Game& game; 14
15protected:
16
17 Game& game;
15}; 18};
16 19
17#endif /* end of include guard: SYSTEM_H_B61A8CEA */ 20#endif /* end of include guard: SYSTEM_H_B61A8CEA */