diff options
author | Aki <please@ignore.pl> | 2023-01-07 15:45:59 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2023-01-07 15:46:30 +0100 |
commit | ace2b0b32b402703ed65f395e8e7b9aa47561f21 (patch) | |
tree | 103d443d35a10c6b8adad9620ce94c3aa3089bd7 /universe/src/SampleRepository.cpp | |
parent | 2e04422f343b83d9a78f06d84a68d3b5097dd2ad (diff) | |
download | kurator-ace2b0b32b402703ed65f395e8e7b9aa47561f21.zip kurator-ace2b0b32b402703ed65f395e8e7b9aa47561f21.tar.gz kurator-ace2b0b32b402703ed65f395e8e7b9aa47561f21.tar.bz2 |
Removed SampleRepository because JsonRepo does everything needed
Diffstat (limited to 'universe/src/SampleRepository.cpp')
-rw-r--r-- | universe/src/SampleRepository.cpp | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/universe/src/SampleRepository.cpp b/universe/src/SampleRepository.cpp deleted file mode 100644 index a81c2bb..0000000 --- a/universe/src/SampleRepository.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "SampleRepository.h" - -#include <functional> -#include <stdexcept> -#include <string> -#include <map> - -#include <kurator/universe/NotFound.h> -#include <kurator/universe/ShipType.h> -#include <kurator/universe/TurretType.h> - - -namespace kurator -{ -namespace universe -{ - - -static const std::map<std::string, ShipType> ships { - {"Anvil", {"Anvil", 600.0, 218.0}}, - {"Eclipse", {"Eclipse", 600.0, 263.0}}, - {"Warbringer", {"Warbringer", 600.0, 336.0}}, -}; - - -static const std::map<std::string, TurretType> 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}}, -}; - - -ShipType -SampleRepository::ship_type(const std::string& id) const -try { - return ships.at(id); -} -catch (const std::out_of_range&) { - throw NotFound(id); -} - - -TurretType -SampleRepository::turret_type(const std::string& id) const -try { - return turrets.at(id); -} -catch (const std::out_of_range&) { - throw NotFound(id); -} - - -void -SampleRepository::for_ship_types(std::function<void(const ShipType&)> func) const -{ - for (const auto& [_, type] : ships) - func(type); -} - - -void -SampleRepository::for_turret_types(std::function<void(const TurretType&)> func) const -{ - for (const auto& [_, type] : turrets) - func(type); -} - - -} // namespace universe -} // namespace kurator |