summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
Diffstat (limited to 'sim')
-rw-r--r--sim/src/BaseBattle.cpp4
-rw-r--r--sim/src/BaseBattle.h4
-rw-r--r--sim/src/BaseBattle.inl.h19
3 files changed, 25 insertions, 2 deletions
diff --git a/sim/src/BaseBattle.cpp b/sim/src/BaseBattle.cpp
index 8ec603a..aba2981 100644
--- a/sim/src/BaseBattle.cpp
+++ b/sim/src/BaseBattle.cpp
@@ -64,8 +64,8 @@ BaseBattle::update(const float dt)
time += dt;
pick_random_targets();
keep_at_range();
- FloatingMovement::update(_registry, _dispatcher, dt);
- TurretControl::update(_registry, _dispatcher, dt);
+ update<FloatingMovement>(dt);
+ update<TurretControl>(dt);
kill_off_dead();
manager.clear(_registry); // registry supports on destructions events
manager.update(_dispatcher);
diff --git a/sim/src/BaseBattle.h b/sim/src/BaseBattle.h
index 3c19b9c..b20b518 100644
--- a/sim/src/BaseBattle.h
+++ b/sim/src/BaseBattle.h
@@ -24,6 +24,7 @@ public:
entt::dispatcher& dispatcher() override;
void update(float dt) override;
private:
+ template <typename System> void update(float dt);
double time;
entt::registry _registry;
entt::dispatcher _dispatcher;
@@ -38,3 +39,6 @@ private:
} // namespace sim
} // namespace kurator
+
+
+#include "BaseBattle.inl.h"
diff --git a/sim/src/BaseBattle.inl.h b/sim/src/BaseBattle.inl.h
new file mode 100644
index 0000000..8014cb3
--- /dev/null
+++ b/sim/src/BaseBattle.inl.h
@@ -0,0 +1,19 @@
+#pragma once
+
+
+namespace kurator
+{
+namespace sim
+{
+
+
+template <typename System>
+void
+BaseBattle::update(const float dt)
+{
+ System::update(_registry, _dispatcher, dt);
+}
+
+
+} // namespace sim
+} // namespace kurator