From fb6b9439c219239691eb0201ec3f431b5dfe4893 Mon Sep 17 00:00:00 2001 From: hop311 Date: Sun, 22 Sep 2024 18:09:37 +0100 Subject: Make ModifierEffect format argument mandatory --- src/openvic-simulation/modifier/Modifier.cpp | 108 +++++++++++++-------------- src/openvic-simulation/modifier/Modifier.hpp | 2 +- src/openvic-simulation/pop/Pop.cpp | 2 +- 3 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/openvic-simulation/modifier/Modifier.cpp b/src/openvic-simulation/modifier/Modifier.cpp index ec4aa08..10e32a4 100644 --- a/src/openvic-simulation/modifier/Modifier.cpp +++ b/src/openvic-simulation/modifier/Modifier.cpp @@ -160,7 +160,7 @@ bool ModifierManager::setup_modifier_effects() { using enum ModifierEffect::format_t; /* Tech/inventions only */ ret &= add_modifier_effect("cb_creation_speed", true, PROPORTION_DECIMAL, "CB_MANUFACTURE_TECH"); - ret &= add_modifier_effect("combat_width", false); + ret &= add_modifier_effect("combat_width", false, PROPORTION_DECIMAL); ret &= add_modifier_effect("plurality", true, PERCENTAGE_DECIMAL, "TECH_PLURALITY"); ret &= add_modifier_effect("pop_growth", true, PROPORTION_DECIMAL, "TECH_POP_GROWTH"); ret &= add_modifier_effect("regular_experience_level", true, RAW_DECIMAL, "REGULAR_EXP_TECH"); @@ -170,16 +170,16 @@ bool ModifierManager::setup_modifier_effects() { ret &= add_modifier_effect("tax_eff", true, PROPORTION_DECIMAL, "TECH_TAX_EFF"); /* Country Modifier Effects */ - ret &= add_modifier_effect("administrative_efficiency", true); + ret &= add_modifier_effect("administrative_efficiency", true, PROPORTION_DECIMAL); ret &= add_modifier_effect( "administrative_efficiency_modifier", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("administrative_efficiency") ); - ret &= add_modifier_effect("artisan_input", false); - ret &= add_modifier_effect("artisan_output", true); - ret &= add_modifier_effect("artisan_throughput", true); + ret &= add_modifier_effect("artisan_input", false, PROPORTION_DECIMAL); + ret &= add_modifier_effect("artisan_output", true, PROPORTION_DECIMAL); + ret &= add_modifier_effect("artisan_throughput", true, PROPORTION_DECIMAL); ret &= add_modifier_effect("badboy", false, RAW_DECIMAL); - ret &= add_modifier_effect("cb_generation_speed_modifier", true); + ret &= add_modifier_effect("cb_generation_speed_modifier", true, PROPORTION_DECIMAL); ret &= add_modifier_effect( "civilization_progress_modifier", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("civilization_progress") @@ -196,17 +196,17 @@ bool ModifierManager::setup_modifier_effects() { "diplomatic_points_modifier", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("diplopoints_gain") ); - ret &= add_modifier_effect("education_efficiency", true); + ret &= add_modifier_effect("education_efficiency", true, PROPORTION_DECIMAL); ret &= add_modifier_effect( "education_efficiency_modifier", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("education_efficiency") ); - ret &= add_modifier_effect("factory_cost", false); - ret &= add_modifier_effect("factory_input", false); - ret &= add_modifier_effect("factory_maintenance", false); - ret &= add_modifier_effect("factory_output", true); - ret &= add_modifier_effect("factory_owner_cost", false); - ret &= add_modifier_effect("factory_throughput", true); + ret &= add_modifier_effect("factory_cost", false, PROPORTION_DECIMAL); + ret &= add_modifier_effect("factory_input", false, PROPORTION_DECIMAL); + ret &= add_modifier_effect("factory_maintenance", false, PROPORTION_DECIMAL); + ret &= add_modifier_effect("factory_output", true, PROPORTION_DECIMAL); + ret &= add_modifier_effect("factory_owner_cost", false, PROPORTION_DECIMAL); + ret &= add_modifier_effect("factory_throughput", true, PROPORTION_DECIMAL); ret &= add_modifier_effect( "global_assimilation_rate", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("assimilation_rate") @@ -221,15 +221,15 @@ bool ModifierManager::setup_modifier_effects() { "global_population_growth", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("population_growth") ); - ret &= add_modifier_effect("goods_demand", false); - ret &= add_modifier_effect("import_cost", false); + ret &= add_modifier_effect("goods_demand", false, PROPORTION_DECIMAL); + ret &= add_modifier_effect("import_cost", false, PROPORTION_DECIMAL); ret &= add_modifier_effect("increase_research", true, PROPORTION_DECIMAL, "INC_RES_TECH"); ret &= add_modifier_effect("influence", true, PROPORTION_DECIMAL, "TECH_GP_INFLUENCE"); ret &= add_modifier_effect( "influence_modifier", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("greatpower_influence_gain") ); - ret &= add_modifier_effect("issue_change_speed", true); + ret &= add_modifier_effect("issue_change_speed", true, PROPORTION_DECIMAL); ret &= add_modifier_effect( "land_attack_modifier", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("land_attack") ); @@ -237,35 +237,35 @@ bool ModifierManager::setup_modifier_effects() { ret &= add_modifier_effect( "land_defense_modifier", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("land_defense") ); - ret &= add_modifier_effect("land_organisation", true); + ret &= add_modifier_effect("land_organisation", true, PROPORTION_DECIMAL); ret &= add_modifier_effect("land_unit_start_experience", true, RAW_DECIMAL); ret &= add_modifier_effect("leadership", true, RAW_DECIMAL, "LEADERSHIP"); ret &= add_modifier_effect( "leadership_modifier", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("global_leadership_modifier") ); - ret &= add_modifier_effect("literacy_con_impact", false); - ret &= add_modifier_effect("loan_interest", false); + ret &= add_modifier_effect("literacy_con_impact", false, PROPORTION_DECIMAL); + ret &= add_modifier_effect("loan_interest", false, PROPORTION_DECIMAL); ret &= add_modifier_effect( "max_loan_modifier", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("max_loan_amount") ); - ret &= add_modifier_effect("max_military_spending", true); + ret &= add_modifier_effect("max_military_spending", true, PROPORTION_DECIMAL); ret &= add_modifier_effect("max_national_focus", true, INT, "TECH_MAX_FOCUS"); - ret &= add_modifier_effect("max_social_spending", true); - ret &= add_modifier_effect("max_tariff", true); - ret &= add_modifier_effect("max_tax", true); + ret &= add_modifier_effect("max_social_spending", true, PROPORTION_DECIMAL); + ret &= add_modifier_effect("max_tariff", true, PROPORTION_DECIMAL); + ret &= add_modifier_effect("max_tax", true, PROPORTION_DECIMAL); ret &= add_modifier_effect("max_war_exhaustion", true, PERCENTAGE_DECIMAL, "MAX_WAR_EXHAUSTION"); ret &= add_modifier_effect("military_tactics", true, PROPORTION_DECIMAL, "MIL_TACTICS_TECH"); - ret &= add_modifier_effect("min_military_spending", true); - ret &= add_modifier_effect("min_social_spending", true); - ret &= add_modifier_effect("min_tariff", true); - ret &= add_modifier_effect("min_tax", true); + ret &= add_modifier_effect("min_military_spending", true, PROPORTION_DECIMAL); + ret &= add_modifier_effect("min_social_spending", true, PROPORTION_DECIMAL); + ret &= add_modifier_effect("min_tariff", true, PROPORTION_DECIMAL); + ret &= add_modifier_effect("min_tax", true, PROPORTION_DECIMAL); ret &= add_modifier_effect( "minimum_wage", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("minimun_wage") ); - ret &= add_modifier_effect("mobilisation_economy_impact", false); - ret &= add_modifier_effect("mobilisation_size", true); - ret &= add_modifier_effect("mobilization_impact", false); + ret &= add_modifier_effect("mobilisation_economy_impact", false, PROPORTION_DECIMAL); + ret &= add_modifier_effect("mobilisation_size", true, PROPORTION_DECIMAL); + ret &= add_modifier_effect("mobilization_impact", false, PROPORTION_DECIMAL); ret &= add_modifier_effect( "naval_attack_modifier", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("naval_attack") ); @@ -273,23 +273,23 @@ bool ModifierManager::setup_modifier_effects() { ret &= add_modifier_effect( "naval_defense_modifier", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("naval_defense") ); - ret &= add_modifier_effect("naval_organisation", true); + ret &= add_modifier_effect("naval_organisation", true, PROPORTION_DECIMAL); ret &= add_modifier_effect("naval_unit_start_experience", true, RAW_DECIMAL); ret &= add_modifier_effect("non_accepted_pop_consciousness_modifier", false, RAW_DECIMAL); ret &= add_modifier_effect("non_accepted_pop_militancy_modifier", false, RAW_DECIMAL); - ret &= add_modifier_effect("org_regain", true); - ret &= add_modifier_effect("pension_level", true); + ret &= add_modifier_effect("org_regain", true, PROPORTION_DECIMAL); + ret &= add_modifier_effect("pension_level", true, PROPORTION_DECIMAL); ret &= add_modifier_effect("permanent_prestige", true, RAW_DECIMAL, "PERMANENT_PRESTIGE_TECH"); - ret &= add_modifier_effect("political_reform_desire", false); - ret &= add_modifier_effect("poor_savings_modifier", true); + ret &= add_modifier_effect("political_reform_desire", false, PROPORTION_DECIMAL); + ret &= add_modifier_effect("poor_savings_modifier", true, PROPORTION_DECIMAL); ret &= add_modifier_effect("prestige", true, RAW_DECIMAL); - ret &= add_modifier_effect("reinforce_speed", true); + ret &= add_modifier_effect("reinforce_speed", true, PROPORTION_DECIMAL); ret &= add_modifier_effect("research_points", true, RAW_DECIMAL); - ret &= add_modifier_effect("research_points_modifier", true); - ret &= add_modifier_effect("research_points_on_conquer", true); - ret &= add_modifier_effect("rgo_output", true); - ret &= add_modifier_effect("rgo_throughput", true); - ret &= add_modifier_effect("ruling_party_support", true); + ret &= add_modifier_effect("research_points_modifier", true, PROPORTION_DECIMAL); + ret &= add_modifier_effect("research_points_on_conquer", true, PROPORTION_DECIMAL); + ret &= add_modifier_effect("rgo_output", true, PROPORTION_DECIMAL); + ret &= add_modifier_effect("rgo_throughput", true, PROPORTION_DECIMAL); + ret &= add_modifier_effect("ruling_party_support", true, PROPORTION_DECIMAL); ret &= add_modifier_effect( "self_unciv_economic_modifier", false, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("self_unciv_economic") @@ -298,29 +298,29 @@ bool ModifierManager::setup_modifier_effects() { "self_unciv_military_modifier", false, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("self_unciv_military") ); - ret &= add_modifier_effect("social_reform_desire", false); + ret &= add_modifier_effect("social_reform_desire", false, PROPORTION_DECIMAL); ret &= add_modifier_effect("soldier_to_pop_loss", true, PROPORTION_DECIMAL, "SOLDIER_TO_POP_LOSS_TECH"); - ret &= add_modifier_effect("supply_consumption", false); + ret &= add_modifier_effect("supply_consumption", false, PROPORTION_DECIMAL); ret &= add_modifier_effect("supply_range", true, PROPORTION_DECIMAL, "SUPPLY_RANGE_TECH"); ret &= add_modifier_effect("suppression_points_modifier", true, PROPORTION_DECIMAL, "SUPPRESSION_TECH"); ret &= add_modifier_effect( "tariff_efficiency_modifier", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("tariff_efficiency") ); - ret &= add_modifier_effect("tax_efficiency", true); - ret &= add_modifier_effect("unemployment_benefit", true); + ret &= add_modifier_effect("tax_efficiency", true, PROPORTION_DECIMAL); + ret &= add_modifier_effect("unemployment_benefit", true, PROPORTION_DECIMAL); ret &= add_modifier_effect( "unciv_economic_modifier", false, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("unciv_economic") ); ret &= add_modifier_effect( "unciv_military_modifier", false, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("unciv_military") ); - ret &= add_modifier_effect("unit_recruitment_time", false); + ret &= add_modifier_effect("unit_recruitment_time", false, PROPORTION_DECIMAL); ret &= add_modifier_effect("war_exhaustion", false, PROPORTION_DECIMAL, "WAR_EXHAUST_BATTLES"); /* Province Modifier Effects */ - ret &= add_modifier_effect("assimilation_rate", true); - ret &= add_modifier_effect("boost_strongest_party", false); + ret &= add_modifier_effect("assimilation_rate", true, PROPORTION_DECIMAL); + ret &= add_modifier_effect("boost_strongest_party", false, PROPORTION_DECIMAL); ret &= add_modifier_effect("farm_rgo_eff", true, PROPORTION_DECIMAL, "TECH_FARM_OUTPUT"); ret &= add_modifier_effect( "farm_rgo_size", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("farm_size") @@ -331,7 +331,7 @@ bool ModifierManager::setup_modifier_effects() { ret &= add_modifier_effect( "immigrant_push", false, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("immigant_push") ); - ret &= add_modifier_effect("life_rating", true); + ret &= add_modifier_effect("life_rating", true, PROPORTION_DECIMAL); ret &= add_modifier_effect( "local_artisan_input", false, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("artisan_input") ); @@ -352,7 +352,7 @@ bool ModifierManager::setup_modifier_effects() { "local_factory_throughput", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("factory_throughput") ); - ret &= add_modifier_effect("local_repair", true); + ret &= add_modifier_effect("local_repair", true, PROPORTION_DECIMAL); ret &= add_modifier_effect( "local_rgo_output", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("rgo_output") ); @@ -363,17 +363,17 @@ bool ModifierManager::setup_modifier_effects() { "local_ruling_party_support", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("ruling_party_support") ); - ret &= add_modifier_effect("local_ship_build", false); + ret &= add_modifier_effect("local_ship_build", false, PROPORTION_DECIMAL); ret &= add_modifier_effect("max_attrition", false, RAW_DECIMAL); ret &= add_modifier_effect("mine_rgo_eff", true, PROPORTION_DECIMAL, "TECH_MINE_OUTPUT"); ret &= add_modifier_effect( "mine_rgo_size", true, PROPORTION_DECIMAL, make_default_modifier_effect_localisation_key("mine_size") ); - ret &= add_modifier_effect("movement_cost", false); - ret &= add_modifier_effect("number_of_voters", false); + ret &= add_modifier_effect("movement_cost", false, PROPORTION_DECIMAL); + ret &= add_modifier_effect("number_of_voters", false, PROPORTION_DECIMAL); ret &= add_modifier_effect("pop_consciousness_modifier", false, RAW_DECIMAL); ret &= add_modifier_effect("pop_militancy_modifier", false, RAW_DECIMAL); - ret &= add_modifier_effect("population_growth", true); + ret &= add_modifier_effect("population_growth", true, PROPORTION_DECIMAL); ret &= add_modifier_effect("supply_limit", true, RAW_DECIMAL); /* Military Modifier Effects */ diff --git a/src/openvic-simulation/modifier/Modifier.hpp b/src/openvic-simulation/modifier/Modifier.hpp index aa41ce4..4b032c0 100644 --- a/src/openvic-simulation/modifier/Modifier.hpp +++ b/src/openvic-simulation/modifier/Modifier.hpp @@ -166,7 +166,7 @@ namespace OpenVic { public: bool add_modifier_effect( std::string_view identifier, bool positive_good, - ModifierEffect::format_t format = ModifierEffect::format_t::PROPORTION_DECIMAL, + ModifierEffect::format_t format, std::string_view localisation_key = {} ); diff --git a/src/openvic-simulation/pop/Pop.cpp b/src/openvic-simulation/pop/Pop.cpp index dd829d9..e89d510 100644 --- a/src/openvic-simulation/pop/Pop.cpp +++ b/src/openvic-simulation/pop/Pop.cpp @@ -662,7 +662,7 @@ bool PopManager::generate_modifiers(ModifierManager& modifier_manager) const { std::string_view suffix, bool is_positive_good ) -> void { ret &= modifier_manager.add_modifier_effect( - StringUtils::append_string_views(strata.get_identifier(), suffix), is_positive_good + StringUtils::append_string_views(strata.get_identifier(), suffix), is_positive_good, PROPORTION_DECIMAL ); }; -- cgit v1.2.3-56-ga3b1