aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/economy
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/economy
parent1eb28bd4fb959b69a30013f6438f0257a2ee7b03 (diff)
feat: improved identifier registry macro
Diffstat (limited to 'src/openvic-simulation/economy')
-rw-r--r--src/openvic-simulation/economy/BuildingType.cpp2
-rw-r--r--src/openvic-simulation/economy/BuildingType.hpp5
-rw-r--r--src/openvic-simulation/economy/Good.cpp2
-rw-r--r--src/openvic-simulation/economy/Good.hpp8
-rw-r--r--src/openvic-simulation/economy/ProductionType.cpp2
-rw-r--r--src/openvic-simulation/economy/ProductionType.hpp3
6 files changed, 5 insertions, 17 deletions
diff --git a/src/openvic-simulation/economy/BuildingType.cpp b/src/openvic-simulation/economy/BuildingType.cpp
index 876afd9..a5a4fb0 100644
--- a/src/openvic-simulation/economy/BuildingType.cpp
+++ b/src/openvic-simulation/economy/BuildingType.cpp
@@ -14,8 +14,6 @@ BuildingType::BuildingType(
colonial_range { colonial_range }, infrastructure { infrastructure }, spawn_railway_track { spawn_railway_track },
sail { sail }, steam { steam }, capital { capital }, port { port } {}
-BuildingTypeManager::BuildingTypeManager() : building_types { "building types" } {}
-
bool BuildingTypeManager::add_building_type(std::string_view identifier, ARGS) {
if (identifier.empty()) {
Logger::error("Invalid building identifier - empty!");
diff --git a/src/openvic-simulation/economy/BuildingType.hpp b/src/openvic-simulation/economy/BuildingType.hpp
index deba77a..a8f9d61 100644
--- a/src/openvic-simulation/economy/BuildingType.hpp
+++ b/src/openvic-simulation/economy/BuildingType.hpp
@@ -73,13 +73,10 @@ namespace OpenVic {
using level_t = BuildingType::level_t; // this is getting ridiculous
private:
- IdentifierRegistry<BuildingType> building_types;
+ IdentifierRegistry<BuildingType> IDENTIFIER_REGISTRY(building_type);
public:
- BuildingTypeManager();
-
bool add_building_type(std::string_view identifier, ARGS);
- IDENTIFIER_REGISTRY_ACCESSORS(building_type)
bool load_buildings_file(
GoodManager const& good_manager, ProductionTypeManager const& production_type_manager,
diff --git a/src/openvic-simulation/economy/Good.cpp b/src/openvic-simulation/economy/Good.cpp
index ac3c8c7..5500483 100644
--- a/src/openvic-simulation/economy/Good.cpp
+++ b/src/openvic-simulation/economy/Good.cpp
@@ -21,8 +21,6 @@ void Good::reset_to_defaults() {
price = base_price;
}
-GoodManager::GoodManager() : good_categories { "good categories" }, goods { "goods" } {}
-
bool GoodManager::add_good_category(std::string_view identifier) {
if (identifier.empty()) {
Logger::error("Invalid good category identifier - empty!");
diff --git a/src/openvic-simulation/economy/Good.hpp b/src/openvic-simulation/economy/Good.hpp
index 1537514..c595768 100644
--- a/src/openvic-simulation/economy/Good.hpp
+++ b/src/openvic-simulation/economy/Good.hpp
@@ -63,20 +63,16 @@ namespace OpenVic {
struct GoodManager {
private:
- IdentifierRegistry<GoodCategory> good_categories;
- IdentifierRegistry<Good> goods;
+ IdentifierRegistry<GoodCategory> IDENTIFIER_REGISTRY_CUSTOM_PLURAL(good_category, good_categories);
+ IdentifierRegistry<Good> IDENTIFIER_REGISTRY(good);
public:
- GoodManager();
-
bool add_good_category(std::string_view identifier);
- IDENTIFIER_REGISTRY_ACCESSORS_CUSTOM_PLURAL(good_category, good_categories)
bool add_good(
std::string_view identifier, colour_t colour, GoodCategory const& category, Good::price_t base_price,
bool available_from_start, bool tradeable, bool money, bool overseas_penalty
);
- IDENTIFIER_REGISTRY_ACCESSORS(good)
void reset_to_defaults();
bool load_goods_file(ast::NodeCPtr root);
diff --git a/src/openvic-simulation/economy/ProductionType.cpp b/src/openvic-simulation/economy/ProductionType.cpp
index d0b90fa..a19b7bf 100644
--- a/src/openvic-simulation/economy/ProductionType.cpp
+++ b/src/openvic-simulation/economy/ProductionType.cpp
@@ -14,7 +14,7 @@ ProductionType::ProductionType(
input_goods { std::move(input_goods) }, output_goods { output_goods }, value { value }, bonuses { std::move(bonuses) },
efficiency { std::move(efficiency) }, coastal { coastal }, farm { farm }, mine { mine } {}
-ProductionTypeManager::ProductionTypeManager() : production_types { "production types" }, rgo_owner_sprite { 0 } {}
+ProductionTypeManager::ProductionTypeManager() : rgo_owner_sprite { 0 } {}
node_callback_t ProductionTypeManager::_expect_employed_pop(
GoodManager const& good_manager, PopManager const& pop_manager, callback_t<EmployedPop&&> cb
diff --git a/src/openvic-simulation/economy/ProductionType.hpp b/src/openvic-simulation/economy/ProductionType.hpp
index bce3698..4fdceda 100644
--- a/src/openvic-simulation/economy/ProductionType.hpp
+++ b/src/openvic-simulation/economy/ProductionType.hpp
@@ -66,7 +66,7 @@ namespace OpenVic {
struct ProductionTypeManager {
private:
- IdentifierRegistry<ProductionType> production_types;
+ IdentifierRegistry<ProductionType> IDENTIFIER_REGISTRY(production_type);
PopType::sprite_t PROPERTY(rgo_owner_sprite);
NodeTools::node_callback_t _expect_employed_pop(
@@ -81,7 +81,6 @@ namespace OpenVic {
ProductionTypeManager();
bool add_production_type(PRODUCTION_TYPE_ARGS);
- IDENTIFIER_REGISTRY_ACCESSORS(production_type)
bool load_production_types_file(GoodManager const& good_manager, PopManager const& pop_manager, ast::NodeCPtr root);
};