summaryrefslogtreecommitdiff
path: root/sim/src
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2023-01-10 00:22:10 +0100
committerAki <please@ignore.pl>2023-01-10 00:22:10 +0100
commit9d752200d3412eeea70327d8f544877bafc5b6d2 (patch)
tree9f5bfccae71e028213f11f9e0ac7f45cfb20945a /sim/src
parent209648a39c98ccddc622703554912a21c2471531 (diff)
downloadkurator-9d752200d3412eeea70327d8f544877bafc5b6d2.zip
kurator-9d752200d3412eeea70327d8f544877bafc5b6d2.tar.gz
kurator-9d752200d3412eeea70327d8f544877bafc5b6d2.tar.bz2
Moved universe repo initialization to campaign module
Diffstat (limited to 'sim/src')
-rw-r--r--sim/src/BaseBattle.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/sim/src/BaseBattle.cpp b/sim/src/BaseBattle.cpp
index f195181..037a818 100644
--- a/sim/src/BaseBattle.cpp
+++ b/sim/src/BaseBattle.cpp
@@ -12,7 +12,6 @@
#include <kurator/sim/HitPoints.h>
#include <kurator/sim/TurretControl.h>
#include <kurator/stats/events.h>
-#include <kurator/universe.h>
#include <kurator/universe/UniqueIdentifier.h>
#include "Builder.h"
@@ -29,16 +28,14 @@ BaseBattle::BaseBattle(const campaign::Scenario& scenario) :
_registry {},
spawner {scenario.last_team(), scenario.radius, 0.1}
{
- const auto repo = universe::load_json("resources/universe");
Builder build {_registry, spawner};
for (const auto& ship : scenario.ships) {
- const auto entity = build(repo->ship_type(ship.type), ship.team);
+ const auto entity = build(ship.type, ship.team);
_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);
- build(def, entity);
- state.keep_at_range = std::min(state.keep_at_range, def.optimal_range);
+ build(turret_type, entity);
+ state.keep_at_range = std::min(state.keep_at_range, turret_type.optimal_range);
}
manager.add(ship.team, entity); // registry supports on construction events
}