From 49571905c06046a9db0e60e063bf48c92fbb73a9 Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 3 Jan 2023 00:15:11 +0100 Subject: Added rather naive interface for repository iteration --- universe/src/SampleRepository.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'universe/src/SampleRepository.cpp') diff --git a/universe/src/SampleRepository.cpp b/universe/src/SampleRepository.cpp index 0f29073..a81c2bb 100644 --- a/universe/src/SampleRepository.cpp +++ b/universe/src/SampleRepository.cpp @@ -1,8 +1,9 @@ #include "SampleRepository.h" +#include #include #include -#include +#include #include #include @@ -15,14 +16,14 @@ namespace universe { -static const std::unordered_map ships { +static const std::map ships { {"Anvil", {"Anvil", 600.0, 218.0}}, {"Eclipse", {"Eclipse", 600.0, 263.0}}, {"Warbringer", {"Warbringer", 600.0, 336.0}}, }; -static const std::unordered_map turrets { +static const std::map turrets { {"ChargeLaser", {"ChargeLaser", 1, 85.0, 4.5, 0.0, 7000.0, 0.05}}, {"BurstLaser", {"BurstLaser", 3, 21.0, 0.25, 2.75, 3500.0, 0.05}}, {"GaussCannon", {"GaussCannon", 2, 55.0, 0.0, 5.5, 12000.0, 0.2}}, @@ -49,5 +50,21 @@ catch (const std::out_of_range&) { } +void +SampleRepository::for_ship_types(std::function func) const +{ + for (const auto& [_, type] : ships) + func(type); +} + + +void +SampleRepository::for_turret_types(std::function func) const +{ + for (const auto& [_, type] : turrets) + func(type); +} + + } // namespace universe } // namespace kurator -- cgit v1.1