diff options
author | Aki <please@ignore.pl> | 2022-11-10 23:22:15 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-11-10 23:22:15 +0100 |
commit | 35a39b4172008546f0bb4640114a42fb3f3a6f77 (patch) | |
tree | 8e04b27ccd995dd4f51d00079ed55410fd866837 /battles/src/Battle.cpp | |
parent | 57cd7872a624179f3c37c20cef488ce2be6666bc (diff) | |
download | kurator-35a39b4172008546f0bb4640114a42fb3f3a6f77.zip kurator-35a39b4172008546f0bb4640114a42fb3f3a6f77.tar.gz kurator-35a39b4172008546f0bb4640114a42fb3f3a6f77.tar.bz2 |
Flattened Scenario and move sample to battles module
Diffstat (limited to 'battles/src/Battle.cpp')
-rw-r--r-- | battles/src/Battle.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
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 <kurator/battles/Battle.h> -#include <cmath> #include <random> -#include <entt/entity/entity.hpp> - #include <kurator/battles/components.h> #include <kurator/battles/Scenario.h> #include <kurator/universe/ShipType.h> @@ -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<universe::ShipType>(entity, ship.type); - registry.emplace<Team>(entity, team); - registry.emplace<Transform>(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<universe::ShipType>(entity, ship.type); + registry.emplace<Team>(entity, ship.team); + registry.emplace<Transform>(entity, Point{pos(dev), pos(dev)}, Point{0.0, 0.0}); } } |