diff options
author | Aki <please@ignore.pl> | 2023-01-10 00:22:10 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2023-01-10 00:22:10 +0100 |
commit | 9d752200d3412eeea70327d8f544877bafc5b6d2 (patch) | |
tree | 9f5bfccae71e028213f11f9e0ac7f45cfb20945a /campaign | |
parent | 209648a39c98ccddc622703554912a21c2471531 (diff) | |
download | kurator-9d752200d3412eeea70327d8f544877bafc5b6d2.zip kurator-9d752200d3412eeea70327d8f544877bafc5b6d2.tar.gz kurator-9d752200d3412eeea70327d8f544877bafc5b6d2.tar.bz2 |
Moved universe repo initialization to campaign module
Diffstat (limited to 'campaign')
-rw-r--r-- | campaign/include/kurator/campaign/ShipConfig.h | 6 | ||||
-rw-r--r-- | campaign/src/scenarios.cpp | 14 |
2 files changed, 15 insertions, 5 deletions
diff --git a/campaign/include/kurator/campaign/ShipConfig.h b/campaign/include/kurator/campaign/ShipConfig.h index e10251b..c8ee449 100644 --- a/campaign/include/kurator/campaign/ShipConfig.h +++ b/campaign/include/kurator/campaign/ShipConfig.h @@ -3,6 +3,8 @@ #include <string> #include <vector> +#include <kurator/universe/ShipType.h> +#include <kurator/universe/TurretType.h> #include <kurator/universe/UniqueIdentifier.h> @@ -16,8 +18,8 @@ struct ShipConfig { universe::UniqueIdentifier identifier; int team; - std::string type; - std::vector<std::string> turrets; + universe::ShipType type; + std::vector<universe::TurretType> turrets; }; diff --git a/campaign/src/scenarios.cpp b/campaign/src/scenarios.cpp index 979128b..dbd1f73 100644 --- a/campaign/src/scenarios.cpp +++ b/campaign/src/scenarios.cpp @@ -2,6 +2,7 @@ #include <kurator/campaign/Scenario.h> #include <kurator/campaign/ShipConfig.h> +#include <kurator/universe.h> namespace kurator @@ -16,14 +17,21 @@ Scenario example(int teams, int anvils, int warbringers, int eclipses, double distance) { int id = 0; + const auto repo = universe::load_json("resources/universe"); + const auto anvil = repo->ship_type("Anvil"); + const auto eclipse = repo->ship_type("Eclipse"); + const auto warbringer = repo->ship_type("Warbringer"); + const auto burst_laser = repo->turret_type("BurstLaser"); + const auto charge_laser = repo->turret_type("ChargeLaser"); + const auto gauss_cannon = repo->turret_type("GaussCannon"); Scenario scenario {"Example", distance, {}}; for (int team = 0; team < teams; ++team) { for (int i = 0; i < anvils; ++i) - scenario.ships.push_back(ShipConfig{{id++}, team, "Anvil", {"ChargeLaser", "GaussCannon"}}); + scenario.ships.push_back(ShipConfig{{id++}, team, anvil, {charge_laser, gauss_cannon}}); for (int i = 0; i < warbringers; ++i) - scenario.ships.push_back(ShipConfig{{id++}, team, "Warbringer", {"BurstLaser"}}); + scenario.ships.push_back(ShipConfig{{id++}, team, warbringer, {burst_laser}}); for (int i = 0; i < eclipses; ++i) - scenario.ships.push_back(ShipConfig{{id++}, team, "Eclipse", {"ChargeLaser"}}); + scenario.ships.push_back(ShipConfig{{id++}, team, eclipse, {charge_laser}}); } return scenario; } |