summaryrefslogtreecommitdiff
path: root/sim/src
diff options
context:
space:
mode:
Diffstat (limited to 'sim/src')
-rw-r--r--sim/src/HitPoints.cpp18
-rw-r--r--sim/src/TurretControl.cpp2
2 files changed, 19 insertions, 1 deletions
diff --git a/sim/src/HitPoints.cpp b/sim/src/HitPoints.cpp
new file mode 100644
index 0000000..4f2ff81
--- /dev/null
+++ b/sim/src/HitPoints.cpp
@@ -0,0 +1,18 @@
+#include <kurator/sim/HitPoints.h>
+
+
+namespace kurator
+{
+namespace sim
+{
+
+
+void
+HitPoints::deal(double damage)
+{
+ health -= damage;
+}
+
+
+} // namespace sim
+} // namespace kurator
diff --git a/sim/src/TurretControl.cpp b/sim/src/TurretControl.cpp
index 56083f1..6513f39 100644
--- a/sim/src/TurretControl.cpp
+++ b/sim/src/TurretControl.cpp
@@ -44,7 +44,7 @@ TurretControl::update(entt::registry& registry, entt::dispatcher& dispatcher, co
auto& target_points = registry.get<HitPoints>(state.target);
const auto damage = def.effective_damage(distance);
if (damage > 0.0) {
- target_points.health -= damage;
+ target_points.deal(damage);
dispatcher.trigger(Hit{damage, control.owner, state.target});
}
control.delay = def.rate_of_fire;