diff options
-rw-r--r-- | universe/CMakeLists.txt | 1 | ||||
-rw-r--r-- | universe/include/kurator/universe.h | 1 | ||||
-rw-r--r-- | universe/src/SampleRepository.cpp | 70 | ||||
-rw-r--r-- | universe/src/SampleRepository.h | 28 | ||||
-rw-r--r-- | universe/src/universe.cpp | 8 |
5 files changed, 0 insertions, 108 deletions
diff --git a/universe/CMakeLists.txt b/universe/CMakeLists.txt index b262854..fab238b 100644 --- a/universe/CMakeLists.txt +++ b/universe/CMakeLists.txt @@ -3,7 +3,6 @@ add_library( ${PROJECT_NAME} src/JsonRepository.cpp src/NotFound.cpp - src/SampleRepository.cpp src/TurretType.cpp src/universe.cpp ) diff --git a/universe/include/kurator/universe.h b/universe/include/kurator/universe.h index 6a00804..4d53f16 100644 --- a/universe/include/kurator/universe.h +++ b/universe/include/kurator/universe.h @@ -12,7 +12,6 @@ namespace universe auto load_json(const char* path) -> std::shared_ptr<Repository>; -auto load_sample() -> std::shared_ptr<Repository>; } // namespace universe 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 diff --git a/universe/src/SampleRepository.h b/universe/src/SampleRepository.h deleted file mode 100644 index 769af09..0000000 --- a/universe/src/SampleRepository.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include <functional> -#include <string> - -#include <kurator/universe/Repository.h> -#include <kurator/universe/ShipType.h> -#include <kurator/universe/TurretType.h> - - -namespace kurator -{ -namespace universe -{ - - -class SampleRepository : public Repository -{ -public: - ShipType ship_type(const std::string& id) const override; - TurretType turret_type(const std::string& id) const override; - void for_ship_types(std::function<void(const ShipType&)> func) const; - void for_turret_types(std::function<void(const TurretType&)> func) const; -}; - - -} // namespace universe -} // namespace kurator diff --git a/universe/src/universe.cpp b/universe/src/universe.cpp index 649b553..65bba52 100644 --- a/universe/src/universe.cpp +++ b/universe/src/universe.cpp @@ -5,7 +5,6 @@ #include <kurator/universe/Repository.h> #include "JsonRepository.h" -#include "SampleRepository.h" namespace kurator @@ -21,12 +20,5 @@ load_json(const char* path) } -std::shared_ptr<Repository> -load_sample() -{ - return std::make_shared<SampleRepository>(); -} - - } // namespace universe } // namespace kurator |