From 35a39b4172008546f0bb4640114a42fb3f3a6f77 Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 10 Nov 2022 23:22:15 +0100 Subject: Flattened Scenario and move sample to battles module --- battles/src/Battle.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'battles/src/Battle.cpp') diff --git a/battles/src/Battle.cpp b/battles/src/Battle.cpp index e59f951..e410f07 100644 --- a/battles/src/Battle.cpp +++ b/battles/src/Battle.cpp @@ -1,10 +1,7 @@ #include -#include #include -#include - #include #include #include @@ -20,15 +17,11 @@ Battle::Battle(Scenario scenario) { std::random_device dev; std::uniform_real_distribution<> pos{-5.0, 5.0}; - int team = 0; - for (const auto& ships : scenario.teams) { - for (const auto& ship : ships) { - const auto entity = registry.create(); - registry.emplace(entity, ship.type); - registry.emplace(entity, team); - registry.emplace(entity, Point{pos(dev), pos(dev)}, Point{0.0, 0.0}); - } - team++; + for (const auto& ship : scenario.ships) { + const auto entity = registry.create(); + registry.emplace(entity, ship.type); + registry.emplace(entity, ship.team); + registry.emplace(entity, Point{pos(dev), pos(dev)}, Point{0.0, 0.0}); } } -- cgit v1.1