aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/economy
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-01-03 10:39:50 +0100
committer GitHub <noreply@github.com>2024-01-03 10:39:50 +0100
commita649ccb74bd6ab0b62d26e870dfd509cc8f92b1d (patch)
tree5e73f0930d45d789e899601cfcecce094bbba42b /src/openvic-simulation/economy
parent143a422bc1c27e6d1ebf7e3ead32fff32877797e (diff)
parente067471f55cd11c6cd86920f9486991d6b552726 (diff)
Merge pull request #116 from OpenVicProject/rule-rework
Mutually exclusive rule groups + modded building rules
Diffstat (limited to 'src/openvic-simulation/economy')
-rw-r--r--src/openvic-simulation/economy/BuildingType.cpp2
-rw-r--r--src/openvic-simulation/economy/BuildingType.hpp1
-rw-r--r--src/openvic-simulation/economy/Good.cpp23
3 files changed, 14 insertions, 12 deletions
diff --git a/src/openvic-simulation/economy/BuildingType.cpp b/src/openvic-simulation/economy/BuildingType.cpp
index c11933f..c9ed410 100644
--- a/src/openvic-simulation/economy/BuildingType.cpp
+++ b/src/openvic-simulation/economy/BuildingType.cpp
@@ -22,6 +22,8 @@ bool BuildingTypeManager::add_building_type(std::string_view identifier, ARGS) {
return false;
}
+ building_type_types.emplace(type);
+
return building_types.add_item({
identifier, type, std::move(modifier), on_completion, completion_size, max_level, std::move(goods_cost),
cost, build_time, visibility, on_map, default_enabled, production_type, pop_build_factory, strategic_factory,
diff --git a/src/openvic-simulation/economy/BuildingType.hpp b/src/openvic-simulation/economy/BuildingType.hpp
index b1eb6f8..d751ff1 100644
--- a/src/openvic-simulation/economy/BuildingType.hpp
+++ b/src/openvic-simulation/economy/BuildingType.hpp
@@ -74,6 +74,7 @@ namespace OpenVic {
private:
IdentifierRegistry<BuildingType> IDENTIFIER_REGISTRY(building_type);
+ string_set_t PROPERTY(building_type_types);
std::vector<BuildingType const*> PROPERTY(province_building_types);
BuildingType const* PROPERTY(port_building_type);
diff --git a/src/openvic-simulation/economy/Good.cpp b/src/openvic-simulation/economy/Good.cpp
index 3b420f1..2170666 100644
--- a/src/openvic-simulation/economy/Good.cpp
+++ b/src/openvic-simulation/economy/Good.cpp
@@ -93,25 +93,24 @@ bool GoodManager::load_goods_file(ast::NodeCPtr root) {
bool GoodManager::generate_modifiers(ModifierManager& modifier_manager) const {
bool ret = true;
- const auto good_modifier = [this, &modifier_manager, &ret](std::string_view name) -> void {
+ const auto good_modifier = [this, &modifier_manager, &ret](std::string_view name, bool positive_good) -> void {
ret &= modifier_manager.register_complex_modifier(name);
for (Good const& good : get_goods()) {
ret &= modifier_manager.add_modifier_effect(
- StringUtils::append_string_views(name, "_", good.get_identifier()), true
+ StringUtils::append_string_views(name, "_", good.get_identifier()), positive_good
);
}
};
- good_modifier("artisan_goods_input");
- good_modifier("artisan_goods_output");
- good_modifier("artisan_goods_throughput");
- good_modifier("factory_goods_input");
- good_modifier("factory_goods_output");
- good_modifier("factory_goods_throughput");
- good_modifier("rgo_goods_input");
- good_modifier("rgo_goods_output");
- good_modifier("rgo_goods_throughput");
- good_modifier("rgo_size");
+ good_modifier("artisan_goods_input", false);
+ good_modifier("artisan_goods_output", true);
+ good_modifier("artisan_goods_throughput", true);
+ good_modifier("factory_goods_input", false);
+ good_modifier("factory_goods_output", true);
+ good_modifier("factory_goods_throughput", true);
+ good_modifier("rgo_goods_output", true);
+ good_modifier("rgo_goods_throughput", true);
+ good_modifier("rgo_size", true);
return ret;
}