aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/research
diff options
context:
space:
mode:
author zaaarf <me@zaaarf.foo>2023-12-10 23:15:41 +0100
committer zaaarf <me@zaaarf.foo>2023-12-10 23:15:41 +0100
commit4ef33d4df6198e613b0f27406d49978c8ea2fb97 (patch)
tree7f07835485b877f3c01c52c188892499e5812f9b /src/openvic-simulation/research
parent1eb28bd4fb959b69a30013f6438f0257a2ee7b03 (diff)
feat: improved identifier registry macro
Diffstat (limited to 'src/openvic-simulation/research')
-rw-r--r--src/openvic-simulation/research/Invention.cpp2
-rw-r--r--src/openvic-simulation/research/Invention.hpp6
-rw-r--r--src/openvic-simulation/research/Technology.cpp4
-rw-r--r--src/openvic-simulation/research/Technology.hpp14
4 files changed, 5 insertions, 21 deletions
diff --git a/src/openvic-simulation/research/Invention.cpp b/src/openvic-simulation/research/Invention.cpp
index 381a249..f9f3f7b 100644
--- a/src/openvic-simulation/research/Invention.cpp
+++ b/src/openvic-simulation/research/Invention.cpp
@@ -16,8 +16,6 @@ Invention::Invention(
enabled_crimes { std::move(new_enabled_crimes) }, unlock_gas_attack { new_unlock_gas_attack },
unlock_gas_defence { new_unlock_gas_defence } {} //TODO icon
-InventionManager::InventionManager() : inventions { "inventions" } {}
-
bool InventionManager::add_invention(
std::string_view identifier, ModifierValue&& values, bool news, Invention::unit_set_t&& activated_units,
Invention::building_set_t&& activated_buildings, Invention::crime_set_t&& enabled_crimes,
diff --git a/src/openvic-simulation/research/Invention.hpp b/src/openvic-simulation/research/Invention.hpp
index dc4256e..a8ce96d 100644
--- a/src/openvic-simulation/research/Invention.hpp
+++ b/src/openvic-simulation/research/Invention.hpp
@@ -38,19 +38,15 @@ namespace OpenVic {
};
struct InventionManager {
- IdentifierRegistry<Invention> inventions;
+ IdentifierRegistry<Invention> IDENTIFIER_REGISTRY(invention);
public:
- InventionManager();
-
bool add_invention(
std::string_view identifier, ModifierValue&& values, bool news, Invention::unit_set_t&& activated_units,
Invention::building_set_t&& activated_buildings, Invention::crime_set_t&& enabled_crimes, bool unlock_gas_attack,
bool unlock_gas_defence
);
- IDENTIFIER_REGISTRY_ACCESSORS(invention)
-
bool load_inventions_file(
ModifierManager const& modifier_manager, UnitManager const& unit_manager,
BuildingTypeManager const& building_type_manager, CrimeManager const& crime_manager, ast::NodeCPtr root
diff --git a/src/openvic-simulation/research/Technology.cpp b/src/openvic-simulation/research/Technology.cpp
index f8ebb4b..3ba3624 100644
--- a/src/openvic-simulation/research/Technology.cpp
+++ b/src/openvic-simulation/research/Technology.cpp
@@ -19,10 +19,6 @@ Technology::Technology(
TechnologySchool::TechnologySchool(std::string_view new_identifier, ModifierValue&& new_values)
: Modifier { new_identifier, std::move(new_values), 0 } {}
-TechnologyManager::TechnologyManager()
- : technology_folders { "technology folders" }, technology_areas { "technology areas" }, technologies { "technologies" },
- technology_schools { "technology schools" } {}
-
bool TechnologyManager::add_technology_folder(std::string_view identifier) {
if (identifier.empty()) {
Logger::error("Invalid technology folder identifier - empty!");
diff --git a/src/openvic-simulation/research/Technology.hpp b/src/openvic-simulation/research/Technology.hpp
index 52db87e..8489e9b 100644
--- a/src/openvic-simulation/research/Technology.hpp
+++ b/src/openvic-simulation/research/Technology.hpp
@@ -64,28 +64,22 @@ namespace OpenVic {
};
struct TechnologyManager {
- IdentifierRegistry<TechnologyFolder> technology_folders;
- IdentifierRegistry<TechnologyArea> technology_areas;
- IdentifierRegistry<Technology> technologies;
- IdentifierRegistry<TechnologySchool> technology_schools;
+ IdentifierRegistry<TechnologyFolder> IDENTIFIER_REGISTRY(technology_folder);
+ IdentifierRegistry<TechnologyArea> IDENTIFIER_REGISTRY(technology_area);
+ IdentifierRegistry<Technology> IDENTIFIER_REGISTRY_CUSTOM_PLURAL(technology, technologies);
+ IdentifierRegistry<TechnologySchool> IDENTIFIER_REGISTRY(technology_school);
public:
- TechnologyManager();
-
bool add_technology_folder(std::string_view identifier);
- IDENTIFIER_REGISTRY_ACCESSORS(technology_folder)
bool add_technology_area(std::string_view identifier, TechnologyFolder const* folder);
- IDENTIFIER_REGISTRY_ACCESSORS(technology_area)
bool add_technology(
std::string_view identifier, TechnologyArea const* area, Date::year_t year, fixed_point_t cost,
bool unciv_military, uint8_t unit, Technology::unit_set_t&& activated_units,
Technology::building_set_t&& activated_buildings, ModifierValue&& values);
- IDENTIFIER_REGISTRY_ACCESSORS_CUSTOM_PLURAL(technology, technologies)
bool add_technology_school(std::string_view identifier, ModifierValue&& values);
- IDENTIFIER_REGISTRY_ACCESSORS(technology_school)
bool load_technology_file_areas(ast::NodeCPtr root); // common/technology.txt
bool load_technology_file_schools(ModifierManager const& modifier_manager, ast::NodeCPtr root); // also common/technology.txt