-
Notifications
You must be signed in to change notification settings - Fork 8
Update Modifiers dp #399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Update Modifiers dp #399
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,8 +130,11 @@ bool GoodDefinitionManager::load_goods_file(ast::NodeCPtr root) { | |
return ret; | ||
} | ||
|
||
// Must be declared outside of any function for GCC to accept it as a default argument in a lambda function | ||
static constexpr bool HAS_NO_EFFECT = true, HAS_EFFECT = false; | ||
|
||
bool GoodDefinitionManager::generate_modifiers(ModifierManager& modifier_manager) const { | ||
constexpr bool has_no_effect = true; | ||
|
||
using enum ModifierEffect::format_t; | ||
using enum ModifierEffect::target_t; | ||
|
||
|
@@ -142,27 +145,27 @@ bool GoodDefinitionManager::generate_modifiers(ModifierManager& modifier_manager | |
|
||
bool ret = true; | ||
|
||
ret &= modifier_manager.register_complex_modifier("artisan_goods_input"); | ||
ret &= modifier_manager.register_complex_modifier("artisan_goods_output"); | ||
ret &= modifier_manager.register_complex_modifier("artisan_goods_throughput"); | ||
ret &= modifier_manager.register_complex_modifier("rgo_goods_output"); | ||
wvpm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ret &= modifier_manager.register_complex_modifier("rgo_goods_throughput"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is also an rgo_goods_input but that has no effect as rgo's don't have inputs. |
||
ret &= modifier_manager.register_complex_modifier("factory_goods_input"); | ||
ret &= modifier_manager.register_complex_modifier("factory_goods_output"); | ||
ret &= modifier_manager.register_complex_modifier("factory_goods_throughput"); | ||
ret &= modifier_manager.register_complex_modifier("rgo_goods_output"); | ||
ret &= modifier_manager.register_complex_modifier("rgo_goods_throughput"); | ||
ret &= modifier_manager.register_complex_modifier("artisan_goods_input"); | ||
ret &= modifier_manager.register_complex_modifier("artisan_goods_output"); | ||
ret &= modifier_manager.register_complex_modifier("artisan_goods_throughput"); | ||
ret &= modifier_manager.register_complex_modifier("rgo_size"); | ||
|
||
for (GoodDefinition const& good : get_good_definitions()) { | ||
const std::string_view good_identifier = good.get_identifier(); | ||
ModifierEffectCache::good_effects_t& this_good_effects = good_effects[good]; | ||
|
||
const auto good_modifier = [&modifier_manager, &ret, &good_identifier]( | ||
ModifierEffect const*& effect_cache, std::string_view name, bool is_positive_good, | ||
std::string_view localisation_key, bool has_no_effect = false | ||
ModifierEffect const*& effect_cache, std::string_view name, ModifierEffect::format_t format, | ||
std::string_view localisation_key, bool has_no_effect = HAS_EFFECT | ||
) -> void { | ||
ret &= modifier_manager.register_technology_modifier_effect( | ||
effect_cache, ModifierManager::get_flat_identifier(name, good_identifier), is_positive_good, | ||
PROPORTION_DECIMAL, localisation_key, has_no_effect | ||
effect_cache, ModifierManager::get_flat_identifier(name, good_identifier), | ||
format, localisation_key, has_no_effect | ||
); | ||
}; | ||
|
||
|
@@ -173,40 +176,40 @@ bool GoodDefinitionManager::generate_modifiers(ModifierManager& modifier_manager | |
}; | ||
|
||
good_modifier( | ||
this_good_effects.artisan_goods_input, "artisan_goods_input", false, | ||
make_production_localisation_suffix("TECH_INPUT"), has_no_effect | ||
); | ||
good_modifier( | ||
this_good_effects.artisan_goods_output, "artisan_goods_output", true, | ||
make_production_localisation_suffix("TECH_OUTPUT"), has_no_effect | ||
this_good_effects.rgo_goods_output, "rgo_goods_output", FORMAT_x100_1DP_PC_POS, | ||
make_production_localisation_suffix("TECH_OUTPUT") | ||
); | ||
good_modifier( | ||
this_good_effects.artisan_goods_throughput, "artisan_goods_throughput", true, | ||
make_production_localisation_suffix("TECH_THROUGHPUT"), has_no_effect | ||
this_good_effects.rgo_goods_throughput, "rgo_goods_throughput", FORMAT_x100_1DP_PC_POS, | ||
make_production_localisation_suffix("TECH_THROUGHPUT") | ||
); | ||
good_modifier( | ||
this_good_effects.factory_goods_input, "factory_goods_input", false, | ||
this_good_effects.factory_goods_input, "factory_goods_input", FORMAT_x100_1DP_PC_NEG, | ||
make_production_localisation_suffix("TECH_INPUT") | ||
); | ||
good_modifier( | ||
this_good_effects.factory_goods_output, "factory_goods_output", true, | ||
this_good_effects.factory_goods_output, "factory_goods_output", FORMAT_x100_1DP_PC_POS, | ||
make_production_localisation_suffix("TECH_OUTPUT") | ||
); | ||
good_modifier( | ||
this_good_effects.factory_goods_throughput, "factory_goods_throughput", true, | ||
this_good_effects.factory_goods_throughput, "factory_goods_throughput", FORMAT_x100_1DP_PC_POS, | ||
make_production_localisation_suffix("TECH_THROUGHPUT") | ||
); | ||
good_modifier( | ||
this_good_effects.rgo_goods_output, "rgo_goods_output", true, | ||
make_production_localisation_suffix("TECH_OUTPUT") | ||
this_good_effects.artisan_goods_input, "artisan_goods_input", FORMAT_x100_1DP_PC_NEG, | ||
make_production_localisation_suffix("TECH_INPUT"), HAS_NO_EFFECT | ||
); | ||
good_modifier( | ||
this_good_effects.rgo_goods_throughput, "rgo_goods_throughput", true, | ||
make_production_localisation_suffix("TECH_THROUGHPUT") | ||
this_good_effects.artisan_goods_output, "artisan_goods_output", FORMAT_x100_1DP_PC_POS, | ||
make_production_localisation_suffix("TECH_OUTPUT"), HAS_NO_EFFECT | ||
); | ||
good_modifier( | ||
this_good_effects.artisan_goods_throughput, "artisan_goods_throughput", FORMAT_x100_1DP_PC_POS, | ||
make_production_localisation_suffix("TECH_THROUGHPUT"), HAS_NO_EFFECT | ||
); | ||
good_modifier( | ||
this_good_effects.rgo_size, "rgo_size", true, | ||
StringUtils::append_string_views(good_identifier, "_RGO_SIZE") | ||
this_good_effects.rgo_size, "rgo_size", FORMAT_x100_2DP_PC_POS, | ||
StringUtils::append_string_views(good_identifier, "_RGO_SIZE"), HAS_EFFECT | ||
); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -260,10 +260,14 @@ fixed_point_t ResourceGatheringOperation::produce() { | |
} | ||
} | ||
|
||
throughput_multiplier += location.get_modifier_effect_value(*modifier_effect_cache.get_rgo_throughput()) | ||
+ location.get_modifier_effect_value(*modifier_effect_cache.get_local_rgo_throughput()); | ||
output_multiplier += location.get_modifier_effect_value(*modifier_effect_cache.get_rgo_output()) | ||
+ location.get_modifier_effect_value(*modifier_effect_cache.get_local_rgo_output()); | ||
throughput_multiplier += location.get_modifier_effect_value(*modifier_effect_cache.get_local_rgo_throughput()); | ||
output_multiplier += location.get_modifier_effect_value(*modifier_effect_cache.get_local_rgo_output()); | ||
|
||
CountryInstance const* location_owner = location.get_owner(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||
if (location_owner != nullptr) { | ||
throughput_multiplier += location_owner->get_total_rgo_throughput_effect_value(); | ||
output_multiplier += location_owner->get_total_rgo_output_effect_value(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about the rgo_goods_throughput & _output? |
||
} | ||
|
||
if (production_type.get_is_farm_for_tech()) { | ||
const fixed_point_t farm_rgo_throughput_and_output = | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not total if you still have to add the local modifiers....