From 632c367ae6885657e6c99b96b8bf7a96b61a2bb9 Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 14 Feb 2023 00:13:02 +0100 Subject: Extracted basic simulation behaviour and that part of state to own class --- sim/src/sim.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'sim/src/sim.cpp') diff --git a/sim/src/sim.cpp b/sim/src/sim.cpp index f915d20..4cb7467 100644 --- a/sim/src/sim.cpp +++ b/sim/src/sim.cpp @@ -3,8 +3,10 @@ #include #include #include +#include #include +#include "BaseSimulation.h" #include "Builder.h" #include "RandomSpawner.h" @@ -15,9 +17,10 @@ namespace sim { -void -load_scenario(State& ctx, const campaign::Scenario& scenario) +State +load_scenario(const campaign::Scenario& scenario) { + State ctx {}; RandomSpawner spawner {scenario.last_team(), scenario.radius, 0.1}; Builder build {ctx.registry, spawner}; for (const auto& ship : scenario.ships) { @@ -29,6 +32,14 @@ load_scenario(State& ctx, const campaign::Scenario& scenario) state.keep_at_range = std::min(state.keep_at_range, turret_type.optimal_range); } } + return ctx; +} + + +System +base_simulation_systems(State& ctx) +{ + return BaseSimulation{ctx}; } -- cgit v1.1