From 9d752200d3412eeea70327d8f544877bafc5b6d2 Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 10 Jan 2023 00:22:10 +0100 Subject: Moved universe repo initialization to campaign module --- sim/src/BaseBattle.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'sim/src/BaseBattle.cpp') 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 #include #include -#include #include #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(entity, ship.identifier); auto& state = _registry.get(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 } -- cgit v1.1