From 3615d2a54325eca6e85dc0975e3391d5f943ec3a Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 31 Dec 2022 18:26:13 +0100 Subject: Added a wrapper for calling system updates --- sim/src/BaseBattle.cpp | 4 ++-- sim/src/BaseBattle.h | 4 ++++ sim/src/BaseBattle.inl.h | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 sim/src/BaseBattle.inl.h (limited to 'sim') 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(dt); + update(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 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 +void +BaseBattle::update(const float dt) +{ + System::update(_registry, _dispatcher, dt); +} + + +} // namespace sim +} // namespace kurator -- cgit v1.1