From 97d7fb425da906947cc45e11fadb35f708da50d6 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 7 Feb 2018 14:13:32 -0500 Subject: 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. --- src/system.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/system.h') 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 @@ class Game; class System { - public: - System(Game& game) - : game(game) {} +public: + System(Game& game) + : game(game) {} - virtual void tick(double dt) = 0; + virtual ~System() = default; - protected: - Game& game; + virtual void tick(double dt) = 0; + +protected: + + Game& game; }; #endif /* end of include guard: SYSTEM_H_B61A8CEA */ -- cgit 1.4.1