summaryrefslogtreecommitdiff
path: root/sim/src
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-12-03 01:01:39 +0100
committerAki <please@ignore.pl>2022-12-03 01:01:39 +0100
commit13e4f3e3908220d484b01b9fb6dc4375ab28a16e (patch)
treee35ecc703948ad0dea4a63260ab621cd95c229b4 /sim/src
parent2f7d5c306430d65d18eac184551bac8937877d49 (diff)
downloadkurator-13e4f3e3908220d484b01b9fb6dc4375ab28a16e.zip
kurator-13e4f3e3908220d484b01b9fb6dc4375ab28a16e.tar.gz
kurator-13e4f3e3908220d484b01b9fb6dc4375ab28a16e.tar.bz2
Extracted Scenario and related things into own campaign module
Diffstat (limited to 'sim/src')
-rw-r--r--sim/src/BaseBattle.cpp4
-rw-r--r--sim/src/BaseBattle.h4
-rw-r--r--sim/src/Battle.cpp4
-rw-r--r--sim/src/Scenario.cpp23
-rw-r--r--sim/src/scenarios.cpp43
5 files changed, 6 insertions, 72 deletions
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