summaryrefslogtreecommitdiff
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
parent2f7d5c306430d65d18eac184551bac8937877d49 (diff)
downloadkurator-13e4f3e3908220d484b01b9fb6dc4375ab28a16e.zip
kurator-13e4f3e3908220d484b01b9fb6dc4375ab28a16e.tar.gz
kurator-13e4f3e3908220d484b01b9fb6dc4375ab28a16e.tar.bz2
Extracted Scenario and related things into own campaign module
-rw-r--r--CMakeLists.txt1
-rw-r--r--campaign/CMakeLists.txt14
-rw-r--r--campaign/include/kurator/campaign/Scenario.h (renamed from sim/include/kurator/sim/Scenario.h)4
-rw-r--r--campaign/include/kurator/campaign/ShipConfig.h (renamed from sim/include/kurator/sim/ShipConfig.h)4
-rw-r--r--campaign/include/kurator/campaign/scenarios.h (renamed from sim/include/kurator/sim/scenarios.h)4
-rw-r--r--campaign/src/Scenario.cpp (renamed from sim/src/Scenario.cpp)6
-rw-r--r--campaign/src/scenarios.cpp (renamed from sim/src/scenarios.cpp)8
-rw-r--r--kurator/CMakeLists.txt1
-rw-r--r--kurator/src/Battle.cpp4
-rw-r--r--sim/CMakeLists.txt3
-rw-r--r--sim/include/kurator/sim/Battle.h4
-rw-r--r--sim/src/BaseBattle.cpp4
-rw-r--r--sim/src/BaseBattle.h4
-rw-r--r--sim/src/Battle.cpp4
14 files changed, 40 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3b0e4aa..80264a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,7 @@ set(CMAKE_CXX_EXTENSIONS No)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
find_package(EnTT 3 REQUIRED)
find_package(raylib 4 REQUIRED)
+add_subdirectory(campaign)
add_subdirectory(kurator)
add_subdirectory(sim)
add_subdirectory(universe)
diff --git a/campaign/CMakeLists.txt b/campaign/CMakeLists.txt
new file mode 100644
index 0000000..ca2663a
--- /dev/null
+++ b/campaign/CMakeLists.txt
@@ -0,0 +1,14 @@
+project(campaign)
+add_library(
+ ${PROJECT_NAME}
+ src/Scenario.cpp
+ src/scenarios.cpp
+)
+target_include_directories(
+ ${PROJECT_NAME}
+ PUBLIC include
+)
+target_link_libraries(
+ ${PROJECT_NAME}
+ PUBLIC universe
+)
diff --git a/sim/include/kurator/sim/Scenario.h b/campaign/include/kurator/campaign/Scenario.h
index b037365..23647fc 100644
--- a/sim/include/kurator/sim/Scenario.h
+++ b/campaign/include/kurator/campaign/Scenario.h
@@ -8,7 +8,7 @@
namespace kurator
{
-namespace sim
+namespace campaign
{
@@ -20,5 +20,5 @@ struct Scenario
};
-} // namespace sim
+} // namespace campaign
} // namespace kurator
diff --git a/sim/include/kurator/sim/ShipConfig.h b/campaign/include/kurator/campaign/ShipConfig.h
index bb089ac..cb5ca48 100644
--- a/sim/include/kurator/sim/ShipConfig.h
+++ b/campaign/include/kurator/campaign/ShipConfig.h
@@ -6,7 +6,7 @@
namespace kurator
{
-namespace sim
+namespace campaign
{
@@ -18,5 +18,5 @@ struct ShipConfig
};
-} // namespace sim
+} // namespace campaign
} // namespace kurator
diff --git a/sim/include/kurator/sim/scenarios.h b/campaign/include/kurator/campaign/scenarios.h
index d22b62a..cdc1e19 100644
--- a/sim/include/kurator/sim/scenarios.h
+++ b/campaign/include/kurator/campaign/scenarios.h
@@ -5,7 +5,7 @@
namespace kurator
{
-namespace sim
+namespace campaign
{
namespace scenarios
{
@@ -15,5 +15,5 @@ Scenario example();
} // namespace scenarios
-} // namespace sim
+} // namespace campaign
} // namespace kurator
diff --git a/sim/src/Scenario.cpp b/campaign/src/Scenario.cpp
index 49201c3..cd5a1c6 100644
--- a/sim/src/Scenario.cpp
+++ b/campaign/src/Scenario.cpp
@@ -1,9 +1,9 @@
-#include <kurator/sim/Scenario.h>
+#include <kurator/campaign/Scenario.h>
namespace kurator
{
-namespace sim
+namespace campaign
{
@@ -19,5 +19,5 @@ Scenario::total_teams() const
}
-} // namespace sim
+} // namespace campaign
} // namespace kurator
diff --git a/sim/src/scenarios.cpp b/campaign/src/scenarios.cpp
index 65588bf..06b4659 100644
--- a/sim/src/scenarios.cpp
+++ b/campaign/src/scenarios.cpp
@@ -1,11 +1,11 @@
-#include <kurator/sim/scenarios.h>
+#include <kurator/campaign/scenarios.h>
-#include <kurator/sim/Scenario.h>
+#include <kurator/campaign/Scenario.h>
namespace kurator
{
-namespace sim
+namespace campaign
{
namespace scenarios
{
@@ -39,5 +39,5 @@ example()
} // namespace scenarios
-} // namespace sim
+} // namespace campaign
} // namespace kurator
diff --git a/kurator/CMakeLists.txt b/kurator/CMakeLists.txt
index 58a1e0c..0dc7720 100644
--- a/kurator/CMakeLists.txt
+++ b/kurator/CMakeLists.txt
@@ -11,6 +11,7 @@ add_executable(
target_link_libraries(
${PROJECT_NAME}
PRIVATE raylib
+ PRIVATE campaign
PRIVATE sim
PRIVATE universe
)
diff --git a/kurator/src/Battle.cpp b/kurator/src/Battle.cpp
index 81f74fd..9d6d6c5 100644
--- a/kurator/src/Battle.cpp
+++ b/kurator/src/Battle.cpp
@@ -8,11 +8,11 @@
#include <raylib.h>
+#include <kurator/campaign/scenarios.h>
#include <kurator/sim/Battle.h>
#include <kurator/sim/components.h>
#include <kurator/sim/events.h>
#include <kurator/sim/Point.h>
-#include <kurator/sim/scenarios.h>
#include <kurator/universe/ShipType.h>
#include "components.h"
@@ -26,7 +26,7 @@ namespace kurator
Battle::Battle(std::shared_ptr<Session> _session) :
session {std::move(_session)},
- battle {sim::prepare(sim::scenarios::example())}
+ battle {sim::prepare(campaign::scenarios::example())}
{
battle->dispatcher().sink<sim::Hit>().connect<&Battle::receive>(*this);
auto& registry = battle->registry();
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/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);
}