summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
Diffstat (limited to 'sim')
-rw-r--r--sim/CMakeLists.txt1
-rw-r--r--sim/include/kurator/sim/HitPoints.h1
-rw-r--r--sim/src/HitPoints.cpp18
-rw-r--r--sim/src/TurretControl.cpp2
4 files changed, 21 insertions, 1 deletions
diff --git a/sim/CMakeLists.txt b/sim/CMakeLists.txt
index e10056a..b8c3a89 100644
--- a/sim/CMakeLists.txt
+++ b/sim/CMakeLists.txt
@@ -5,6 +5,7 @@ add_library(
src/Battle.cpp
src/Builder.cpp
src/FloatingMovement.cpp
+ src/HitPoints.cpp
src/Point.cpp
src/RandomSpawner.cpp
src/TeamManager.cpp
diff --git a/sim/include/kurator/sim/HitPoints.h b/sim/include/kurator/sim/HitPoints.h
index 20cffc2..feda050 100644
--- a/sim/include/kurator/sim/HitPoints.h
+++ b/sim/include/kurator/sim/HitPoints.h
@@ -10,6 +10,7 @@ namespace sim
struct HitPoints
{
double health;
+ void deal(double damage);
};
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;