diff options
Diffstat (limited to 'src/openvic-simulation/misc')
-rw-r--r-- | src/openvic-simulation/misc/Decision.cpp | 25 | ||||
-rw-r--r-- | src/openvic-simulation/misc/Decision.hpp | 10 | ||||
-rw-r--r-- | src/openvic-simulation/misc/Event.cpp | 16 | ||||
-rw-r--r-- | src/openvic-simulation/misc/Event.hpp | 9 | ||||
-rw-r--r-- | src/openvic-simulation/misc/Modifier.cpp | 86 |
5 files changed, 80 insertions, 66 deletions
diff --git a/src/openvic-simulation/misc/Decision.cpp b/src/openvic-simulation/misc/Decision.cpp index f1f2b6c..d50a16a 100644 --- a/src/openvic-simulation/misc/Decision.cpp +++ b/src/openvic-simulation/misc/Decision.cpp @@ -4,18 +4,16 @@ using namespace OpenVic; using namespace OpenVic::NodeTools; Decision::Decision( - std::string_view new_identifier, bool new_alert, bool new_news, - std::string_view new_news_title, std::string_view new_news_desc_long, - std::string_view new_news_desc_medium, std::string_view new_news_desc_short, + std::string_view new_identifier, bool new_alert, bool new_news, std::string_view new_news_title, + std::string_view new_news_desc_long, std::string_view new_news_desc_medium, std::string_view new_news_desc_short, std::string_view new_picture ) : HasIdentifier { new_identifier }, alert { new_alert }, news { new_news }, news_title { new_news_title }, news_desc_long { new_news_desc_long }, news_desc_medium { new_news_desc_medium }, news_desc_short { new_news_desc_short }, picture { new_picture } {} bool DecisionManager::add_decision( - std::string_view identifier, bool alert, bool news, std::string_view news_title, - std::string_view news_desc_long, std::string_view news_desc_medium, - std::string_view news_desc_short, std::string_view picture + std::string_view identifier, bool alert, bool news, std::string_view news_title, std::string_view news_desc_long, + std::string_view news_desc_medium, std::string_view news_desc_short, std::string_view picture ) { if (identifier.empty()) { Logger::error("Invalid decision identifier - empty!"); @@ -35,14 +33,7 @@ bool DecisionManager::add_decision( } return decisions.add_item({ - identifier, - alert, - news, - news_title, - news_desc_long, - news_desc_medium, - news_desc_short, - picture + identifier, alert, news, news_title, news_desc_long, news_desc_medium, news_desc_short, picture }, duplicate_warning_callback); } @@ -65,9 +56,11 @@ bool DecisionManager::load_decision_file(ast::NodeCPtr root) { "effect", ONE_EXACTLY, success_callback, //TODO "ai_will_do", ZERO_OR_ONE, success_callback //TODO )(node); - ret &= add_decision(identifier, alert, news, news_title, news_desc_long, news_desc_medium, news_desc_short, picture); + ret &= add_decision( + identifier, alert, news, news_title, news_desc_long, news_desc_medium, news_desc_short, picture + ); return ret; } ) )(root); -}
\ No newline at end of file +} diff --git a/src/openvic-simulation/misc/Decision.hpp b/src/openvic-simulation/misc/Decision.hpp index 452512d..32141fe 100644 --- a/src/openvic-simulation/misc/Decision.hpp +++ b/src/openvic-simulation/misc/Decision.hpp @@ -18,9 +18,8 @@ namespace OpenVic { const std::string PROPERTY(picture); Decision( - std::string_view new_identifier, bool new_alert, bool new_news, - std::string_view new_news_title, std::string_view new_news_desc_long, - std::string_view new_news_desc_medium, std::string_view new_news_desc_short, + std::string_view new_identifier, bool new_alert, bool new_news, std::string_view new_news_title, + std::string_view new_news_desc_long, std::string_view new_news_desc_medium, std::string_view new_news_desc_short, std::string_view new_picture ); @@ -34,9 +33,8 @@ namespace OpenVic { public: bool add_decision( - std::string_view identifier, bool alert, bool news, std::string_view news_title, - std::string_view news_desc_long, std::string_view news_desc_medium, - std::string_view news_desc_short, std::string_view picture + std::string_view identifier, bool alert, bool news, std::string_view news_title, std::string_view news_desc_long, + std::string_view news_desc_medium, std::string_view news_desc_short, std::string_view picture ); bool load_decision_file(ast::NodeCPtr root); diff --git a/src/openvic-simulation/misc/Event.cpp b/src/openvic-simulation/misc/Event.cpp index b7046af..4507de4 100644 --- a/src/openvic-simulation/misc/Event.cpp +++ b/src/openvic-simulation/misc/Event.cpp @@ -20,7 +20,7 @@ Event::Event( news_desc_long { new_news_desc_long }, news_desc_medium { new_news_desc_medium }, news_desc_short { new_news_desc_short }, election { new_election }, election_issue_group { new_election_issue_group }, options { std::move(new_options) } {} -OnAction::OnAction(std::string_view new_identifier, weight_map_t new_weighted_events) +OnAction::OnAction(std::string_view new_identifier, weight_map_t&& new_weighted_events) : HasIdentifier { new_identifier }, weighted_events { std::move(new_weighted_events) } {} bool EventManager::register_event( @@ -72,7 +72,7 @@ bool EventManager::register_event( }, duplicate_warning_callback); } -bool EventManager::add_on_action(std::string_view identifier, OnAction::weight_map_t weighted_events) { +bool EventManager::add_on_action(std::string_view identifier, OnAction::weight_map_t&& weighted_events) { if (identifier.empty()) { Logger::error("Invalid decision identifier - empty!"); return false; @@ -149,8 +149,6 @@ bool EventManager::load_on_action_file(ast::NodeCPtr root) { bool ret = expect_dictionary([this](std::string_view identifier, ast::NodeCPtr node) -> bool { OnAction::weight_map_t weighted_events; bool ret = expect_dictionary([this, &identifier, &weighted_events](std::string_view weight_str, ast::NodeCPtr event_node) -> bool { - Event const* event = nullptr; - bool ret = false; uint64_t weight = StringUtils::string_to_uint64(weight_str, &ret); if (!ret) { @@ -158,12 +156,18 @@ bool EventManager::load_on_action_file(ast::NodeCPtr root) { return ret; } + Event const* event = nullptr; ret &= expect_event_identifier(assign_variable_callback_pointer(event))(event_node); if (event != nullptr) { ret &= weighted_events.emplace(event, weight).second; - } else Logger::warning("Non-existing event ", event->get_identifier(), " loaded on action ", identifier, "with weight", weight, "!"); - + } else { + Logger::warning( + "Non-existing event ", event->get_identifier(), " loaded on action ", identifier, "with weight", + weight, "!" + ); + } + return ret; } )(node); diff --git a/src/openvic-simulation/misc/Event.hpp b/src/openvic-simulation/misc/Event.hpp index a518f78..71957c4 100644 --- a/src/openvic-simulation/misc/Event.hpp +++ b/src/openvic-simulation/misc/Event.hpp @@ -65,13 +65,14 @@ namespace OpenVic { struct OnAction : HasIdentifier { friend struct EventManager; - using weight_map_t = std::map<Event const*, uint64_t>; + + using weight_map_t = std::map<Event const*, uint64_t>; private: weight_map_t PROPERTY(weighted_events); - OnAction(std::string_view new_identifier, weight_map_t new_weighted_events); - + OnAction(std::string_view new_identifier, weight_map_t&& new_weighted_events); + public: OnAction(OnAction&&) = default; }; @@ -90,7 +91,7 @@ namespace OpenVic { std::vector<Event::EventOption>&& options ); - bool add_on_action(std::string_view identifier, OnAction::weight_map_t new_weighted_events); + bool add_on_action(std::string_view identifier, OnAction::weight_map_t&& new_weighted_events); bool load_event_file(IssueManager const& issue_manager, ast::NodeCPtr root); bool load_on_action_file(ast::NodeCPtr root); diff --git a/src/openvic-simulation/misc/Modifier.cpp b/src/openvic-simulation/misc/Modifier.cpp index 40698e5..f22a2cc 100644 --- a/src/openvic-simulation/misc/Modifier.cpp +++ b/src/openvic-simulation/misc/Modifier.cpp @@ -100,12 +100,21 @@ bool ModifierManager::setup_modifier_effects() { using enum ModifierEffect::format_t; /* Country Modifier Effects */ + ret &= add_modifier_effect("administrative_efficiency", true); ret &= add_modifier_effect("administrative_efficiency_modifier", true); ret &= add_modifier_effect("badboy", false, RAW_DECIMAL); + ret &= add_modifier_effect("cb_creation_speed", true); //seemingly works the same way as cb_generation_speed_modifier ret &= add_modifier_effect("cb_generation_speed_modifier", true); + ret &= add_modifier_effect("colonial_life_rating", false, INT); + ret &= add_modifier_effect("colonial_migration", true); + ret &= add_modifier_effect("colonial_points", true, INT); + ret &= add_modifier_effect("colonial_prestige", true); ret &= add_modifier_effect("core_pop_consciousness_modifier", false, RAW_DECIMAL); ret &= add_modifier_effect("core_pop_militancy_modifier", false, RAW_DECIMAL); + ret &= add_modifier_effect("dig_in_cap", true, INT); + ret &= add_modifier_effect("diplomatic_points", true); ret &= add_modifier_effect("diplomatic_points_modifier", true); + ret &= add_modifier_effect("education_efficiency", true); ret &= add_modifier_effect("education_efficiency_modifier", true); ret &= add_modifier_effect("factory_cost", false); ret &= add_modifier_effect("factory_input", false); @@ -115,23 +124,32 @@ bool ModifierManager::setup_modifier_effects() { ret &= add_modifier_effect("global_assimilation_rate", true); ret &= add_modifier_effect("global_immigrant_attract", true); ret &= add_modifier_effect("global_pop_consciousness_modifier", false, RAW_DECIMAL); + ret &= add_modifier_effect("global_pop_growth", true); ret &= add_modifier_effect("global_pop_militancy_modifier", false, RAW_DECIMAL); ret &= add_modifier_effect("global_population_growth", true); ret &= add_modifier_effect("goods_demand", false); ret &= add_modifier_effect("import_cost", false); + ret &= add_modifier_effect("increase_research", true); + ret &= add_modifier_effect("influence", true); ret &= add_modifier_effect("influence_modifier", true); ret &= add_modifier_effect("issue_change_speed", true); + ret &= add_modifier_effect("land_attack_modifier", true); + ret &= add_modifier_effect("land_attrition", false); + ret &= add_modifier_effect("land_defense_modifier", true); ret &= add_modifier_effect("land_organisation", true); ret &= add_modifier_effect("land_unit_start_experience", true, RAW_DECIMAL); ret &= add_modifier_effect("leadership", true, RAW_DECIMAL); ret &= add_modifier_effect("leadership_modifier", true); + ret &= add_modifier_effect("literacy_con_impact", false); ret &= add_modifier_effect("loan_interest", false); ret &= add_modifier_effect("max_loan_modifier", true); ret &= add_modifier_effect("max_military_spending", true); + ret &= add_modifier_effect("max_national_focus", true, INT); 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_war_exhaustion", true, PERCENTAGE_DECIMAL); + ret &= add_modifier_effect("military_tactics", true); ret &= add_modifier_effect("min_military_spending", true); ret &= add_modifier_effect("min_social_spending", true); ret &= add_modifier_effect("min_tariff", true); @@ -139,76 +157,73 @@ bool ModifierManager::setup_modifier_effects() { ret &= add_modifier_effect("mobilisation_economy_impact", false); ret &= add_modifier_effect("mobilisation_impact", false); ret &= add_modifier_effect("mobilisation_size", true); + ret &= add_modifier_effect("mobilization_economy_impact", false); + ret &= add_modifier_effect("mobilization_impact", false); + ret &= add_modifier_effect("mobilization_size", true); + ret &= add_modifier_effect("naval_attack_modifier", true); + ret &= add_modifier_effect("naval_attrition", false); + ret &= add_modifier_effect("naval_defense_modifier", true); ret &= add_modifier_effect("naval_organisation", true); 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("permanent_prestige", true, RAW_DECIMAL); + ret &= add_modifier_effect("plurality", true, PERCENTAGE_DECIMAL); ret &= add_modifier_effect("political_reform_desire", false); + ret &= add_modifier_effect("pop_growth", true); ret &= add_modifier_effect("prestige", true, RAW_DECIMAL); + ret &= add_modifier_effect("regular_experience_level", true, RAW_DECIMAL); + ret &= add_modifier_effect("reinforce_rate", true); 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_output", true); + ret &= add_modifier_effect("rgo_size", true); + ret &= add_modifier_effect("RGO_size", true); ret &= add_modifier_effect("rgo_throughput", true); ret &= add_modifier_effect("RGO_throughput", true); ret &= add_modifier_effect("ruling_party_support", true); + ret &= add_modifier_effect("shared_prestige", true, RAW_DECIMAL); ret &= add_modifier_effect("social_reform_desire", false); + ret &= add_modifier_effect("soldier_to_pop_loss", true); + ret &= add_modifier_effect("seperatism", false); // paradox typo ret &= add_modifier_effect("supply_consumption", false); + ret &= add_modifier_effect("supply_range", true); + ret &= add_modifier_effect("suppression_points_modifier", true); + ret &= add_modifier_effect("tariff_efficiency_modifier", true); + ret &= add_modifier_effect("tax_eff", true); ret &= add_modifier_effect("tax_efficiency", true); + ret &= add_modifier_effect("unit_recruitment_time", false); ret &= add_modifier_effect("unit_start_experience", true, RAW_DECIMAL); ret &= add_modifier_effect("war_exhaustion", false); - ret &= add_modifier_effect("reinforce_rate", true); - ret &= add_modifier_effect("colonial_migration", true); - ret &= add_modifier_effect("supply_range", true); - ret &= add_modifier_effect("colonial_points", true, INT); - ret &= add_modifier_effect("diplomatic_points", true); - ret &= add_modifier_effect("cb_creation_speed", true); //seemingly works the same way as cb_generation_speed_modifier - ret &= add_modifier_effect("education_efficiency", true); - ret &= add_modifier_effect("increase_research", true); - ret &= add_modifier_effect("influence", true); - ret &= add_modifier_effect("administrative_efficiency", true); - ret &= add_modifier_effect("tax_eff", true); - ret &= add_modifier_effect("military_tactics", true); - ret &= add_modifier_effect("dig_in_cap", true, INT); - ret &= add_modifier_effect("max_national_focus", true, INT); - ret &= add_modifier_effect("regular_experience_level", true, RAW_DECIMAL); - ret &= add_modifier_effect("land_attrition", false); - ret &= add_modifier_effect("naval_attrition", false); - ret &= add_modifier_effect("permanent_prestige", true, RAW_DECIMAL); - ret &= add_modifier_effect("shared_prestige", true, RAW_DECIMAL); - ret &= add_modifier_effect("colonial_prestige", true); - ret &= add_modifier_effect("soldier_to_pop_loss", true); - ret &= add_modifier_effect("pop_growth", true); - ret &= add_modifier_effect("plurality", true, PERCENTAGE_DECIMAL); - ret &= add_modifier_effect("suppression_points_modifier", true); - ret &= add_modifier_effect("colonial_life_rating", false, INT); - ret &= add_modifier_effect("seperatism", false); //paradox typo /* Province Modifier Effects */ ret &= add_modifier_effect("assimilation_rate", true); ret &= add_modifier_effect("boost_strongest_party", false); + ret &= add_modifier_effect("farm_rgo_eff", true); + ret &= add_modifier_effect("farm_RGO_eff", true); + ret &= add_modifier_effect("farm_rgo_size", true); + ret &= add_modifier_effect("farm_RGO_size", true); + ret &= add_modifier_effect("flashpoint_tension", false); ret &= add_modifier_effect("immigrant_attract", true); ret &= add_modifier_effect("immigrant_push", false); ret &= add_modifier_effect("life_rating", true); + ret &= add_modifier_effect("local_artisan_input", true); + ret &= add_modifier_effect("local_artisan_output", true); + ret &= add_modifier_effect("local_artisan_throughput", true); ret &= add_modifier_effect("local_factory_input", true); ret &= add_modifier_effect("local_factory_output", true); ret &= add_modifier_effect("local_factory_throughput", true); ret &= add_modifier_effect("local_repair", true); ret &= add_modifier_effect("local_rgo_output", true); ret &= add_modifier_effect("local_RGO_output", true); + ret &= add_modifier_effect("local_rgo_throughput", true); ret &= add_modifier_effect("local_RGO_throughput", true); ret &= add_modifier_effect("local_ruling_party_support", true); ret &= add_modifier_effect("local_ship_build", false); - 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("flashpoint_tension", false); - ret &= add_modifier_effect("farm_rgo_eff", true); - ret &= add_modifier_effect("farm_RGO_eff", true); - ret &= add_modifier_effect("farm_rgo_size", true); - ret &= add_modifier_effect("farm_RGO_size", true); ret &= add_modifier_effect("max_attrition", false, RAW_DECIMAL); ret &= add_modifier_effect("mine_rgo_eff", true); ret &= add_modifier_effect("mine_RGO_eff", true); @@ -216,6 +231,9 @@ bool ModifierManager::setup_modifier_effects() { ret &= add_modifier_effect("mine_RGO_size", true); ret &= add_modifier_effect("movement_cost", false); ret &= add_modifier_effect("number_of_voters", false); + 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("railroads", true); // capitalist likelihood for railroads vs factories ret &= add_modifier_effect("supply_limit", true, RAW_DECIMAL); |