diff options
Diffstat (limited to 'campaign')
-rw-r--r-- | campaign/include/kurator/campaign/Loadout.h | 23 | ||||
-rw-r--r-- | campaign/include/kurator/campaign/ShipConfig.h | 7 | ||||
-rw-r--r-- | campaign/src/scenarios.cpp | 15 |
3 files changed, 33 insertions, 12 deletions
diff --git a/campaign/include/kurator/campaign/Loadout.h b/campaign/include/kurator/campaign/Loadout.h new file mode 100644 index 0000000..e528fd9 --- /dev/null +++ b/campaign/include/kurator/campaign/Loadout.h @@ -0,0 +1,23 @@ +#pragma once + +#include <vector> + +#include <kurator/universe/ShipType.h> +#include <kurator/universe/TurretType.h> + + +namespace kurator +{ +namespace campaign +{ + + +struct Loadout +{ + universe::ShipType type; + std::vector<universe::TurretType> turrets; +}; + + +} // namespace campaign +} // namespace kurator diff --git a/campaign/include/kurator/campaign/ShipConfig.h b/campaign/include/kurator/campaign/ShipConfig.h index c8ee449..d596206 100644 --- a/campaign/include/kurator/campaign/ShipConfig.h +++ b/campaign/include/kurator/campaign/ShipConfig.h @@ -3,10 +3,10 @@ #include <string> #include <vector> -#include <kurator/universe/ShipType.h> -#include <kurator/universe/TurretType.h> #include <kurator/universe/UniqueIdentifier.h> +#include "Loadout.h" + namespace kurator { @@ -18,8 +18,7 @@ struct ShipConfig { universe::UniqueIdentifier identifier; int team; - universe::ShipType type; - std::vector<universe::TurretType> turrets; + Loadout loadout; }; diff --git a/campaign/src/scenarios.cpp b/campaign/src/scenarios.cpp index dbd1f73..f32943f 100644 --- a/campaign/src/scenarios.cpp +++ b/campaign/src/scenarios.cpp @@ -1,5 +1,6 @@ #include <kurator/campaign/scenarios.h> +#include <kurator/campaign/Loadout.h> #include <kurator/campaign/Scenario.h> #include <kurator/campaign/ShipConfig.h> #include <kurator/universe.h> @@ -18,20 +19,18 @@ 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"); + const Loadout anvil{repo->ship_type("Anvil"), {charge_laser, repo->turret_type("GaussCannon")}}; + const Loadout eclipse{repo->ship_type("Eclipse"), {charge_laser}}; + const Loadout warbringer{repo->ship_type("Warbringer"), {repo->turret_type("BurstLaser")}}; 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, {charge_laser, gauss_cannon}}); + scenario.ships.push_back(ShipConfig{{id++}, team, anvil}); for (int i = 0; i < warbringers; ++i) - scenario.ships.push_back(ShipConfig{{id++}, team, warbringer, {burst_laser}}); + scenario.ships.push_back(ShipConfig{{id++}, team, warbringer}); for (int i = 0; i < eclipses; ++i) - scenario.ships.push_back(ShipConfig{{id++}, team, eclipse, {charge_laser}}); + scenario.ships.push_back(ShipConfig{{id++}, team, eclipse}); } return scenario; } |