summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2023-01-02 00:47:48 +0100
committerAki <please@ignore.pl>2023-01-02 00:47:48 +0100
commit27216f78d7a08ffd14ad7040f76c8078ecdfd993 (patch)
tree70b60cba5b79be2220259ba2342f0d1390bffe22
parent1e0cb31ec62a5895c475a52c4e0066672047416f (diff)
downloadkurator-27216f78d7a08ffd14ad7040f76c8078ecdfd993.zip
kurator-27216f78d7a08ffd14ad7040f76c8078ecdfd993.tar.gz
kurator-27216f78d7a08ffd14ad7040f76c8078ecdfd993.tar.bz2
Moved UniqueIdentifier to universe module
-rw-r--r--campaign/include/kurator/campaign/ShipConfig.h4
-rw-r--r--kurator/src/Battle.cpp4
-rw-r--r--sim/src/BaseBattle.cpp8
-rw-r--r--stats/CMakeLists.txt2
-rw-r--r--stats/include/kurator/stats/events.h4
-rw-r--r--universe/include/kurator/universe/UniqueIdentifier.h (renamed from campaign/include/kurator/campaign/UniqueIdentifier.h)4
6 files changed, 13 insertions, 13 deletions
diff --git a/campaign/include/kurator/campaign/ShipConfig.h b/campaign/include/kurator/campaign/ShipConfig.h
index 9aec2fa..e10251b 100644
--- a/campaign/include/kurator/campaign/ShipConfig.h
+++ b/campaign/include/kurator/campaign/ShipConfig.h
@@ -3,7 +3,7 @@
#include <string>
#include <vector>
-#include "UniqueIdentifier.h"
+#include <kurator/universe/UniqueIdentifier.h>
namespace kurator
@@ -14,7 +14,7 @@ namespace campaign
struct ShipConfig
{
- UniqueIdentifier identifier;
+ universe::UniqueIdentifier identifier;
int team;
std::string type;
std::vector<std::string> turrets;
diff --git a/kurator/src/Battle.cpp b/kurator/src/Battle.cpp
index 52270b3..3d0ac72 100644
--- a/kurator/src/Battle.cpp
+++ b/kurator/src/Battle.cpp
@@ -11,13 +11,13 @@
#include <imgui.h>
#include <kurator/campaign/scenarios.h>
-#include <kurator/campaign/UniqueIdentifier.h>
#include <kurator/sim/Battle.h>
#include <kurator/sim/components.h>
#include <kurator/sim/events.h>
#include <kurator/sim/Point.h>
#include <kurator/stats/events.h>
#include <kurator/universe/ShipType.h>
+#include <kurator/universe/UniqueIdentifier.h>
#include "colors.h"
#include "components.h"
@@ -46,7 +46,7 @@ Battle::Battle(std::shared_ptr<Session> _session, campaign::Scenario scenario, B
battle->dispatcher().sink<sim::Hit>().connect<&Battle::on_hit>(*this);
battle->dispatcher().sink<stats::ShipLeft>().connect<&Battle::on_ship_left>(*this);
auto& registry = battle->registry();
- auto ships = registry.view<sim::Team, universe::ShipType, campaign::UniqueIdentifier>();
+ auto ships = registry.view<sim::Team, universe::ShipType, universe::UniqueIdentifier>();
for (const auto& [entity, team, type, identifier] : ships.each()) {
std::string label = TextFormat("%s (%d)", type.name.c_str(), identifier.id);
registry.emplace<Marker>(entity, 5.0, team_color(team.id), std::move(label));
diff --git a/sim/src/BaseBattle.cpp b/sim/src/BaseBattle.cpp
index 14a9ccd..17df990 100644
--- a/sim/src/BaseBattle.cpp
+++ b/sim/src/BaseBattle.cpp
@@ -6,7 +6,6 @@
#include <entt/signal/dispatcher.hpp>
#include <kurator/campaign/Scenario.h>
-#include <kurator/campaign/UniqueIdentifier.h>
#include <kurator/sim/components.h>
#include <kurator/sim/events.h>
#include <kurator/sim/FloatingMovement.h>
@@ -14,6 +13,7 @@
#include <kurator/sim/TurretControl.h>
#include <kurator/stats/events.h>
#include <kurator/universe.h>
+#include <kurator/universe/UniqueIdentifier.h>
#include "Builder.h"
@@ -33,7 +33,7 @@ BaseBattle::BaseBattle(const campaign::Scenario& scenario) :
Builder build {_registry, spawner};
for (const auto& ship : scenario.ships) {
const auto entity = build(repo->ship_type(ship.type), ship.team);
- _registry.emplace<campaign::UniqueIdentifier>(entity, ship.identifier);
+ _registry.emplace<universe::UniqueIdentifier>(entity, ship.identifier);
auto& state = _registry.get<AIState>(entity);
for (const auto& turret_type : ship.turrets) {
auto def = repo->turret_type(turret_type);
@@ -105,8 +105,8 @@ BaseBattle::kill_off_dead()
for (auto&& [entity, points] : view.each()) {
if (points.health > 0.0)
continue;
- if (_registry.all_of<campaign::UniqueIdentifier, Team>(entity)) {
- const auto& [identifier, team] = _registry.get<campaign::UniqueIdentifier, Team>(entity);
+ if (_registry.all_of<universe::UniqueIdentifier, Team>(entity)) {
+ const auto& [identifier, team] = _registry.get<universe::UniqueIdentifier, Team>(entity);
_dispatcher.trigger(stats::ShipLeft{time, identifier, team.id, true});
}
_registry.destroy(entity);
diff --git a/stats/CMakeLists.txt b/stats/CMakeLists.txt
index 02b68a8..0af30a8 100644
--- a/stats/CMakeLists.txt
+++ b/stats/CMakeLists.txt
@@ -8,5 +8,5 @@ target_include_directories(
)
target_link_libraries(
${PROJECT_NAME}
- INTERFACE campaign
+ INTERFACE universe
)
diff --git a/stats/include/kurator/stats/events.h b/stats/include/kurator/stats/events.h
index a9a9612..ea25826 100644
--- a/stats/include/kurator/stats/events.h
+++ b/stats/include/kurator/stats/events.h
@@ -1,6 +1,6 @@
#pragma once
-#include <kurator/campaign/UniqueIdentifier.h>
+#include <kurator/universe/UniqueIdentifier.h>
namespace kurator
@@ -12,7 +12,7 @@ namespace stats
struct ShipLeft
{
double time;
- campaign::UniqueIdentifier ship;
+ universe::UniqueIdentifier ship;
int team;
bool destroyed;
};
diff --git a/campaign/include/kurator/campaign/UniqueIdentifier.h b/universe/include/kurator/universe/UniqueIdentifier.h
index 6e3c4f5..d02bbb8 100644
--- a/campaign/include/kurator/campaign/UniqueIdentifier.h
+++ b/universe/include/kurator/universe/UniqueIdentifier.h
@@ -3,7 +3,7 @@
namespace kurator
{
-namespace campaign
+namespace universe
{
@@ -13,5 +13,5 @@ struct UniqueIdentifier
};
-} // namespace campaign
+} // namespace universe
} // namespace kurator