diff options
Diffstat (limited to 'src/openvic-simulation/economy/Building.cpp')
-rw-r--r-- | src/openvic-simulation/economy/Building.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/openvic-simulation/economy/Building.cpp b/src/openvic-simulation/economy/Building.cpp index a79741b..39b49ee 100644 --- a/src/openvic-simulation/economy/Building.cpp +++ b/src/openvic-simulation/economy/Building.cpp @@ -207,8 +207,8 @@ bool BuildingManager::add_building(std::string_view identifier, BuildingType con } bool BuildingManager::load_buildings_file( - GoodManager const& good_manager, ProductionTypeManager const& production_type_manager, - ModifierManager const& modifier_manager, ast::NodeCPtr root + GoodManager const& good_manager, ProductionTypeManager const& production_type_manager, ModifierManager& modifier_manager, + ast::NodeCPtr root ) { bool ret = expect_dictionary_reserve_length(buildings, [this](std::string_view, ast::NodeCPtr value) -> bool { return expect_key("type", expect_identifier( @@ -281,6 +281,17 @@ bool BuildingManager::load_buildings_file( )(root); lock_buildings(); + for (Building const& building : buildings.get_items()) { + std::string max_modifier_prefix = "max_"; + std::string min_modifier_prefix = "min_build_"; + modifier_manager.add_modifier_effect( + max_modifier_prefix.append(building.get_identifier()), true, ModifierEffect::format_t::INT + ); + modifier_manager.add_modifier_effect( + min_modifier_prefix.append(building.get_identifier()), false, ModifierEffect::format_t::INT + ); + } + return ret; } |