diff options
Diffstat (limited to 'src/openvic-simulation/economy')
-rw-r--r-- | src/openvic-simulation/economy/production/ProductionType.cpp | 7 | ||||
-rw-r--r-- | src/openvic-simulation/economy/production/ResourceGatheringOperation.cpp | 12 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/openvic-simulation/economy/production/ProductionType.cpp b/src/openvic-simulation/economy/production/ProductionType.cpp index c5db641..033026d 100644 --- a/src/openvic-simulation/economy/production/ProductionType.cpp +++ b/src/openvic-simulation/economy/production/ProductionType.cpp @@ -271,13 +271,18 @@ bool ProductionTypeManager::load_production_types_file( auto parse_node = expect_dictionary_keys( "template", ZERO_OR_ONE, success_callback, /* Already parsed using expect_key in Pass #1 above. */ "bonus", ZERO_OR_MORE, [&bonuses](ast::NodeCPtr bonus_node) -> bool { - ConditionScript trigger { scope_t::STATE, scope_t::NO_SCOPE, scope_t::NO_SCOPE }; + using enum scope_type_t; + + ConditionScript trigger { STATE, NO_SCOPE, NO_SCOPE }; fixed_point_t bonus_value {}; + const bool ret = expect_dictionary_keys( "trigger", ONE_EXACTLY, trigger.expect_script(), "value", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(bonus_value)) )(bonus_node); + bonuses.emplace_back(std::move(trigger), bonus_value); + return ret; }, "owner", ZERO_OR_ONE, _expect_job(good_definition_manager, pop_manager, move_variable_callback(owner)), diff --git a/src/openvic-simulation/economy/production/ResourceGatheringOperation.cpp b/src/openvic-simulation/economy/production/ResourceGatheringOperation.cpp index df91645..70cb64d 100644 --- a/src/openvic-simulation/economy/production/ResourceGatheringOperation.cpp +++ b/src/openvic-simulation/economy/production/ResourceGatheringOperation.cpp @@ -83,12 +83,20 @@ Pop::pop_size_t ResourceGatheringOperation::update_size_and_return_total_worker_ } } } + + fixed_point_t base_size_modifier = fixed_point_t::_1(); + if (production_type.is_farm()) { + base_size_modifier += location.get_modifier_effect_value_nullcheck(modifier_effect_cache.get_farm_rgo_size_local()); + } + if (production_type.is_mine()) { + base_size_modifier += location.get_modifier_effect_value_nullcheck(modifier_effect_cache.get_mine_rgo_size_local()); + } const fixed_point_t base_workforce_size = production_type.get_base_workforce_size(); - if (size_modifier == fixed_point_t::_0()) { + if (base_size_modifier == fixed_point_t::_0()) { size_multiplier = 0; } else { - size_multiplier = ((total_worker_count_in_province / (size_modifier * base_workforce_size)).ceil() * fixed_point_t::_1_50()).floor(); + size_multiplier = ((total_worker_count_in_province / (base_size_modifier * base_workforce_size)).ceil() * fixed_point_t::_1_50()).floor(); } max_employee_count_cache = (size_modifier * size_multiplier * base_workforce_size).floor(); return total_worker_count_in_province; |