From 13e4f3e3908220d484b01b9fb6dc4375ab28a16e Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 3 Dec 2022 01:01:39 +0100 Subject: Extracted Scenario and related things into own campaign module --- sim/src/BaseBattle.cpp | 4 ++-- sim/src/BaseBattle.h | 4 ++-- sim/src/Battle.cpp | 4 ++-- sim/src/Scenario.cpp | 23 ----------------------- sim/src/scenarios.cpp | 43 ------------------------------------------- 5 files changed, 6 insertions(+), 72 deletions(-) delete mode 100644 sim/src/Scenario.cpp delete mode 100644 sim/src/scenarios.cpp (limited to 'sim/src') diff --git a/sim/src/BaseBattle.cpp b/sim/src/BaseBattle.cpp index 3b56b0a..621b6bb 100644 --- a/sim/src/BaseBattle.cpp +++ b/sim/src/BaseBattle.cpp @@ -6,9 +6,9 @@ #include #include +#include #include #include -#include #include #include "Builder.h" @@ -20,7 +20,7 @@ namespace sim { -BaseBattle::BaseBattle(const Scenario& scenario) : +BaseBattle::BaseBattle(const campaign::Scenario& scenario) : _registry {}, spawner {scenario.total_teams(), 12000, 0.1} { diff --git a/sim/src/BaseBattle.h b/sim/src/BaseBattle.h index 13d7457..b0980fe 100644 --- a/sim/src/BaseBattle.h +++ b/sim/src/BaseBattle.h @@ -3,8 +3,8 @@ #include #include +#include #include -#include #include "RandomSpawner.h" #include "TeamManager.h" @@ -19,7 +19,7 @@ namespace sim class BaseBattle : public Battle { public: - BaseBattle(const Scenario& scenario); + BaseBattle(const campaign::Scenario& scenario); entt::registry& registry() override; entt::dispatcher& dispatcher() override; void update(float dt) override; diff --git a/sim/src/Battle.cpp b/sim/src/Battle.cpp index f8eacb5..4bbfcb6 100644 --- a/sim/src/Battle.cpp +++ b/sim/src/Battle.cpp @@ -2,7 +2,7 @@ #include -#include +#include #include "BaseBattle.h" @@ -14,7 +14,7 @@ namespace sim std::unique_ptr -prepare(const Scenario& scenario) +prepare(const campaign::Scenario& scenario) { return std::make_unique(scenario); } diff --git a/sim/src/Scenario.cpp b/sim/src/Scenario.cpp deleted file mode 100644 index 49201c3..0000000 --- a/sim/src/Scenario.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - - -namespace kurator -{ -namespace sim -{ - - -int -Scenario::total_teams() const -{ - int last_team = 0; - for (const auto& ship : ships) { - if (ship.team > last_team) - last_team = ship.team; - } - return last_team + 1; -} - - -} // namespace sim -} // namespace kurator diff --git a/sim/src/scenarios.cpp b/sim/src/scenarios.cpp deleted file mode 100644 index 65588bf..0000000 --- a/sim/src/scenarios.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include - -#include - - -namespace kurator -{ -namespace sim -{ -namespace scenarios -{ - - -Scenario -example() -{ - return { - "Example", - { - {0, "Anvil", {"ChargeLaser", "ChargeLaser"}}, - {0, "Anvil", {"ChargeLaser", "ChargeLaser"}}, - {0, "Anvil", {"ChargeLaser", "ChargeLaser"}}, - {0, "Warbringer", {"ChargeLaser"}}, - {0, "Warbringer", {"ChargeLaser"}}, - {0, "Eclipse", {"ChargeLaser"}}, - {0, "Eclipse", {"ChargeLaser"}}, - {0, "Eclipse", {"ChargeLaser"}}, - {1, "Anvil", {"ChargeLaser", "ChargeLaser"}}, - {1, "Anvil", {"ChargeLaser", "ChargeLaser"}}, - {1, "Anvil", {"ChargeLaser", "ChargeLaser"}}, - {1, "Warbringer", {"ChargeLaser"}}, - {1, "Warbringer", {"ChargeLaser"}}, - {1, "Eclipse", {"ChargeLaser"}}, - {1, "Eclipse", {"ChargeLaser"}}, - {1, "Eclipse", {"ChargeLaser"}}, - }, - }; -} - - -} // namespace scenarios -} // namespace sim -} // namespace kurator -- cgit v1.1