diff options
Diffstat (limited to 'sim')
-rw-r--r-- | sim/CMakeLists.txt | 3 | ||||
-rw-r--r-- | sim/include/kurator/sim/Battle.h | 4 | ||||
-rw-r--r-- | sim/include/kurator/sim/Scenario.h | 24 | ||||
-rw-r--r-- | sim/include/kurator/sim/ShipConfig.h | 22 | ||||
-rw-r--r-- | sim/include/kurator/sim/scenarios.h | 19 | ||||
-rw-r--r-- | sim/src/BaseBattle.cpp | 4 | ||||
-rw-r--r-- | sim/src/BaseBattle.h | 4 | ||||
-rw-r--r-- | sim/src/Battle.cpp | 4 | ||||
-rw-r--r-- | sim/src/Scenario.cpp | 23 | ||||
-rw-r--r-- | sim/src/scenarios.cpp | 43 |
10 files changed, 9 insertions, 141 deletions
diff --git a/sim/CMakeLists.txt b/sim/CMakeLists.txt index fd7d75a..d193630 100644 --- a/sim/CMakeLists.txt +++ b/sim/CMakeLists.txt @@ -6,8 +6,6 @@ add_library( src/Builder.cpp src/Point.cpp src/RandomSpawner.cpp - src/Scenario.cpp - src/scenarios.cpp src/TeamManager.cpp ) target_include_directories( @@ -17,5 +15,6 @@ target_include_directories( target_link_libraries( ${PROJECT_NAME} PUBLIC EnTT::EnTT + PUBLIC campaign PUBLIC universe ) diff --git a/sim/include/kurator/sim/Battle.h b/sim/include/kurator/sim/Battle.h index e1728f4..0b20ce8 100644 --- a/sim/include/kurator/sim/Battle.h +++ b/sim/include/kurator/sim/Battle.h @@ -5,7 +5,7 @@ #include <entt/entity/registry.hpp> #include <entt/signal/dispatcher.hpp> -#include "Scenario.h" +#include <kurator/campaign/Scenario.h> namespace kurator @@ -24,7 +24,7 @@ public: }; -auto prepare(const Scenario& scenario) -> std::unique_ptr<Battle>; +auto prepare(const campaign::Scenario& scenario) -> std::unique_ptr<Battle>; } // namespace sim diff --git a/sim/include/kurator/sim/Scenario.h b/sim/include/kurator/sim/Scenario.h deleted file mode 100644 index b037365..0000000 --- a/sim/include/kurator/sim/Scenario.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include <string> -#include <vector> - -#include "ShipConfig.h" - - -namespace kurator -{ -namespace sim -{ - - -struct Scenario -{ - std::string name; - std::vector<ShipConfig> ships; - int total_teams() const; -}; - - -} // namespace sim -} // namespace kurator diff --git a/sim/include/kurator/sim/ShipConfig.h b/sim/include/kurator/sim/ShipConfig.h deleted file mode 100644 index bb089ac..0000000 --- a/sim/include/kurator/sim/ShipConfig.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include <string> -#include <vector> - - -namespace kurator -{ -namespace sim -{ - - -struct ShipConfig -{ - int team; - std::string type; - std::vector<std::string> turrets; -}; - - -} // namespace sim -} // namespace kurator diff --git a/sim/include/kurator/sim/scenarios.h b/sim/include/kurator/sim/scenarios.h deleted file mode 100644 index d22b62a..0000000 --- a/sim/include/kurator/sim/scenarios.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "Scenario.h" - - -namespace kurator -{ -namespace sim -{ -namespace scenarios -{ - - -Scenario example(); - - -} // namespace scenarios -} // namespace sim -} // namespace kurator 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 <entt/entity/registry.hpp> #include <entt/signal/dispatcher.hpp> +#include <kurator/campaign/Scenario.h> #include <kurator/sim/components.h> #include <kurator/sim/events.h> -#include <kurator/sim/Scenario.h> #include <kurator/universe.h> #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 <entt/entity/registry.hpp> #include <entt/signal/dispatcher.hpp> +#include <kurator/campaign/Scenario.h> #include <kurator/sim/Battle.h> -#include <kurator/sim/Scenario.h> #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 <memory> -#include <kurator/sim/Scenario.h> +#include <kurator/campaign/Scenario.h> #include "BaseBattle.h" @@ -14,7 +14,7 @@ namespace sim std::unique_ptr<Battle> -prepare(const Scenario& scenario) +prepare(const campaign::Scenario& scenario) { return std::make_unique<BaseBattle>(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 <kurator/sim/Scenario.h> - - -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 <kurator/sim/scenarios.h> - -#include <kurator/sim/Scenario.h> - - -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 |