summaryrefslogtreecommitdiff
path: root/sim/src
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-12-31 18:26:13 +0100
committerAki <please@ignore.pl>2022-12-31 18:26:13 +0100
commit3615d2a54325eca6e85dc0975e3391d5f943ec3a (patch)
tree0dee958f9dd78d35db2e6216cceec66c12000416 /sim/src
parent087803532fd7dfa04bc9a39fd2886f572002d0b1 (diff)
downloadkurator-3615d2a54325eca6e85dc0975e3391d5f943ec3a.zip
kurator-3615d2a54325eca6e85dc0975e3391d5f943ec3a.tar.gz
kurator-3615d2a54325eca6e85dc0975e3391d5f943ec3a.tar.bz2
Added a wrapper for calling system updates
Diffstat (limited to 'sim/src')
-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