From dbf58b1b1d318b4a82cf22b5b8e720c753388f4b Mon Sep 17 00:00:00 2001 From: hop311 Date: Thu, 31 Oct 2024 19:29:34 +0000 Subject: Load defines directly into named and typed variables rather than using an IdentifierRegistry --- src/openvic-simulation/DefinitionManager.hpp | 2 +- src/openvic-simulation/country/CountryInstance.cpp | 14 +- src/openvic-simulation/dataloader/NodeTools.cpp | 6 +- src/openvic-simulation/defines/AIDefines.cpp | 100 +++ src/openvic-simulation/defines/AIDefines.hpp | 60 ++ src/openvic-simulation/defines/CountryDefines.cpp | 228 +++++ src/openvic-simulation/defines/CountryDefines.hpp | 109 +++ src/openvic-simulation/defines/Define.cpp | 25 + src/openvic-simulation/defines/Define.hpp | 38 + .../defines/DiplomacyDefines.cpp | 914 +++++++++++++++++++++ .../defines/DiplomacyDefines.hpp | 368 +++++++++ src/openvic-simulation/defines/EconomyDefines.cpp | 92 +++ src/openvic-simulation/defines/EconomyDefines.hpp | 53 ++ src/openvic-simulation/defines/GraphicsDefines.cpp | 41 + src/openvic-simulation/defines/GraphicsDefines.hpp | 30 + src/openvic-simulation/defines/MilitaryDefines.cpp | 168 ++++ src/openvic-simulation/defines/MilitaryDefines.hpp | 86 ++ src/openvic-simulation/defines/PopsDefines.cpp | 142 ++++ src/openvic-simulation/defines/PopsDefines.hpp | 82 ++ src/openvic-simulation/map/ProvinceInstance.cpp | 10 +- src/openvic-simulation/misc/Define.cpp | 270 ------ src/openvic-simulation/misc/Define.hpp | 88 -- src/openvic-simulation/pop/Pop.cpp | 8 +- 23 files changed, 2559 insertions(+), 375 deletions(-) create mode 100644 src/openvic-simulation/defines/AIDefines.cpp create mode 100644 src/openvic-simulation/defines/AIDefines.hpp create mode 100644 src/openvic-simulation/defines/CountryDefines.cpp create mode 100644 src/openvic-simulation/defines/CountryDefines.hpp create mode 100644 src/openvic-simulation/defines/Define.cpp create mode 100644 src/openvic-simulation/defines/Define.hpp create mode 100644 src/openvic-simulation/defines/DiplomacyDefines.cpp create mode 100644 src/openvic-simulation/defines/DiplomacyDefines.hpp create mode 100644 src/openvic-simulation/defines/EconomyDefines.cpp create mode 100644 src/openvic-simulation/defines/EconomyDefines.hpp create mode 100644 src/openvic-simulation/defines/GraphicsDefines.cpp create mode 100644 src/openvic-simulation/defines/GraphicsDefines.hpp create mode 100644 src/openvic-simulation/defines/MilitaryDefines.cpp create mode 100644 src/openvic-simulation/defines/MilitaryDefines.hpp create mode 100644 src/openvic-simulation/defines/PopsDefines.cpp create mode 100644 src/openvic-simulation/defines/PopsDefines.hpp delete mode 100644 src/openvic-simulation/misc/Define.cpp delete mode 100644 src/openvic-simulation/misc/Define.hpp (limited to 'src/openvic-simulation') diff --git a/src/openvic-simulation/DefinitionManager.hpp b/src/openvic-simulation/DefinitionManager.hpp index b5df507..02de2a3 100644 --- a/src/openvic-simulation/DefinitionManager.hpp +++ b/src/openvic-simulation/DefinitionManager.hpp @@ -1,6 +1,7 @@ #pragma once #include "openvic-simulation/country/CountryDefinition.hpp" +#include "openvic-simulation/defines/Define.hpp" #include "openvic-simulation/diplomacy/DiplomaticAction.hpp" #include "openvic-simulation/economy/EconomyManager.hpp" #include "openvic-simulation/history/HistoryManager.hpp" @@ -10,7 +11,6 @@ #include "openvic-simulation/map/Mapmode.hpp" #include "openvic-simulation/military/MilitaryManager.hpp" #include "openvic-simulation/misc/Decision.hpp" -#include "openvic-simulation/misc/Define.hpp" #include "openvic-simulation/misc/Event.hpp" #include "openvic-simulation/misc/SongChance.hpp" #include "openvic-simulation/misc/SoundEffect.hpp" diff --git a/src/openvic-simulation/country/CountryInstance.cpp b/src/openvic-simulation/country/CountryInstance.cpp index 043494d..4ecb902 100644 --- a/src/openvic-simulation/country/CountryInstance.cpp +++ b/src/openvic-simulation/country/CountryInstance.cpp @@ -1,10 +1,10 @@ #include "CountryInstance.hpp" #include "openvic-simulation/country/CountryDefinition.hpp" +#include "openvic-simulation/defines/Define.hpp" #include "openvic-simulation/history/CountryHistory.hpp" #include "openvic-simulation/map/Crime.hpp" #include "openvic-simulation/map/MapInstance.hpp" -#include "openvic-simulation/misc/Define.hpp" #include "openvic-simulation/modifier/ModifierEffectCache.hpp" #include "openvic-simulation/modifier/StaticModifierCache.hpp" #include "openvic-simulation/politics/Ideology.hpp" @@ -756,7 +756,7 @@ void CountryInstance::_update_production(DefineManager const& define_manager) { for (auto const& [country, money_invested] : foreign_investments) { if (country->exists()) { const fixed_point_t investment_industrial_power = - money_invested * define_manager.get_country_investment_industrial_score_factor() / 100; + money_invested * define_manager.get_country_defines().get_country_investment_industrial_score_factor() / 100; if (investment_industrial_power != 0) { industrial_power += investment_industrial_power; @@ -875,7 +875,7 @@ void CountryInstance::_update_military( / fixed_point_t::parse(7 * (1 + unit_type_manager.get_regiment_type_count())); if (disarmed) { - military_power_from_land *= define_manager.get_disarmed_penalty(); + military_power_from_land *= define_manager.get_diplomacy_defines().get_disarmed_penalty(); } military_power_from_sea = 0; @@ -1141,9 +1141,11 @@ void CountryInstanceManager::update_rankings(Date today, DefineManager const& de military_power_ranking[index]->military_rank = rank; } - const size_t max_great_power_rank = define_manager.get_great_power_rank(); - const size_t max_secondary_power_rank = define_manager.get_secondary_power_rank(); - const Timespan lose_great_power_grace_days = define_manager.get_lose_great_power_grace_days(); + CountryDefines const& country_defines = define_manager.get_country_defines(); + + const size_t max_great_power_rank = country_defines.get_great_power_rank(); + const size_t max_secondary_power_rank = country_defines.get_secondary_power_rank(); + const Timespan lose_great_power_grace_days = country_defines.get_lose_great_power_grace_days(); // Demote great powers who have been below the max great power rank for longer than the demotion grace period and // remove them from the list. We don't just demote them all and clear the list as when rebuilding we'd need to look diff --git a/src/openvic-simulation/dataloader/NodeTools.cpp b/src/openvic-simulation/dataloader/NodeTools.cpp index ad130ad..b7b3e34 100644 --- a/src/openvic-simulation/dataloader/NodeTools.cpp +++ b/src/openvic-simulation/dataloader/NodeTools.cpp @@ -234,19 +234,19 @@ node_callback_t NodeTools::expect_date_identifier_or_string(callback_t cal } node_callback_t NodeTools::expect_years(callback_t callback) { - return expect_uint([callback](Timespan::day_t val) -> bool { + return expect_int([callback](Timespan::day_t val) -> bool { return callback(Timespan::from_years(val)); }); } node_callback_t NodeTools::expect_months(callback_t callback) { - return expect_uint([callback](Timespan::day_t val) -> bool { + return expect_int([callback](Timespan::day_t val) -> bool { return callback(Timespan::from_months(val)); }); } node_callback_t NodeTools::expect_days(callback_t callback) { - return expect_uint([callback](Timespan::day_t val) -> bool { + return expect_int([callback](Timespan::day_t val) -> bool { return callback(Timespan::from_days(val)); }); } diff --git a/src/openvic-simulation/defines/AIDefines.cpp b/src/openvic-simulation/defines/AIDefines.cpp new file mode 100644 index 0000000..1229daa --- /dev/null +++ b/src/openvic-simulation/defines/AIDefines.cpp @@ -0,0 +1,100 @@ +#include "AIDefines.hpp" + +using namespace OpenVic; +using namespace OpenVic::NodeTools; + +AIDefines::AIDefines() + : colony_weight {}, + administrator_weight {}, + industryworker_weight {}, + educator_weight {}, + soldier_weight {}, + soldier_fraction {}, + capitalist_fraction {}, + production_weight {}, + spam_penalty {}, + one_side_max_warscore {}, + pop_project_investment_max_budget_factor {}, + relation_limit_no_alliance_offer {}, + naval_supply_penalty_limit {}, + chance_build_railroad {}, + chance_build_naval_base {}, + chance_build_fort {}, + chance_invest_pop_proj {}, + chance_foreign_invest {}, + tws_awareness_score_low_cap {}, + tws_awareness_score_aspect {}, + peace_base_reluctance {}, + peace_time_duration {}, + peace_time_factor {}, + peace_time_factor_no_goals {}, + peace_war_exhaustion_factor {}, + peace_war_direction_factor {}, + peace_war_direction_winning_mult {}, + peace_force_balance_factor {}, + peace_ally_base_reluctance_mult {}, + peace_ally_time_mult {}, + peace_ally_war_exhaustion_mult {}, + peace_ally_war_direction_mult {}, + peace_ally_force_balance_mult {}, + aggression_base {}, + aggression_unciv_bonus {}, + fleet_size {}, + min_fleets {}, + max_fleets {}, + time_before_disband {} {} + +std::string_view AIDefines::get_name() const { + return "ai"; +} + +node_callback_t AIDefines::expect_defines() { + return expect_dictionary_keys( + "COLONY_WEIGHT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(colony_weight)), + "ADMINISTRATOR_WEIGHT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(administrator_weight)), + "INDUSTRYWORKER_WEIGHT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(industryworker_weight)), + "EDUCATOR_WEIGHT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(educator_weight)), + "SOLDIER_WEIGHT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(soldier_weight)), + "SOLDIER_FRACTION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(soldier_fraction)), + "CAPITALIST_FRACTION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(capitalist_fraction)), + "PRODUCTION_WEIGHT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(production_weight)), + "SPAM_PENALTY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(spam_penalty)), + "ONE_SIDE_MAX_WARSCORE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(one_side_max_warscore)), + "POP_PROJECT_INVESTMENT_MAX_BUDGET_FACTOR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(pop_project_investment_max_budget_factor)), + "RELATION_LIMIT_NO_ALLIANCE_OFFER", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(relation_limit_no_alliance_offer)), + "NAVAL_SUPPLY_PENALTY_LIMIT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(naval_supply_penalty_limit)), + "CHANCE_BUILD_RAILROAD", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(chance_build_railroad)), + "CHANCE_BUILD_NAVAL_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(chance_build_naval_base)), + "CHANCE_BUILD_FORT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(chance_build_fort)), + "CHANCE_INVEST_POP_PROJ", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(chance_invest_pop_proj)), + "CHANCE_FOREIGN_INVEST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(chance_foreign_invest)), + "TWS_AWARENESS_SCORE_LOW_CAP", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(tws_awareness_score_low_cap)), + "TWS_AWARENESS_SCORE_ASPECT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(tws_awareness_score_aspect)), + "PEACE_BASE_RELUCTANCE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_base_reluctance)), + "PEACE_TIME_MONTHS", ONE_EXACTLY, expect_months(assign_variable_callback(peace_time_duration)), + "PEACE_TIME_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_time_factor)), + "PEACE_TIME_FACTOR_NO_GOALS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_time_factor_no_goals)), + "PEACE_WAR_EXHAUSTION_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_war_exhaustion_factor)), + "PEACE_WAR_DIRECTION_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_war_direction_factor)), + "PEACE_WAR_DIRECTION_WINNING_MULT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(peace_war_direction_winning_mult)), + "PEACE_FORCE_BALANCE_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_force_balance_factor)), + "PEACE_ALLY_BASE_RELUCTANCE_MULT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(peace_ally_base_reluctance_mult)), + "PEACE_ALLY_TIME_MULT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_ally_time_mult)), + "PEACE_ALLY_WAR_EXHAUSTION_MULT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(peace_ally_war_exhaustion_mult)), + "PEACE_ALLY_WAR_DIRECTION_MULT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(peace_ally_war_direction_mult)), + "PEACE_ALLY_FORCE_BALANCE_MULT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(peace_ally_force_balance_mult)), + "AGGRESSION_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(aggression_base)), + "AGGRESSION_UNCIV_BONUS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(aggression_unciv_bonus)), + "FLEET_SIZE", ONE_EXACTLY, expect_uint(assign_variable_callback(fleet_size)), + "MIN_FLEETS", ONE_EXACTLY, expect_uint(assign_variable_callback(min_fleets)), + "MAX_FLEETS", ONE_EXACTLY, expect_uint(assign_variable_callback(max_fleets)), + "MONTHS_BEFORE_DISBAND", ONE_EXACTLY, expect_months(assign_variable_callback(time_before_disband)) + ); +} diff --git a/src/openvic-simulation/defines/AIDefines.hpp b/src/openvic-simulation/defines/AIDefines.hpp new file mode 100644 index 0000000..c69e9af --- /dev/null +++ b/src/openvic-simulation/defines/AIDefines.hpp @@ -0,0 +1,60 @@ +#pragma once + +#include "openvic-simulation/dataloader/NodeTools.hpp" +#include "openvic-simulation/types/Date.hpp" +#include "openvic-simulation/types/fixed_point/FixedPoint.hpp" +#include "openvic-simulation/utility/Getters.hpp" + +namespace OpenVic { + struct DefineManager; + + struct AIDefines { + friend struct DefineManager; + + private: + fixed_point_t PROPERTY(colony_weight); + fixed_point_t PROPERTY(administrator_weight); + fixed_point_t PROPERTY(industryworker_weight); + fixed_point_t PROPERTY(educator_weight); + fixed_point_t PROPERTY(soldier_weight); + fixed_point_t PROPERTY(soldier_fraction); + fixed_point_t PROPERTY(capitalist_fraction); + fixed_point_t PROPERTY(production_weight); + fixed_point_t PROPERTY(spam_penalty); + fixed_point_t PROPERTY(one_side_max_warscore); + fixed_point_t PROPERTY(pop_project_investment_max_budget_factor); + fixed_point_t PROPERTY(relation_limit_no_alliance_offer); + fixed_point_t PROPERTY(naval_supply_penalty_limit); + fixed_point_t PROPERTY(chance_build_railroad); + fixed_point_t PROPERTY(chance_build_naval_base); + fixed_point_t PROPERTY(chance_build_fort); + fixed_point_t PROPERTY(chance_invest_pop_proj); + fixed_point_t PROPERTY(chance_foreign_invest); + fixed_point_t PROPERTY(tws_awareness_score_low_cap); + fixed_point_t PROPERTY(tws_awareness_score_aspect); + fixed_point_t PROPERTY(peace_base_reluctance); + Timespan PROPERTY(peace_time_duration); + fixed_point_t PROPERTY(peace_time_factor); + fixed_point_t PROPERTY(peace_time_factor_no_goals); + fixed_point_t PROPERTY(peace_war_exhaustion_factor); + fixed_point_t PROPERTY(peace_war_direction_factor); + fixed_point_t PROPERTY(peace_war_direction_winning_mult); + fixed_point_t PROPERTY(peace_force_balance_factor); + fixed_point_t PROPERTY(peace_ally_base_reluctance_mult); + fixed_point_t PROPERTY(peace_ally_time_mult); + fixed_point_t PROPERTY(peace_ally_war_exhaustion_mult); + fixed_point_t PROPERTY(peace_ally_war_direction_mult); + fixed_point_t PROPERTY(peace_ally_force_balance_mult); + fixed_point_t PROPERTY(aggression_base); + fixed_point_t PROPERTY(aggression_unciv_bonus); + size_t PROPERTY(fleet_size); + size_t PROPERTY(min_fleets); + size_t PROPERTY(max_fleets); + Timespan PROPERTY(time_before_disband); + + AIDefines(); + + std::string_view get_name() const; + NodeTools::node_callback_t expect_defines(); + }; +} diff --git a/src/openvic-simulation/defines/CountryDefines.cpp b/src/openvic-simulation/defines/CountryDefines.cpp new file mode 100644 index 0000000..686f209 --- /dev/null +++ b/src/openvic-simulation/defines/CountryDefines.cpp @@ -0,0 +1,228 @@ +#include "CountryDefines.hpp" + +using namespace OpenVic; +using namespace OpenVic::NodeTools; + +CountryDefines::CountryDefines() + : nationalism_duration {}, + rebels_hold_capital_success_duration {}, // NOT USED + rebel_success_duration {}, + base_country_tax_efficiency {}, + base_country_admin_efficiency {}, + gold_to_cash_rate {}, + gold_to_worker_pay_rate {}, + great_power_rank {}, + lose_great_power_grace_days {}, + infamy_containment_limit {}, + max_bureaucracy_percentage {}, + bureaucracy_percentage_increment {}, + min_crimefight_percent {}, + max_crimefight_percent {}, + admin_efficiency_crimefight_percent {}, + conservative_increase_after_reform {}, + campaign_event_base_duration {}, + campaign_event_min_duration {}, // NOT USED + campaign_event_state_duration_modifier {}, // NOT USED + campaign_duration {}, + secondary_power_rank {}, + colony_to_state_prestige_gain {}, + colonial_liferating {}, + base_greatpower_daily_influence {}, + ai_support_reform {}, + base_monthly_diplopoints {}, + diplomat_travel_duration {}, + province_overseas_penalty {}, + noncore_tax_penalty {}, + base_tariff_efficiency {}, + colony_formed_prestige {}, + created_cb_valid_time {}, + loyalty_boost_on_party_win {}, + movement_radicalism_base {}, + movement_radicalism_passed_reform_effect {}, + movement_radicalism_nationalism_factor {}, + suppression_points_gain_base {}, + suppress_bureaucrat_factor {}, + wrong_reform_militancy_impact {}, + suppression_radicalisation_hit {}, + country_investment_industrial_score_factor {}, + unciv_tech_spread_max {}, + unciv_tech_spread_min {}, + min_delay_duration_between_reforms {}, + economic_reform_uh_factor {}, + military_reform_uh_factor {}, + wrong_reform_radical_impact {}, + tech_year_span {}, + tech_factor_vassal {}, + max_suppression {}, + prestige_hit_on_break_country {}, + min_mobilize_limit {}, + pop_growth_country_cache_days {}, + newspaper_printing_frequency {}, + newspaper_timeout_period {}, + newspaper_max_tension {}, + naval_base_supply_score_base {}, + naval_base_supply_score_empty {}, + naval_base_non_core_supply_score {}, + colonial_points_from_supply_factor {}, + colonial_points_for_non_core_base {}, + mobilization_speed_base {}, + mobilization_speed_rails_mult {}, + colonization_interest_lead {}, + colonization_influence_lead {}, + colonization_duration {}, + colonization_days_between_investment {}, + colonization_days_for_initial_investment {}, + colonization_protectorate_province_maintainance {}, + colonization_colony_province_maintainance {}, + colonization_colony_industry_maintainance {}, + colonization_colony_railway_maintainance {}, + colonization_interest_cost_initial {}, + colonization_interest_cost_neighbor_modifier {}, + colonization_interest_cost {}, + colonization_influence_cost {}, + colonization_extra_guard_cost {}, + colonization_release_dominion_cost {}, + colonization_create_state_cost {}, + colonization_create_protectorate_cost {}, + colonization_create_colony_cost {}, + colonization_colony_state_distance {}, + colonization_influence_temperature_per_day {}, + colonization_influence_temperature_per_level {}, + party_loyalty_hit_on_war_loss {}, + research_points_on_conquer_mult {}, + max_research_points {} {} + +std::string_view CountryDefines::get_name() const { + return "country"; +} + +node_callback_t CountryDefines::expect_defines() { + return expect_dictionary_keys( + "YEARS_OF_NATIONALISM", ONE_EXACTLY, expect_years(assign_variable_callback(nationalism_duration)), + "MONTHS_UNTIL_BROKEN", ZERO_OR_ONE, // NOT USED + expect_months(assign_variable_callback(rebels_hold_capital_success_duration)), + "REBEL_ACCEPTANCE_MONTHS", ONE_EXACTLY, expect_months(assign_variable_callback(rebel_success_duration)), + "BASE_COUNTRY_TAX_EFFICIENCY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(base_country_tax_efficiency)), + "BASE_COUNTRY_ADMIN_EFFICIENCY", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(base_country_admin_efficiency)), + "GOLD_TO_CASH_RATE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(gold_to_cash_rate)), + "GOLD_TO_WORKER_PAY_RATE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(gold_to_worker_pay_rate)), + "GREAT_NATIONS_COUNT", ONE_EXACTLY, expect_uint(assign_variable_callback(great_power_rank)), + "GREATNESS_DAYS", ONE_EXACTLY, expect_days(assign_variable_callback(lose_great_power_grace_days)), + "BADBOY_LIMIT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_containment_limit)), + "MAX_BUREAUCRACY_PERCENTAGE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(max_bureaucracy_percentage)), + "BUREAUCRACY_PERCENTAGE_INCREMENT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(bureaucracy_percentage_increment)), + "MIN_CRIMEFIGHT_PERCENT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(min_crimefight_percent)), + "MAX_CRIMEFIGHT_PERCENT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(max_crimefight_percent)), + "ADMIN_EFFICIENCY_CRIMEFIGHT_PERCENT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(admin_efficiency_crimefight_percent)), + "CONSERVATIVE_INCREASE_AFTER_REFORM", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(conservative_increase_after_reform)), + "CAMPAIGN_EVENT_BASE_TIME", ONE_EXACTLY, expect_days(assign_variable_callback(campaign_event_base_duration)), + "CAMPAIGN_EVENT_MIN_TIME", ZERO_OR_ONE, expect_days(assign_variable_callback(campaign_event_min_duration)), // NOT USED + "CAMPAIGN_EVENT_STATE_SCALE", ZERO_OR_ONE, // NOT USED + expect_days(assign_variable_callback(campaign_event_state_duration_modifier)), + "CAMPAIGN_DURATION", ONE_EXACTLY, expect_months(assign_variable_callback(campaign_duration)), + "COLONIAL_RANK", ONE_EXACTLY, expect_uint(assign_variable_callback(secondary_power_rank)), + "COLONY_TO_STATE_PRESTIGE_GAIN", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colony_to_state_prestige_gain)), + "COLONIAL_LIFERATING", ONE_EXACTLY, expect_uint(assign_variable_callback(colonial_liferating)), + "BASE_GREATPOWER_DAILY_INFLUENCE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(base_greatpower_daily_influence)), + "AI_SUPPORT_REFORM", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(ai_support_reform)), + "BASE_MONTHLY_DIPLOPOINTS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(base_monthly_diplopoints)), + "DIPLOMAT_TRAVEL_TIME", ONE_EXACTLY, expect_days(assign_variable_callback(diplomat_travel_duration)), + "PROVINCE_OVERSEAS_PENALTY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(province_overseas_penalty)), + "NONCORE_TAX_PENALTY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(noncore_tax_penalty)), + "BASE_TARIFF_EFFICIENCY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(base_tariff_efficiency)), + "COLONY_FORMED_PRESTIGE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(colony_formed_prestige)), + "CREATED_CB_VALID_TIME", ONE_EXACTLY, expect_months(assign_variable_callback(created_cb_valid_time)), + "LOYALTY_BOOST_ON_PARTY_WIN", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(loyalty_boost_on_party_win)), + "MOVEMENT_RADICALISM_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(movement_radicalism_base)), + "MOVEMENT_RADICALISM_PASSED_REFORM_EFFECT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(movement_radicalism_passed_reform_effect)), + "MOVEMENT_RADICALISM_NATIONALISM_FACTOR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(movement_radicalism_nationalism_factor)), + "SUPPRESSION_POINTS_GAIN_BASE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(suppression_points_gain_base)), + "SUPPRESS_BUREAUCRAT_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(suppress_bureaucrat_factor)), + "WRONG_REFORM_MILITANCY_IMPACT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(wrong_reform_militancy_impact)), + "SUPPRESSION_RADICALISATION_HIT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(suppression_radicalisation_hit)), + "INVESTMENT_SCORE_FACTOR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(country_investment_industrial_score_factor)), + "UNCIV_TECH_SPREAD_MAX", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(unciv_tech_spread_max)), + "UNCIV_TECH_SPREAD_MIN", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(unciv_tech_spread_min)), + "MIN_DELAY_BETWEEN_REFORMS", ONE_EXACTLY, expect_months(assign_variable_callback(min_delay_duration_between_reforms)), + "ECONOMIC_REFORM_UH_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(economic_reform_uh_factor)), + "MILITARY_REFORM_UH_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(military_reform_uh_factor)), + "WRONG_REFORM_RADICAL_IMPACT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(wrong_reform_radical_impact)), + "TECH_YEAR_SPAN", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(tech_year_span)), + "TECH_FACTOR_VASSAL", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(tech_factor_vassal)), + "MAX_SUPPRESSION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(max_suppression)), + "PRESTIGE_HIT_ON_BREAK_COUNTRY", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(prestige_hit_on_break_country)), + "MIN_MOBILIZE_LIMIT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(min_mobilize_limit)), + "POP_GROWTH_COUNTRY_CACHE_DAYS", ONE_EXACTLY, expect_days(assign_variable_callback(pop_growth_country_cache_days)), + "NEWSPAPER_PRINTING_FREQUENCY", ONE_EXACTLY, expect_days(assign_variable_callback(newspaper_printing_frequency)), + "NEWSPAPER_TIMEOUT_PERIOD", ONE_EXACTLY, expect_days(assign_variable_callback(newspaper_timeout_period)), + "NEWSPAPER_MAX_TENSION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(newspaper_max_tension)), + "NAVAL_BASE_SUPPLY_SCORE_BASE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_base_supply_score_base)), + "NAVAL_BASE_SUPPLY_SCORE_EMPTY", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_base_supply_score_empty)), + "NAVAL_BASE_NON_CORE_SUPPLY_SCORE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_base_non_core_supply_score)), + "COLONIAL_POINTS_FROM_SUPPLY_FACTOR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colonial_points_from_supply_factor)), + "COLONIAL_POINTS_FOR_NON_CORE_BASE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colonial_points_for_non_core_base)), + "MOBILIZATION_SPEED_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(mobilization_speed_base)), + "MOBILIZATION_SPEED_RAILS_MULT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(mobilization_speed_rails_mult)), + "COLONIZATION_INTEREST_LEAD", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(colonization_interest_lead)), + "COLONIZATION_INFLUENCE_LEAD", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(colonization_influence_lead)), + "COLONIZATION_MONTHS_TO_COLONIZE", ONE_EXACTLY, expect_months(assign_variable_callback(colonization_duration)), + "COLONIZATION_DAYS_BETWEEN_INVESTMENT", ONE_EXACTLY, + expect_days(assign_variable_callback(colonization_days_between_investment)), + "COLONIZATION_DAYS_FOR_INITIAL_INVESTMENT", ONE_EXACTLY, + expect_days(assign_variable_callback(colonization_days_for_initial_investment)), + "COLONIZATION_PROTECTORATE_PROVINCE_MAINTAINANCE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colonization_protectorate_province_maintainance)), + "COLONIZATION_COLONY_PROVINCE_MAINTAINANCE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colonization_colony_province_maintainance)), + "COLONIZATION_COLONY_INDUSTRY_MAINTAINANCE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colonization_colony_industry_maintainance)), + "COLONIZATION_COLONY_RAILWAY_MAINTAINANCE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colonization_colony_railway_maintainance)), + "COLONIZATION_INTEREST_COST_INITIAL", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colonization_interest_cost_initial)), + "COLONIZATION_INTEREST_COST_NEIGHBOR_MODIFIER", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colonization_interest_cost_neighbor_modifier)), + "COLONIZATION_INTEREST_COST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(colonization_interest_cost)), + "COLONIZATION_INFLUENCE_COST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(colonization_influence_cost)), + "COLONIZATION_EXTRA_GUARD_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colonization_extra_guard_cost)), + "COLONIZATION_RELEASE_DOMINION_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colonization_release_dominion_cost)), + "COLONIZATION_CREATE_STATE_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colonization_create_state_cost)), + "COLONIZATION_CREATE_PROTECTORATE_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colonization_create_protectorate_cost)), + "COLONIZATION_CREATE_COLONY_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colonization_create_colony_cost)), + "COLONIZATION_COLONY_STATE_DISTANCE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colonization_colony_state_distance)), + "COLONIZATION_INFLUENCE_TEMPERATURE_PER_DAY", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colonization_influence_temperature_per_day)), + "COLONIZATION_INFLUENCE_TEMPERATURE_PER_LEVEL", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(colonization_influence_temperature_per_level)), + "PARTY_LOYALTY_HIT_ON_WAR_LOSS", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(party_loyalty_hit_on_war_loss)), + "RESEARCH_POINTS_ON_CONQUER_MULT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(research_points_on_conquer_mult)), + "MAX_RESEARCH_POINTS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(max_research_points)) + ); +} diff --git a/src/openvic-simulation/defines/CountryDefines.hpp b/src/openvic-simulation/defines/CountryDefines.hpp new file mode 100644 index 0000000..b97f6f3 --- /dev/null +++ b/src/openvic-simulation/defines/CountryDefines.hpp @@ -0,0 +1,109 @@ +#pragma once + +#include "openvic-simulation/dataloader/NodeTools.hpp" +#include "openvic-simulation/map/ProvinceInstance.hpp" +#include "openvic-simulation/types/Date.hpp" +#include "openvic-simulation/types/fixed_point/FixedPoint.hpp" +#include "openvic-simulation/utility/Getters.hpp" + +namespace OpenVic { + struct DefineManager; + + struct CountryDefines { + friend struct DefineManager; + + private: + Timespan PROPERTY(nationalism_duration); + Timespan PROPERTY(rebels_hold_capital_success_duration); // NOT USED + Timespan PROPERTY(rebel_success_duration); + fixed_point_t PROPERTY(base_country_tax_efficiency); + fixed_point_t PROPERTY(base_country_admin_efficiency); + fixed_point_t PROPERTY(gold_to_cash_rate); + fixed_point_t PROPERTY(gold_to_worker_pay_rate); + size_t PROPERTY(great_power_rank); + Timespan PROPERTY(lose_great_power_grace_days); + fixed_point_t PROPERTY(infamy_containment_limit); + fixed_point_t PROPERTY(max_bureaucracy_percentage); + fixed_point_t PROPERTY(bureaucracy_percentage_increment); + fixed_point_t PROPERTY(min_crimefight_percent); + fixed_point_t PROPERTY(max_crimefight_percent); + fixed_point_t PROPERTY(admin_efficiency_crimefight_percent); + fixed_point_t PROPERTY(conservative_increase_after_reform); + Timespan PROPERTY(campaign_event_base_duration); + Timespan PROPERTY(campaign_event_min_duration); // NOT USED + Timespan PROPERTY(campaign_event_state_duration_modifier); // NOT USED + Timespan PROPERTY(campaign_duration); + size_t PROPERTY(secondary_power_rank); + fixed_point_t PROPERTY(colony_to_state_prestige_gain); + ProvinceInstance::life_rating_t PROPERTY(colonial_liferating); + fixed_point_t PROPERTY(base_greatpower_daily_influence); + fixed_point_t PROPERTY(ai_support_reform); + fixed_point_t PROPERTY(base_monthly_diplopoints); + Timespan PROPERTY(diplomat_travel_duration); + fixed_point_t PROPERTY(province_overseas_penalty); + fixed_point_t PROPERTY(noncore_tax_penalty); + fixed_point_t PROPERTY(base_tariff_efficiency); + fixed_point_t PROPERTY(colony_formed_prestige); + Timespan PROPERTY(created_cb_valid_time); + fixed_point_t PROPERTY(loyalty_boost_on_party_win); + fixed_point_t PROPERTY(movement_radicalism_base); + fixed_point_t PROPERTY(movement_radicalism_passed_reform_effect); + fixed_point_t PROPERTY(movement_radicalism_nationalism_factor); + fixed_point_t PROPERTY(suppression_points_gain_base); + fixed_point_t PROPERTY(suppress_bureaucrat_factor); + fixed_point_t PROPERTY(wrong_reform_militancy_impact); + fixed_point_t PROPERTY(suppression_radicalisation_hit); + fixed_point_t PROPERTY(country_investment_industrial_score_factor); + fixed_point_t PROPERTY(unciv_tech_spread_max); + fixed_point_t PROPERTY(unciv_tech_spread_min); + Timespan PROPERTY(min_delay_duration_between_reforms); + fixed_point_t PROPERTY(economic_reform_uh_factor); + fixed_point_t PROPERTY(military_reform_uh_factor); + fixed_point_t PROPERTY(wrong_reform_radical_impact); + fixed_point_t PROPERTY(tech_year_span); + fixed_point_t PROPERTY(tech_factor_vassal); + fixed_point_t PROPERTY(max_suppression); + fixed_point_t PROPERTY(prestige_hit_on_break_country); + fixed_point_t PROPERTY(min_mobilize_limit); + Timespan PROPERTY(pop_growth_country_cache_days); + Timespan PROPERTY(newspaper_printing_frequency); + Timespan PROPERTY(newspaper_timeout_period); + fixed_point_t PROPERTY(newspaper_max_tension); + fixed_point_t PROPERTY(naval_base_supply_score_base); + fixed_point_t PROPERTY(naval_base_supply_score_empty); + fixed_point_t PROPERTY(naval_base_non_core_supply_score); + fixed_point_t PROPERTY(colonial_points_from_supply_factor); + fixed_point_t PROPERTY(colonial_points_for_non_core_base); + fixed_point_t PROPERTY(mobilization_speed_base); + fixed_point_t PROPERTY(mobilization_speed_rails_mult); + fixed_point_t PROPERTY(colonization_interest_lead); + fixed_point_t PROPERTY(colonization_influence_lead); + Timespan PROPERTY(colonization_duration); + Timespan PROPERTY(colonization_days_between_investment); + Timespan PROPERTY(colonization_days_for_initial_investment); + fixed_point_t PROPERTY(colonization_protectorate_province_maintainance); + fixed_point_t PROPERTY(colonization_colony_province_maintainance); + fixed_point_t PROPERTY(colonization_colony_industry_maintainance); + fixed_point_t PROPERTY(colonization_colony_railway_maintainance); + fixed_point_t PROPERTY(colonization_interest_cost_initial); + fixed_point_t PROPERTY(colonization_interest_cost_neighbor_modifier); + fixed_point_t PROPERTY(colonization_interest_cost); + fixed_point_t PROPERTY(colonization_influence_cost); + fixed_point_t PROPERTY(colonization_extra_guard_cost); + fixed_point_t PROPERTY(colonization_release_dominion_cost); + fixed_point_t PROPERTY(colonization_create_state_cost); + fixed_point_t PROPERTY(colonization_create_protectorate_cost); + fixed_point_t PROPERTY(colonization_create_colony_cost); + fixed_point_t PROPERTY(colonization_colony_state_distance); + fixed_point_t PROPERTY(colonization_influence_temperature_per_day); + fixed_point_t PROPERTY(colonization_influence_temperature_per_level); + fixed_point_t PROPERTY(party_loyalty_hit_on_war_loss); + fixed_point_t PROPERTY(research_points_on_conquer_mult); + fixed_point_t PROPERTY(max_research_points); + + CountryDefines(); + + std::string_view get_name() const; + NodeTools::node_callback_t expect_defines(); + }; +} diff --git a/src/openvic-simulation/defines/Define.cpp b/src/openvic-simulation/defines/Define.cpp new file mode 100644 index 0000000..8d910cb --- /dev/null +++ b/src/openvic-simulation/defines/Define.cpp @@ -0,0 +1,25 @@ +#include "Define.hpp" + +#include "openvic-simulation/dataloader/NodeTools.hpp" + +using namespace OpenVic; +using namespace OpenVic::NodeTools; + +DefineManager::DefineManager() : start_date {}, end_date {} {} + +bool DefineManager::load_defines_file(ast::NodeCPtr root) { + return expect_dictionary_keys( + "defines", ONE_EXACTLY, expect_dictionary_keys( + "start_date", ONE_EXACTLY, expect_date_identifier_or_string(assign_variable_callback(start_date)), + "end_date", ONE_EXACTLY, expect_date_identifier_or_string(assign_variable_callback(end_date)), + + ai_defines.get_name(), ONE_EXACTLY, ai_defines.expect_defines(), + country_defines.get_name(), ONE_EXACTLY, country_defines.expect_defines(), + diplomacy_defines.get_name(), ONE_EXACTLY, diplomacy_defines.expect_defines(), + economy_defines.get_name(), ONE_EXACTLY, economy_defines.expect_defines(), + graphics_defines.get_name(), ONE_EXACTLY, graphics_defines.expect_defines(), + military_defines.get_name(), ONE_EXACTLY, military_defines.expect_defines(), + pops_defines.get_name(), ONE_EXACTLY, pops_defines.expect_defines() + ) + )(root); +} diff --git a/src/openvic-simulation/defines/Define.hpp b/src/openvic-simulation/defines/Define.hpp new file mode 100644 index 0000000..e1b2bc2 --- /dev/null +++ b/src/openvic-simulation/defines/Define.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include "openvic-simulation/defines/AIDefines.hpp" +#include "openvic-simulation/defines/CountryDefines.hpp" +#include "openvic-simulation/defines/DiplomacyDefines.hpp" +#include "openvic-simulation/defines/EconomyDefines.hpp" +#include "openvic-simulation/defines/GraphicsDefines.hpp" +#include "openvic-simulation/defines/MilitaryDefines.hpp" +#include "openvic-simulation/defines/PopsDefines.hpp" +#include "openvic-simulation/types/Date.hpp" +#include "openvic-simulation/utility/Getters.hpp" + +namespace OpenVic { + struct DefineManager { + private: + // Date + Date PROPERTY(start_date); + Date PROPERTY(end_date); + + // Other define groups + AIDefines PROPERTY(ai_defines); + CountryDefines PROPERTY(country_defines); + DiplomacyDefines PROPERTY(diplomacy_defines); + EconomyDefines PROPERTY(economy_defines); + GraphicsDefines PROPERTY(graphics_defines); + MilitaryDefines PROPERTY(military_defines); + PopsDefines PROPERTY(pops_defines); + + public: + DefineManager(); + + constexpr bool in_game_period(Date date) const { + return date.in_range(start_date, end_date); + } + + bool load_defines_file(ast::NodeCPtr root); + }; +} diff --git a/src/openvic-simulation/defines/DiplomacyDefines.cpp b/src/openvic-simulation/defines/DiplomacyDefines.cpp new file mode 100644 index 0000000..5facbe4 --- /dev/null +++ b/src/openvic-simulation/defines/DiplomacyDefines.cpp @@ -0,0 +1,914 @@ +#include "DiplomacyDefines.hpp" + +using namespace OpenVic; +using namespace OpenVic::NodeTools; + +DiplomacyDefines::DiplomacyDefines() + : peace_cost_add_to_sphere {}, + peace_cost_release_puppet {}, + peace_cost_make_puppet {}, + peace_cost_disarmament {}, + peace_cost_destroy_forts {}, + peace_cost_destroy_naval_bases {}, + peace_cost_reparations {}, + peace_cost_transfer_provinces {}, + peace_cost_remove_cores {}, + peace_cost_prestige {}, + peace_cost_concede {}, + peace_cost_status_quo {}, + peace_cost_annex {}, + peace_cost_demand_state {}, + peace_cost_install_communist_gov_type {}, + peace_cost_uninstall_communist_gov_type {}, + peace_cost_colony {}, + infamy_add_to_sphere {}, + infamy_release_puppet {}, + infamy_make_puppet {}, + infamy_disarmament {}, + infamy_destroy_forts {}, + infamy_destroy_naval_bases {}, + infamy_reparations {}, + infamy_transfer_provinces {}, + infamy_remove_cores {}, + infamy_prestige {}, + infamy_concede {}, + infamy_status_quo {}, + infamy_annex {}, + infamy_demand_state {}, + infamy_install_communist_gov_type {}, + infamy_uninstall_communist_gov_type {}, + infamy_colony {}, + prestige_add_to_sphere_base {}, + prestige_release_puppet_base {}, + prestige_make_puppet_base {}, + prestige_disarmament_base {}, + prestige_destroy_forts_base {}, + prestige_destroy_naval_bases_base {}, + prestige_reparations_base {}, + prestige_transfer_provinces_base {}, + prestige_remove_cores_base {}, + prestige_prestige_base {}, + prestige_concede_base {}, + prestige_status_quo_base {}, + prestige_annex_base {}, + prestige_demand_state_base {}, + prestige_clear_union_sphere_base {}, + prestige_gunboat_base {}, + prestige_install_communist_gov_type_base {}, + prestige_uninstall_communist_gov_type_base {}, + prestige_colony_base {}, + prestige_add_to_sphere {}, + prestige_release_puppet {}, + prestige_make_puppet {}, + prestige_disarmament {}, + prestige_destroy_forts {}, + prestige_destroy_naval_bases {}, + prestige_reparations {}, + prestige_transfer_provinces {}, + prestige_remove_cores {}, + prestige_prestige {}, + prestige_concede {}, + prestige_status_quo {}, + prestige_annex {}, + prestige_demand_state {}, + prestige_clear_union_sphere {}, + prestige_gunboat {}, + prestige_install_communist_gov_type {}, + prestige_uninstall_communist_gov_type {}, + prestige_colony {}, + breaktruce_infamy_add_to_sphere {}, + breaktruce_infamy_release_puppet {}, + breaktruce_infamy_make_puppet {}, + breaktruce_infamy_disarmament {}, + breaktruce_infamy_destroy_forts {}, + breaktruce_infamy_destroy_naval_bases {}, + breaktruce_infamy_reparations {}, + breaktruce_infamy_transfer_provinces {}, + breaktruce_infamy_remove_cores {}, + breaktruce_infamy_prestige {}, + breaktruce_infamy_concede {}, + breaktruce_infamy_status_quo {}, + breaktruce_infamy_annex {}, + breaktruce_infamy_demand_state {}, + breaktruce_infamy_install_communist_gov_type {}, + breaktruce_infamy_uninstall_communist_gov_type {}, + breaktruce_infamy_colony {}, + breaktruce_prestige_add_to_sphere {}, + breaktruce_prestige_release_puppet {}, + breaktruce_prestige_make_puppet {}, + breaktruce_prestige_disarmament {}, + breaktruce_prestige_destroy_forts {}, + breaktruce_prestige_destroy_naval_bases {}, + breaktruce_prestige_reparations {}, + breaktruce_prestige_transfer_provinces {}, + breaktruce_prestige_remove_cores {}, + breaktruce_prestige_prestige {}, + breaktruce_prestige_concede {}, + breaktruce_prestige_status_quo {}, + breaktruce_prestige_annex {}, + breaktruce_prestige_demand_state {}, + breaktruce_prestige_install_communist_gov_type {}, + breaktruce_prestige_uninstall_communist_gov_type {}, + breaktruce_prestige_colony {}, + breaktruce_militancy_add_to_sphere {}, + breaktruce_militancy_release_puppet {}, + breaktruce_militancy_make_puppet {}, + breaktruce_militancy_disarmament {}, + breaktruce_militancy_destroy_forts {}, + breaktruce_militancy_destroy_naval_bases {}, + breaktruce_militancy_reparations {}, + breaktruce_militancy_transfer_provinces {}, + breaktruce_militancy_remove_cores {}, + breaktruce_militancy_prestige {}, + breaktruce_militancy_concede {}, + breaktruce_militancy_status_quo {}, + breaktruce_militancy_annex {}, + breaktruce_militancy_demand_state {}, + breaktruce_militancy_install_communist_gov_type {}, + breaktruce_militancy_uninstall_communist_gov_type {}, + breaktruce_militancy_colony {}, + goodrelation_infamy_add_to_sphere {}, + goodrelation_infamy_release_puppet {}, + goodrelation_infamy_make_puppet {}, + goodrelation_infamy_disarmament {}, + goodrelation_infamy_destroy_forts {}, + goodrelation_infamy_destroy_naval_bases {}, + goodrelation_infamy_reparations {}, + goodrelation_infamy_transfer_provinces {}, + goodrelation_infamy_remove_cores {}, + goodrelation_infamy_prestige {}, + goodrelation_infamy_concede {}, + goodrelation_infamy_status_quo {}, + goodrelation_infamy_annex {}, + goodrelation_infamy_demand_state {}, + goodrelation_infamy_install_communist_gov_type {}, + goodrelation_infamy_uninstall_communist_gov_type {}, + goodrelation_infamy_colony {}, + goodrelation_prestige_add_to_sphere {}, + goodrelation_prestige_release_puppet {}, + goodrelation_prestige_make_puppet {}, + goodrelation_prestige_disarmament {}, + goodrelation_prestige_destroy_forts {}, + goodrelation_prestige_destroy_naval_bases {}, + goodrelation_prestige_reparations {}, + goodrelation_prestige_transfer_provinces {}, + goodrelation_prestige_remove_cores {}, + goodrelation_prestige_prestige {}, + goodrelation_prestige_concede {}, + goodrelation_prestige_status_quo {}, + goodrelation_prestige_annex {}, + goodrelation_prestige_demand_state {}, + goodrelation_prestige_install_communist_gov_type {}, + goodrelation_prestige_uninstall_communist_gov_type {}, + goodrelation_prestige_colony {}, + goodrelation_militancy_add_to_sphere {}, + goodrelation_militancy_release_puppet {}, + goodrelation_militancy_make_puppet {}, + goodrelation_militancy_disarmament {}, + goodrelation_militancy_destroy_forts {}, + goodrelation_militancy_destroy_naval_bases {}, + goodrelation_militancy_reparations {}, + goodrelation_militancy_transfer_provinces {}, + goodrelation_militancy_remove_cores {}, + goodrelation_militancy_prestige {}, + goodrelation_militancy_concede {}, + goodrelation_militancy_status_quo {}, + goodrelation_militancy_annex {}, + goodrelation_militancy_demand_state {}, + goodrelation_militancy_install_communist_gov_type {}, + goodrelation_militancy_uninstall_communist_gov_type {}, + goodrelation_militancy_colony {}, + war_prestige_cost_base {}, + war_prestige_cost_high_prestige {}, + war_prestige_cost_neg_prestige {}, + war_prestige_cost_truce {}, + war_prestige_cost_honor_alliance {}, + war_prestige_cost_honor_guarnatee {}, + war_prestige_cost_uncivilized {}, + war_prestige_cost_core {}, + war_failed_goal_militancy {}, + war_failed_goal_prestige_base {}, + war_failed_goal_prestige {}, + discredit_days {}, + discredit_influence_cost_factor {}, + discredit_influence_gain_factor {}, + banembassy_days {}, + declarewar_relation_on_accept {}, + declarewar_diplomatic_cost {}, + addwargoal_relation_on_accept {}, + addwargoal_diplomatic_cost {}, + add_unjustified_goal_badboy {}, + peace_relation_on_accept {}, + peace_relation_on_decline {}, + peace_diplomatic_cost {}, + alliance_relation_on_accept {}, + alliance_relation_on_decline {}, + alliance_diplomatic_cost {}, + cancelalliance_relation_on_accept {}, + cancelalliance_diplomatic_cost {}, + callally_relation_on_accept {}, + callally_relation_on_decline {}, + callally_diplomatic_cost {}, + askmilaccess_relation_on_accept {}, + askmilaccess_relation_on_decline {}, + askmilaccess_diplomatic_cost {}, + cancelaskmilaccess_relation_on_accept {}, + cancelaskmilaccess_diplomatic_cost {}, + givemilaccess_relation_on_accept {}, + givemilaccess_relation_on_decline {}, + givemilaccess_diplomatic_cost {}, + cancelgivemilaccess_relation_on_accept {}, + cancelgivemilaccess_diplomatic_cost {}, + warsubsidy_relation_on_accept {}, + warsubsidy_diplomatic_cost {}, + cancelwarsubsidy_relation_on_accept {}, + cancelwarsubsidy_diplomatic_cost {}, + discredit_relation_on_accept {}, + discredit_influence_cost {}, + expeladvisors_relation_on_accept {}, + expeladvisors_influence_cost {}, + ceasecolonization_relation_on_accept {}, + ceasecolonization_relation_on_decline {}, + ceasecolonization_diplomatic_cost {}, + banembassy_relation_on_accept {}, + banembassy_influence_cost {}, + increaserelation_relation_on_accept {}, + increaserelation_relation_on_decline {}, + increaserelation_diplomatic_cost {}, + decreaserelation_relation_on_accept {}, + decreaserelation_diplomatic_cost {}, + addtosphere_relation_on_accept {}, + addtosphere_influence_cost {}, + removefromsphere_relation_on_accept {}, + removefromsphere_influence_cost {}, + removefromsphere_prestige_cost {}, + removefromsphere_infamy_cost {}, + increaseopinion_relation_on_accept {}, + increaseopinion_influence_cost {}, + decreaseopinion_relation_on_accept {}, + decreaseopinion_influence_cost {}, + make_cb_diplomatic_cost {}, + make_cb_relation_on_accept {}, + disarmed_penalty {}, + reparations_tax_hit {}, + prestige_reduction_base {}, + prestige_reduction {}, + reparations_duration {}, + min_warscore_to_intervene {}, + min_time_to_intervene {}, + max_warscore_from_battles {}, + gunboat_diplomatic_cost {}, + gunboat_relation_on_accept {}, + wargoal_jingoism_requirement {}, + liberate_state_relation_increase {}, + dishonored_callally_prestige_penalty {}, + base_truce_duration {}, + max_influence {}, + warsubsidies_percent {}, + neighbour_bonus_influence_percent {}, + sphere_neighbour_bonus_influence_percent {}, + other_continent_bonus_influence_percent {}, + puppet_bonus_influence_percent {}, + release_nation_prestige {}, + release_nation_infamy {}, + infamy_clear_union_sphere {}, + breaktruce_infamy_clear_union_sphere {}, + breaktruce_prestige_clear_union_sphere {}, + breaktruce_militancy_clear_union_sphere {}, + goodrelation_infamy_clear_union_sphere {}, + goodrelation_prestige_clear_union_sphere {}, + goodrelation_militancy_clear_union_sphere {}, + peace_cost_clear_union_sphere {}, + good_peace_refusal_militancy {}, + good_peace_refusal_warexh {}, + peace_cost_gunboat {}, + infamy_gunboat {}, + breaktruce_infamy_gunboat {}, + breaktruce_prestige_gunboat {}, + breaktruce_militancy_gunboat {}, + goodrelation_infamy_gunboat {}, + goodrelation_prestige_gunboat {}, + goodrelation_militancy_gunboat {}, + cb_generation_base_speed {}, + cb_generation_speed_bonus_on_colony_competition {}, + cb_generation_speed_bonus_on_colony_competition_troops_presence {}, + make_cb_relation_limit {}, + cb_detection_chance_base {}, + investment_influence_defense {}, + relation_influence_modifier {}, + on_cb_detected_relation_change {}, + gw_intervene_min_relations {}, + gw_intervene_max_exhaustion {}, + gw_justify_cb_badboy_impact {}, + gw_cb_construction_speed {}, + gw_wargoal_jingoism_requirement_mod {}, + gw_warscore_cost_mod {}, + gw_warscore_cost_mod_2 {}, + gw_warscore_2_threshold {}, + tension_decay {}, + tension_from_cb {}, + tension_from_movement {}, + tension_from_movement_max {}, + at_war_tension_decay {}, + tension_on_cb_discovered {}, + tension_on_revolt {}, + tension_while_crisis {}, + crisis_cooldown_duration {}, + crisis_base_chance {}, + crisis_temperature_increase {}, + crisis_offer_diplomatic_cost {}, + crisis_offer_relation_on_accept {}, + crisis_offer_relation_on_decline {}, + crisis_did_not_take_side_prestige_factor_base {}, + crisis_did_not_take_side_prestige_factor_year {}, + crisis_winner_prestige_factor_base {}, + crisis_winner_prestige_factor_year {}, + crisis_winner_relations_impact {}, + back_crisis_diplomatic_cost {}, + back_crisis_relation_on_accept {}, + back_crisis_relation_on_decline {}, + crisis_temperature_on_offer_decline {}, + crisis_temperature_participant_factor {}, + crisis_temperature_on_mobilize {}, + crisis_wargoal_infamy_mult {}, + crisis_wargoal_prestige_mult {}, + crisis_wargoal_militancy_mult {}, + crisis_interest_war_exhaustion_limit {}, + rank_1_tension_decay {}, + rank_2_tension_decay {}, + rank_3_tension_decay {}, + rank_4_tension_decay {}, + rank_5_tension_decay {}, + rank_6_tension_decay {}, + rank_7_tension_decay {}, + rank_8_tension_decay {}, + tws_fulfilled_speed {}, + tws_not_fulfilled_speed {}, + tws_grace_period_days {}, + tws_cb_limit_default {}, + tws_fulfilled_idle_space {}, + tws_battle_min_count {}, + tws_battle_max_aspect {}, + large_population_influence_penalty {}, + lone_backer_prestige_factor {} {} + +std::string_view DiplomacyDefines::get_name() const { + return "diplomacy"; +} + +node_callback_t DiplomacyDefines::expect_defines() { + // The key map entries are added in two separate function calls, half each time, as adding them all at once causes a + // runtime crash, presumably due to a limit on the number of loose lambda functions that can exist at the same time. + + key_map_t key_map; + + add_key_map_entries( + key_map, + "PEACE_COST_ADD_TO_SPHERE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_cost_add_to_sphere)), + "PEACE_COST_RELEASE_PUPPET", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_cost_release_puppet)), + "PEACE_COST_MAKE_PUPPET", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_cost_make_puppet)), + "PEACE_COST_DISARMAMENT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_cost_disarmament)), + "PEACE_COST_DESTROY_FORTS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_cost_destroy_forts)), + "PEACE_COST_DESTROY_NAVAL_BASES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(peace_cost_destroy_naval_bases)), + "PEACE_COST_REPARATIONS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_cost_reparations)), + "PEACE_COST_TRANSFER_PROVINCES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(peace_cost_transfer_provinces)), + "PEACE_COST_REMOVE_CORES", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_cost_remove_cores)), + "PEACE_COST_PRESTIGE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_cost_prestige)), + "PEACE_COST_CONCEDE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_cost_concede)), + "PEACE_COST_STATUS_QUO", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_cost_status_quo)), + "PEACE_COST_ANNEX", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_cost_annex)), + "PEACE_COST_DEMAND_STATE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_cost_demand_state)), + "PEACE_COST_INSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(peace_cost_install_communist_gov_type)), + "PEACE_COST_UNINSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(peace_cost_uninstall_communist_gov_type)), + "PEACE_COST_COLONY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_cost_colony)), + "INFAMY_ADD_TO_SPHERE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_add_to_sphere)), + "INFAMY_RELEASE_PUPPET", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_release_puppet)), + "INFAMY_MAKE_PUPPET", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_make_puppet)), + "INFAMY_DISARMAMENT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_disarmament)), + "INFAMY_DESTROY_FORTS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_destroy_forts)), + "INFAMY_DESTROY_NAVAL_BASES", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_destroy_naval_bases)), + "INFAMY_REPARATIONS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_reparations)), + "INFAMY_TRANSFER_PROVINCES", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_transfer_provinces)), + "INFAMY_REMOVE_CORES", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_remove_cores)), + "INFAMY_PRESTIGE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_prestige)), + "INFAMY_CONCEDE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_concede)), + "INFAMY_STATUS_QUO", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_status_quo)), + "INFAMY_ANNEX", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_annex)), + "INFAMY_DEMAND_STATE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_demand_state)), + "INFAMY_INSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(infamy_install_communist_gov_type)), + "INFAMY_UNINSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(infamy_uninstall_communist_gov_type)), + "INFAMY_COLONY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_colony)), + "PRESTIGE_ADD_TO_SPHERE_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_add_to_sphere_base)), + "PRESTIGE_RELEASE_PUPPET_BASE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(prestige_release_puppet_base)), + "PRESTIGE_MAKE_PUPPET_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_make_puppet_base)), + "PRESTIGE_DISARMAMENT_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_disarmament_base)), + "PRESTIGE_DESTROY_FORTS_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_destroy_forts_base)), + "PRESTIGE_DESTROY_NAVAL_BASES_BASE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(prestige_destroy_naval_bases_base)), + "PRESTIGE_REPARATIONS_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_reparations_base)), + "PRESTIGE_TRANSFER_PROVINCES_BASE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(prestige_transfer_provinces_base)), + "PRESTIGE_REMOVE_CORES_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_remove_cores_base)), + "PRESTIGE_PRESTIGE_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_prestige_base)), + "PRESTIGE_CONCEDE_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_concede_base)), + "PRESTIGE_STATUS_QUO_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_status_quo_base)), + "PRESTIGE_ANNEX_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_annex_base)), + "PRESTIGE_DEMAND_STATE_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_demand_state_base)), + "PRESTIGE_CLEAR_UNION_SPHERE_BASE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(prestige_clear_union_sphere_base)), + "PRESTIGE_GUNBOAT_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_gunboat_base)), + "PRESTIGE_INSTALL_COMMUNIST_GOV_TYPE_BASE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(prestige_install_communist_gov_type_base)), + "PRESTIGE_UNINSTALL_COMMUNIST_GOV_TYPE_BASE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(prestige_uninstall_communist_gov_type_base)), + "PRESTIGE_COLONY_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_colony_base)), + "PRESTIGE_ADD_TO_SPHERE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_add_to_sphere)), + "PRESTIGE_RELEASE_PUPPET", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_release_puppet)), + "PRESTIGE_MAKE_PUPPET", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_make_puppet)), + "PRESTIGE_DISARMAMENT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_disarmament)), + "PRESTIGE_DESTROY_FORTS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_destroy_forts)), + "PRESTIGE_DESTROY_NAVAL_BASES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(prestige_destroy_naval_bases)), + "PRESTIGE_REPARATIONS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_reparations)), + "PRESTIGE_TRANSFER_PROVINCES", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_transfer_provinces)), + "PRESTIGE_REMOVE_CORES", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_remove_cores)), + "PRESTIGE_PRESTIGE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_prestige)), + "PRESTIGE_CONCEDE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_concede)), + "PRESTIGE_STATUS_QUO", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_status_quo)), + "PRESTIGE_ANNEX", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_annex)), + "PRESTIGE_DEMAND_STATE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_demand_state)), + "PRESTIGE_CLEAR_UNION_SPHERE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_clear_union_sphere)), + "PRESTIGE_GUNBOAT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_gunboat)), + "PRESTIGE_INSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(prestige_install_communist_gov_type)), + "PRESTIGE_UNINSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(prestige_uninstall_communist_gov_type)), + "PRESTIGE_COLONY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_colony)), + "BREAKTRUCE_INFAMY_ADD_TO_SPHERE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_infamy_add_to_sphere)), + "BREAKTRUCE_INFAMY_RELEASE_PUPPET", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_infamy_release_puppet)), + "BREAKTRUCE_INFAMY_MAKE_PUPPET", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_infamy_make_puppet)), + "BREAKTRUCE_INFAMY_DISARMAMENT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_infamy_disarmament)), + "BREAKTRUCE_INFAMY_DESTROY_FORTS", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_infamy_destroy_forts)), + "BREAKTRUCE_INFAMY_DESTROY_NAVAL_BASES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_infamy_destroy_naval_bases)), + "BREAKTRUCE_INFAMY_REPARATIONS", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_infamy_reparations)), + "BREAKTRUCE_INFAMY_TRANSFER_PROVINCES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_infamy_transfer_provinces)), + "BREAKTRUCE_INFAMY_REMOVE_CORES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_infamy_remove_cores)), + "BREAKTRUCE_INFAMY_PRESTIGE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(breaktruce_infamy_prestige)), + "BREAKTRUCE_INFAMY_CONCEDE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(breaktruce_infamy_concede)), + "BREAKTRUCE_INFAMY_STATUS_QUO", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_infamy_status_quo)), + "BREAKTRUCE_INFAMY_ANNEX", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(breaktruce_infamy_annex)), + "BREAKTRUCE_INFAMY_DEMAND_STATE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_infamy_demand_state)), + "BREAKTRUCE_INFAMY_INSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_infamy_install_communist_gov_type)), + "BREAKTRUCE_INFAMY_UNINSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_infamy_uninstall_communist_gov_type)), + "BREAKTRUCE_INFAMY_COLONY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(breaktruce_infamy_colony)), + "BREAKTRUCE_PRESTIGE_ADD_TO_SPHERE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_prestige_add_to_sphere)), + "BREAKTRUCE_PRESTIGE_RELEASE_PUPPET", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_prestige_release_puppet)), + "BREAKTRUCE_PRESTIGE_MAKE_PUPPET", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_prestige_make_puppet)), + "BREAKTRUCE_PRESTIGE_DISARMAMENT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_prestige_disarmament)), + "BREAKTRUCE_PRESTIGE_DESTROY_FORTS", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_prestige_destroy_forts)), + "BREAKTRUCE_PRESTIGE_DESTROY_NAVAL_BASES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_prestige_destroy_naval_bases)), + "BREAKTRUCE_PRESTIGE_REPARATIONS", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_prestige_reparations)), + "BREAKTRUCE_PRESTIGE_TRANSFER_PROVINCES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_prestige_transfer_provinces)), + "BREAKTRUCE_PRESTIGE_REMOVE_CORES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_prestige_remove_cores)), + "BREAKTRUCE_PRESTIGE_PRESTIGE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_prestige_prestige)), + "BREAKTRUCE_PRESTIGE_CONCEDE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(breaktruce_prestige_concede)), + "BREAKTRUCE_PRESTIGE_STATUS_QUO", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_prestige_status_quo)), + "BREAKTRUCE_PRESTIGE_ANNEX", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(breaktruce_prestige_annex)), + "BREAKTRUCE_PRESTIGE_DEMAND_STATE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_prestige_demand_state)), + "BREAKTRUCE_PRESTIGE_INSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_prestige_install_communist_gov_type)), + "BREAKTRUCE_PRESTIGE_UNINSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_prestige_uninstall_communist_gov_type)), + "BREAKTRUCE_PRESTIGE_COLONY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(breaktruce_prestige_colony)), + "BREAKTRUCE_MILITANCY_ADD_TO_SPHERE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_add_to_sphere)), + "BREAKTRUCE_MILITANCY_RELEASE_PUPPET", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_release_puppet)), + "BREAKTRUCE_MILITANCY_MAKE_PUPPET", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_make_puppet)), + "BREAKTRUCE_MILITANCY_DISARMAMENT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_disarmament)), + "BREAKTRUCE_MILITANCY_DESTROY_FORTS", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_destroy_forts)), + "BREAKTRUCE_MILITANCY_DESTROY_NAVAL_BASES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_destroy_naval_bases)), + "BREAKTRUCE_MILITANCY_REPARATIONS", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_reparations)), + "BREAKTRUCE_MILITANCY_TRANSFER_PROVINCES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_transfer_provinces)), + "BREAKTRUCE_MILITANCY_REMOVE_CORES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_remove_cores)), + "BREAKTRUCE_MILITANCY_PRESTIGE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_prestige)), + "BREAKTRUCE_MILITANCY_CONCEDE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_concede)), + "BREAKTRUCE_MILITANCY_STATUS_QUO", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_status_quo)), + "BREAKTRUCE_MILITANCY_ANNEX", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(breaktruce_militancy_annex)), + "BREAKTRUCE_MILITANCY_DEMAND_STATE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_demand_state)), + "BREAKTRUCE_MILITANCY_INSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_install_communist_gov_type)), + "BREAKTRUCE_MILITANCY_UNINSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_uninstall_communist_gov_type)), + "BREAKTRUCE_MILITANCY_COLONY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(breaktruce_militancy_colony)), + "GOODRELATION_INFAMY_ADD_TO_SPHERE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_infamy_add_to_sphere)), + "GOODRELATION_INFAMY_RELEASE_PUPPET", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_infamy_release_puppet)), + "GOODRELATION_INFAMY_MAKE_PUPPET", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_infamy_make_puppet)), + "GOODRELATION_INFAMY_DISARMAMENT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_infamy_disarmament)), + "GOODRELATION_INFAMY_DESTROY_FORTS", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_infamy_destroy_forts)), + "GOODRELATION_INFAMY_DESTROY_NAVAL_BASES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_infamy_destroy_naval_bases)), + "GOODRELATION_INFAMY_REPARATIONS", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_infamy_reparations)), + "GOODRELATION_INFAMY_TRANSFER_PROVINCES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_infamy_transfer_provinces)), + "GOODRELATION_INFAMY_REMOVE_CORES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_infamy_remove_cores)), + "GOODRELATION_INFAMY_PRESTIGE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_infamy_prestige)), + "GOODRELATION_INFAMY_CONCEDE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(goodrelation_infamy_concede)), + "GOODRELATION_INFAMY_STATUS_QUO", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_infamy_status_quo)), + "GOODRELATION_INFAMY_ANNEX", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(goodrelation_infamy_annex)), + "GOODRELATION_INFAMY_DEMAND_STATE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_infamy_demand_state)), + "GOODRELATION_INFAMY_INSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_infamy_install_communist_gov_type)), + "GOODRELATION_INFAMY_UNINSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_infamy_uninstall_communist_gov_type)), + "GOODRELATION_INFAMY_COLONY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(goodrelation_infamy_colony)), + "GOODRELATION_PRESTIGE_ADD_TO_SPHERE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_add_to_sphere)), + "GOODRELATION_PRESTIGE_RELEASE_PUPPET", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_release_puppet)), + "GOODRELATION_PRESTIGE_MAKE_PUPPET", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_make_puppet)), + "GOODRELATION_PRESTIGE_DISARMAMENT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_disarmament)), + "GOODRELATION_PRESTIGE_DESTROY_FORTS", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_destroy_forts)), + "GOODRELATION_PRESTIGE_DESTROY_NAVAL_BASES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_destroy_naval_bases)), + "GOODRELATION_PRESTIGE_REPARATIONS", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_reparations)), + "GOODRELATION_PRESTIGE_TRANSFER_PROVINCES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_transfer_provinces)), + "GOODRELATION_PRESTIGE_REMOVE_CORES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_remove_cores)), + "GOODRELATION_PRESTIGE_PRESTIGE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_prestige)), + "GOODRELATION_PRESTIGE_CONCEDE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_concede)), + "GOODRELATION_PRESTIGE_STATUS_QUO", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_status_quo)), + "GOODRELATION_PRESTIGE_ANNEX", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(goodrelation_prestige_annex)), + "GOODRELATION_PRESTIGE_DEMAND_STATE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_demand_state)), + "GOODRELATION_PRESTIGE_INSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_install_communist_gov_type)), + "GOODRELATION_PRESTIGE_UNINSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_uninstall_communist_gov_type)), + "GOODRELATION_PRESTIGE_COLONY", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_colony)), + "GOODRELATION_MILITANCY_ADD_TO_SPHERE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_add_to_sphere)), + "GOODRELATION_MILITANCY_RELEASE_PUPPET", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_release_puppet)), + "GOODRELATION_MILITANCY_MAKE_PUPPET", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_make_puppet)), + "GOODRELATION_MILITANCY_DISARMAMENT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_disarmament)), + "GOODRELATION_MILITANCY_DESTROY_FORTS", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_destroy_forts)), + "GOODRELATION_MILITANCY_DESTROY_NAVAL_BASES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_destroy_naval_bases)), + "GOODRELATION_MILITANCY_REPARATIONS", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_reparations)), + "GOODRELATION_MILITANCY_TRANSFER_PROVINCES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_transfer_provinces)), + "GOODRELATION_MILITANCY_REMOVE_CORES", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_remove_cores)), + "GOODRELATION_MILITANCY_PRESTIGE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_prestige)), + "GOODRELATION_MILITANCY_CONCEDE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_concede)), + "GOODRELATION_MILITANCY_STATUS_QUO", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_status_quo)), + "GOODRELATION_MILITANCY_ANNEX", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_annex)), + "GOODRELATION_MILITANCY_DEMAND_STATE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_demand_state)), + "GOODRELATION_MILITANCY_INSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_install_communist_gov_type)), + "GOODRELATION_MILITANCY_UNINSTALL_COMMUNIST_GOV_TYPE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_uninstall_communist_gov_type)), + "GOODRELATION_MILITANCY_COLONY", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_colony)) + ); + + add_key_map_entries( + key_map, + "WAR_PRESTIGE_COST_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(war_prestige_cost_base)), + "WAR_PRESTIGE_COST_HIGH_PRESTIGE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(war_prestige_cost_high_prestige)), + "WAR_PRESTIGE_COST_NEG_PRESTIGE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(war_prestige_cost_neg_prestige)), + "WAR_PRESTIGE_COST_TRUCE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(war_prestige_cost_truce)), + "WAR_PRESTIGE_COST_HONOR_ALLIANCE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(war_prestige_cost_honor_alliance)), + "WAR_PRESTIGE_COST_HONOR_GUARNATEE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(war_prestige_cost_honor_guarnatee)), + "WAR_PRESTIGE_COST_UNCIVILIZED", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(war_prestige_cost_uncivilized)), + "WAR_PRESTIGE_COST_CORE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(war_prestige_cost_core)), + "WAR_FAILED_GOAL_MILITANCY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(war_failed_goal_militancy)), + "WAR_FAILED_GOAL_PRESTIGE_BASE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(war_failed_goal_prestige_base)), + "WAR_FAILED_GOAL_PRESTIGE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(war_failed_goal_prestige)), + "DISCREDIT_DAYS", ONE_EXACTLY, expect_days(assign_variable_callback(discredit_days)), + "DISCREDIT_INFLUENCE_COST_FACTOR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(discredit_influence_cost_factor)), + "DISCREDIT_INFLUENCE_GAIN_FACTOR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(discredit_influence_gain_factor)), + "BANEMBASSY_DAYS", ONE_EXACTLY, expect_days(assign_variable_callback(banembassy_days)), + "DECLAREWAR_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(declarewar_relation_on_accept)), + "DECLAREWAR_DIPLOMATIC_COST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(declarewar_diplomatic_cost)), + "ADDWARGOAL_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(addwargoal_relation_on_accept)), + "ADDWARGOAL_DIPLOMATIC_COST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(addwargoal_diplomatic_cost)), + "ADD_UNJUSTIFIED_GOAL_BADBOY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(add_unjustified_goal_badboy)), + "PEACE_RELATION_ON_ACCEPT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_relation_on_accept)), + "PEACE_RELATION_ON_DECLINE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_relation_on_decline)), + "PEACE_DIPLOMATIC_COST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_diplomatic_cost)), + "ALLIANCE_RELATION_ON_ACCEPT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(alliance_relation_on_accept)), + "ALLIANCE_RELATION_ON_DECLINE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(alliance_relation_on_decline)), + "ALLIANCE_DIPLOMATIC_COST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(alliance_diplomatic_cost)), + "CANCELALLIANCE_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(cancelalliance_relation_on_accept)), + "CANCELALLIANCE_DIPLOMATIC_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(cancelalliance_diplomatic_cost)), + "CALLALLY_RELATION_ON_ACCEPT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(callally_relation_on_accept)), + "CALLALLY_RELATION_ON_DECLINE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(callally_relation_on_decline)), + "CALLALLY_DIPLOMATIC_COST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(callally_diplomatic_cost)), + "ASKMILACCESS_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(askmilaccess_relation_on_accept)), + "ASKMILACCESS_RELATION_ON_DECLINE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(askmilaccess_relation_on_decline)), + "ASKMILACCESS_DIPLOMATIC_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(askmilaccess_diplomatic_cost)), + "CANCELASKMILACCESS_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(cancelaskmilaccess_relation_on_accept)), + "CANCELASKMILACCESS_DIPLOMATIC_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(cancelaskmilaccess_diplomatic_cost)), + "GIVEMILACCESS_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(givemilaccess_relation_on_accept)), + "GIVEMILACCESS_RELATION_ON_DECLINE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(givemilaccess_relation_on_decline)), + "GIVEMILACCESS_DIPLOMATIC_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(givemilaccess_diplomatic_cost)), + "CANCELGIVEMILACCESS_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(cancelgivemilaccess_relation_on_accept)), + "CANCELGIVEMILACCESS_DIPLOMATIC_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(cancelgivemilaccess_diplomatic_cost)), + "WARSUBSIDY_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(warsubsidy_relation_on_accept)), + "WARSUBSIDY_DIPLOMATIC_COST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(warsubsidy_diplomatic_cost)), + "CANCELWARSUBSIDY_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(cancelwarsubsidy_relation_on_accept)), + "CANCELWARSUBSIDY_DIPLOMATIC_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(cancelwarsubsidy_diplomatic_cost)), + "DISCREDIT_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(discredit_relation_on_accept)), + "DISCREDIT_INFLUENCE_COST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(discredit_influence_cost)), + "EXPELADVISORS_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(expeladvisors_relation_on_accept)), + "EXPELADVISORS_INFLUENCE_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(expeladvisors_influence_cost)), + "CEASECOLONIZATION_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(ceasecolonization_relation_on_accept)), + "CEASECOLONIZATION_RELATION_ON_DECLINE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(ceasecolonization_relation_on_decline)), + "CEASECOLONIZATION_DIPLOMATIC_COST", ONE_OR_MORE, // Appears twice in vanilla! + expect_fixed_point(assign_variable_callback(ceasecolonization_diplomatic_cost)), + "BANEMBASSY_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(banembassy_relation_on_accept)), + "BANEMBASSY_INFLUENCE_COST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(banembassy_influence_cost)), + "INCREASERELATION_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(increaserelation_relation_on_accept)), + "INCREASERELATION_RELATION_ON_DECLINE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(increaserelation_relation_on_decline)), + "INCREASERELATION_DIPLOMATIC_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(increaserelation_diplomatic_cost)), + "DECREASERELATION_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(decreaserelation_relation_on_accept)), + "DECREASERELATION_DIPLOMATIC_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(decreaserelation_diplomatic_cost)), + "ADDTOSPHERE_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(addtosphere_relation_on_accept)), + "ADDTOSPHERE_INFLUENCE_COST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(addtosphere_influence_cost)), + "REMOVEFROMSPHERE_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(removefromsphere_relation_on_accept)), + "REMOVEFROMSPHERE_INFLUENCE_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(removefromsphere_influence_cost)), + "REMOVEFROMSPHERE_PRESTIGE_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(removefromsphere_prestige_cost)), + "REMOVEFROMSPHERE_INFAMY_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(removefromsphere_infamy_cost)), + "INCREASEOPINION_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(increaseopinion_relation_on_accept)), + "INCREASEOPINION_INFLUENCE_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(increaseopinion_influence_cost)), + "DECREASEOPINION_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(decreaseopinion_relation_on_accept)), + "DECREASEOPINION_INFLUENCE_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(decreaseopinion_influence_cost)), + "MAKE_CB_DIPLOMATIC_COST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(make_cb_diplomatic_cost)), + "MAKE_CB_RELATION_ON_ACCEPT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(make_cb_relation_on_accept)), + "DISARMAMENT_ARMY_HIT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(disarmed_penalty)), + "REPARATIONS_TAX_HIT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(reparations_tax_hit)), + "PRESTIGE_REDUCTION_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_reduction_base)), + "PRESTIGE_REDUCTION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(prestige_reduction)), + "REPARATIONS_YEARS", ONE_EXACTLY, expect_years(assign_variable_callback(reparations_duration)), + "MIN_WARSCORE_TO_INTERVENE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(min_warscore_to_intervene)), + "MIN_MONTHS_TO_INTERVENE", ONE_EXACTLY, expect_months(assign_variable_callback(min_time_to_intervene)), + "MAX_WARSCORE_FROM_BATTLES", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(max_warscore_from_battles)), + "GUNBOAT_DIPLOMATIC_COST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(gunboat_diplomatic_cost)), + "GUNBOAT_RELATION_ON_ACCEPT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(gunboat_relation_on_accept)), + "WARGOAL_JINGOISM_REQUIREMENT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(wargoal_jingoism_requirement)), + "LIBERATE_STATE_RELATION_INCREASE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(liberate_state_relation_increase)), + "DISHONORED_CALLALLY_PRESTIGE_PENALTY", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(dishonored_callally_prestige_penalty)), + "BASE_TRUCE_MONTHS", ONE_EXACTLY, expect_months(assign_variable_callback(base_truce_duration)), + "MAX_INFLUENCE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(max_influence)), + "WARSUBSIDIES_PERCENT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(warsubsidies_percent)), + "NEIGHBOUR_BONUS_INFLUENCE_PERCENT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(neighbour_bonus_influence_percent)), + "SPHERE_NEIGHBOUR_BONUS_INFLUENCE_PERCENT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(sphere_neighbour_bonus_influence_percent)), + "OTHER_CONTINENT_BONUS_INFLUENCE_PERCENT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(other_continent_bonus_influence_percent)), + "PUPPET_BONUS_INFLUENCE_PERCENT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(puppet_bonus_influence_percent)), + "RELEASE_NATION_PRESTIGE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(release_nation_prestige)), + "RELEASE_NATION_INFAMY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(release_nation_infamy)), + "INFAMY_CLEAR_UNION_SPHERE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_clear_union_sphere)), + "BREAKTRUCE_INFAMY_CLEAR_UNION_SPHERE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_infamy_clear_union_sphere)), + "BREAKTRUCE_PRESTIGE_CLEAR_UNION_SPHERE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_prestige_clear_union_sphere)), + "BREAKTRUCE_MILITANCY_CLEAR_UNION_SPHERE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_clear_union_sphere)), + "GOODRELATION_INFAMY_CLEAR_UNION_SPHERE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_infamy_clear_union_sphere)), + "GOODRELATION_PRESTIGE_CLEAR_UNION_SPHERE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_clear_union_sphere)), + "GOODRELATION_MILITANCY_CLEAR_UNION_SPHERE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_clear_union_sphere)), + "PEACE_COST_CLEAR_UNION_SPHERE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(peace_cost_clear_union_sphere)), + "GOOD_PEACE_REFUSAL_MILITANCY", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(good_peace_refusal_militancy)), + "GOOD_PEACE_REFUSAL_WAREXH", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(good_peace_refusal_warexh)), + "PEACE_COST_GUNBOAT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(peace_cost_gunboat)), + "INFAMY_GUNBOAT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(infamy_gunboat)), + "BREAKTRUCE_INFAMY_GUNBOAT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(breaktruce_infamy_gunboat)), + "BREAKTRUCE_PRESTIGE_GUNBOAT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(breaktruce_prestige_gunboat)), + "BREAKTRUCE_MILITANCY_GUNBOAT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(breaktruce_militancy_gunboat)), + "GOODRELATION_INFAMY_GUNBOAT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(goodrelation_infamy_gunboat)), + "GOODRELATION_PRESTIGE_GUNBOAT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_prestige_gunboat)), + "GOODRELATION_MILITANCY_GUNBOAT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(goodrelation_militancy_gunboat)), + "CB_GENERATION_BASE_SPEED", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(cb_generation_base_speed)), + "CB_GENERATION_SPEED_BONUS_ON_COLONY_COMPETITION", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(cb_generation_speed_bonus_on_colony_competition)), + "CB_GENERATION_SPEED_BONUS_ON_COLONY_COMPETITION_TROOPS_PRESENCE", ONE_EXACTLY, expect_fixed_point( + assign_variable_callback(cb_generation_speed_bonus_on_colony_competition_troops_presence) + ), + "MAKE_CB_RELATION_LIMIT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(make_cb_relation_limit)), + "CB_DETECTION_CHANCE_BASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(cb_detection_chance_base)), + "INVESTMENT_INFLUENCE_DEFENSE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(investment_influence_defense)), + "RELATION_INFLUENCE_MODIFIER", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(relation_influence_modifier)), + "ON_CB_DETECTED_RELATION_CHANGE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(on_cb_detected_relation_change)), + "GW_INTERVENE_MIN_RELATIONS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(gw_intervene_min_relations)), + "GW_INTERVENE_MAX_EXHAUSTION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(gw_intervene_max_exhaustion)), + "GW_JUSTIFY_CB_BADBOY_IMPACT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(gw_justify_cb_badboy_impact)), + "GW_CB_CONSTRUCTION_SPEED", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(gw_cb_construction_speed)), + "GW_WARGOAL_JINGOISM_REQUIREMENT_MOD", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(gw_wargoal_jingoism_requirement_mod)), + "GW_WARSCORE_COST_MOD", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(gw_warscore_cost_mod)), + "GW_WARSCORE_COST_MOD_2", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(gw_warscore_cost_mod_2)), + "GW_WARSCORE_2_THRESHOLD", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(gw_warscore_2_threshold)), + "TENSION_DECAY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(tension_decay)), + "TENSION_FROM_CB", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(tension_from_cb)), + "TENSION_FROM_MOVEMENT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(tension_from_movement)), + "TENSION_FROM_MOVEMENT_MAX", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(tension_from_movement_max)), + "AT_WAR_TENSION_DECAY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(at_war_tension_decay)), + "TENSION_ON_CB_DISCOVERED", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(tension_on_cb_discovered)), + "TENSION_ON_REVOLT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(tension_on_revolt)), + "TENSION_WHILE_CRISIS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(tension_while_crisis)), + "CRISIS_COOLDOWN_MONTHS", ONE_EXACTLY, expect_months(assign_variable_callback(crisis_cooldown_duration)), + "CRISIS_BASE_CHANCE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(crisis_base_chance)), + "CRISIS_TEMPERATURE_INCREASE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(crisis_temperature_increase)), + "CRISIS_OFFER_DIPLOMATIC_COST", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(crisis_offer_diplomatic_cost)), + "CRISIS_OFFER_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(crisis_offer_relation_on_accept)), + "CRISIS_OFFER_RELATION_ON_DECLINE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(crisis_offer_relation_on_decline)), + "CRISIS_DID_NOT_TAKE_SIDE_PRESTIGE_FACTOR_BASE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(crisis_did_not_take_side_prestige_factor_base)), + "CRISIS_DID_NOT_TAKE_SIDE_PRESTIGE_FACTOR_YEAR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(crisis_did_not_take_side_prestige_factor_year)), + "CRISIS_WINNER_PRESTIGE_FACTOR_BASE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(crisis_winner_prestige_factor_base)), + "CRISIS_WINNER_PRESTIGE_FACTOR_YEAR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(crisis_winner_prestige_factor_year)), + "CRISIS_WINNER_RELATIONS_IMPACT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(crisis_winner_relations_impact)), + "BACK_CRISIS_DIPLOMATIC_COST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(back_crisis_diplomatic_cost)), + "BACK_CRISIS_RELATION_ON_ACCEPT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(back_crisis_relation_on_accept)), + "BACK_CRISIS_RELATION_ON_DECLINE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(back_crisis_relation_on_decline)), + "CRISIS_TEMPERATURE_ON_OFFER_DECLINE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(crisis_temperature_on_offer_decline)), + "CRISIS_TEMPERATURE_PARTICIPANT_FACTOR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(crisis_temperature_participant_factor)), + "CRISIS_TEMPERATURE_ON_MOBILIZE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(crisis_temperature_on_mobilize)), + "CRISIS_WARGOAL_INFAMY_MULT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(crisis_wargoal_infamy_mult)), + "CRISIS_WARGOAL_PRESTIGE_MULT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(crisis_wargoal_prestige_mult)), + "CRISIS_WARGOAL_MILITANCY_MULT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(crisis_wargoal_militancy_mult)), + "CRISIS_INTEREST_WAR_EXHAUSTION_LIMIT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(crisis_interest_war_exhaustion_limit)), + "RANK_1_TENSION_DECAY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(rank_1_tension_decay)), + "RANK_2_TENSION_DECAY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(rank_2_tension_decay)), + "RANK_3_TENSION_DECAY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(rank_3_tension_decay)), + "RANK_4_TENSION_DECAY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(rank_4_tension_decay)), + "RANK_5_TENSION_DECAY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(rank_5_tension_decay)), + "RANK_6_TENSION_DECAY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(rank_6_tension_decay)), + "RANK_7_TENSION_DECAY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(rank_7_tension_decay)), + "RANK_8_TENSION_DECAY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(rank_8_tension_decay)), + "TWS_FULFILLED_SPEED", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(tws_fulfilled_speed)), + "TWS_NOT_FULFILLED_SPEED", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(tws_not_fulfilled_speed)), + "TWS_GRACE_PERIOD_DAYS", ONE_EXACTLY, expect_days(assign_variable_callback(tws_grace_period_days)), + "TWS_CB_LIMIT_DEFAULT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(tws_cb_limit_default)), + "TWS_FULFILLED_IDLE_SPACE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(tws_fulfilled_idle_space)), + "TWS_BATTLE_MIN_COUNT", ONE_EXACTLY, expect_uint(assign_variable_callback(tws_battle_min_count)), + "TWS_BATTLE_MAX_ASPECT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(tws_battle_max_aspect)), + "LARGE_POPULATION_INFLUENCE_PENALTY", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(large_population_influence_penalty)), + "LONE_BACKER_PRESTIGE_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(lone_backer_prestige_factor)) + ); + + return expect_dictionary_key_map(std::move(key_map)); +} diff --git a/src/openvic-simulation/defines/DiplomacyDefines.hpp b/src/openvic-simulation/defines/DiplomacyDefines.hpp new file mode 100644 index 0000000..d9195ab --- /dev/null +++ b/src/openvic-simulation/defines/DiplomacyDefines.hpp @@ -0,0 +1,368 @@ +#pragma once + +#include "openvic-simulation/dataloader/NodeTools.hpp" +#include "openvic-simulation/types/Date.hpp" +#include "openvic-simulation/types/fixed_point/FixedPoint.hpp" +#include "openvic-simulation/utility/Getters.hpp" + +namespace OpenVic { + struct DefineManager; + + struct DiplomacyDefines { + friend struct DefineManager; + + private: + fixed_point_t PROPERTY(peace_cost_add_to_sphere); + fixed_point_t PROPERTY(peace_cost_release_puppet); + fixed_point_t PROPERTY(peace_cost_make_puppet); + fixed_point_t PROPERTY(peace_cost_disarmament); + fixed_point_t PROPERTY(peace_cost_destroy_forts); + fixed_point_t PROPERTY(peace_cost_destroy_naval_bases); + fixed_point_t PROPERTY(peace_cost_reparations); + fixed_point_t PROPERTY(peace_cost_transfer_provinces); + fixed_point_t PROPERTY(peace_cost_remove_cores); + fixed_point_t PROPERTY(peace_cost_prestige); + fixed_point_t PROPERTY(peace_cost_concede); + fixed_point_t PROPERTY(peace_cost_status_quo); + fixed_point_t PROPERTY(peace_cost_annex); + fixed_point_t PROPERTY(peace_cost_demand_state); + fixed_point_t PROPERTY(peace_cost_install_communist_gov_type); + fixed_point_t PROPERTY(peace_cost_uninstall_communist_gov_type); + fixed_point_t PROPERTY(peace_cost_colony); + fixed_point_t PROPERTY(infamy_add_to_sphere); + fixed_point_t PROPERTY(infamy_release_puppet); + fixed_point_t PROPERTY(infamy_make_puppet); + fixed_point_t PROPERTY(infamy_disarmament); + fixed_point_t PROPERTY(infamy_destroy_forts); + fixed_point_t PROPERTY(infamy_destroy_naval_bases); + fixed_point_t PROPERTY(infamy_reparations); + fixed_point_t PROPERTY(infamy_transfer_provinces); + fixed_point_t PROPERTY(infamy_remove_cores); + fixed_point_t PROPERTY(infamy_prestige); + fixed_point_t PROPERTY(infamy_concede); + fixed_point_t PROPERTY(infamy_status_quo); + fixed_point_t PROPERTY(infamy_annex); + fixed_point_t PROPERTY(infamy_demand_state); + fixed_point_t PROPERTY(infamy_install_communist_gov_type); + fixed_point_t PROPERTY(infamy_uninstall_communist_gov_type); + fixed_point_t PROPERTY(infamy_colony); + fixed_point_t PROPERTY(prestige_add_to_sphere_base); + fixed_point_t PROPERTY(prestige_release_puppet_base); + fixed_point_t PROPERTY(prestige_make_puppet_base); + fixed_point_t PROPERTY(prestige_disarmament_base); + fixed_point_t PROPERTY(prestige_destroy_forts_base); + fixed_point_t PROPERTY(prestige_destroy_naval_bases_base); + fixed_point_t PROPERTY(prestige_reparations_base); + fixed_point_t PROPERTY(prestige_transfer_provinces_base); + fixed_point_t PROPERTY(prestige_remove_cores_base); + fixed_point_t PROPERTY(prestige_prestige_base); + fixed_point_t PROPERTY(prestige_concede_base); + fixed_point_t PROPERTY(prestige_status_quo_base); + fixed_point_t PROPERTY(prestige_annex_base); + fixed_point_t PROPERTY(prestige_demand_state_base); + fixed_point_t PROPERTY(prestige_clear_union_sphere_base); + fixed_point_t PROPERTY(prestige_gunboat_base); + fixed_point_t PROPERTY(prestige_install_communist_gov_type_base); + fixed_point_t PROPERTY(prestige_uninstall_communist_gov_type_base); + fixed_point_t PROPERTY(prestige_colony_base); + fixed_point_t PROPERTY(prestige_add_to_sphere); + fixed_point_t PROPERTY(prestige_release_puppet); + fixed_point_t PROPERTY(prestige_make_puppet); + fixed_point_t PROPERTY(prestige_disarmament); + fixed_point_t PROPERTY(prestige_destroy_forts); + fixed_point_t PROPERTY(prestige_destroy_naval_bases); + fixed_point_t PROPERTY(prestige_reparations); + fixed_point_t PROPERTY(prestige_transfer_provinces); + fixed_point_t PROPERTY(prestige_remove_cores); + fixed_point_t PROPERTY(prestige_prestige); + fixed_point_t PROPERTY(prestige_concede); + fixed_point_t PROPERTY(prestige_status_quo); + fixed_point_t PROPERTY(prestige_annex); + fixed_point_t PROPERTY(prestige_demand_state); + fixed_point_t PROPERTY(prestige_clear_union_sphere); + fixed_point_t PROPERTY(prestige_gunboat); + fixed_point_t PROPERTY(prestige_install_communist_gov_type); + fixed_point_t PROPERTY(prestige_uninstall_communist_gov_type); + fixed_point_t PROPERTY(prestige_colony); + fixed_point_t PROPERTY(breaktruce_infamy_add_to_sphere); + fixed_point_t PROPERTY(breaktruce_infamy_release_puppet); + fixed_point_t PROPERTY(breaktruce_infamy_make_puppet); + fixed_point_t PROPERTY(breaktruce_infamy_disarmament); + fixed_point_t PROPERTY(breaktruce_infamy_destroy_forts); + fixed_point_t PROPERTY(breaktruce_infamy_destroy_naval_bases); + fixed_point_t PROPERTY(breaktruce_infamy_reparations); + fixed_point_t PROPERTY(breaktruce_infamy_transfer_provinces); + fixed_point_t PROPERTY(breaktruce_infamy_remove_cores); + fixed_point_t PROPERTY(breaktruce_infamy_prestige); + fixed_point_t PROPERTY(breaktruce_infamy_concede); + fixed_point_t PROPERTY(breaktruce_infamy_status_quo); + fixed_point_t PROPERTY(breaktruce_infamy_annex); + fixed_point_t PROPERTY(breaktruce_infamy_demand_state); + fixed_point_t PROPERTY(breaktruce_infamy_install_communist_gov_type); + fixed_point_t PROPERTY(breaktruce_infamy_uninstall_communist_gov_type); + fixed_point_t PROPERTY(breaktruce_infamy_colony); + fixed_point_t PROPERTY(breaktruce_prestige_add_to_sphere); + fixed_point_t PROPERTY(breaktruce_prestige_release_puppet); + fixed_point_t PROPERTY(breaktruce_prestige_make_puppet); + fixed_point_t PROPERTY(breaktruce_prestige_disarmament); + fixed_point_t PROPERTY(breaktruce_prestige_destroy_forts); + fixed_point_t PROPERTY(breaktruce_prestige_destroy_naval_bases); + fixed_point_t PROPERTY(breaktruce_prestige_reparations); + fixed_point_t PROPERTY(breaktruce_prestige_transfer_provinces); + fixed_point_t PROPERTY(breaktruce_prestige_remove_cores); + fixed_point_t PROPERTY(breaktruce_prestige_prestige); + fixed_point_t PROPERTY(breaktruce_prestige_concede); + fixed_point_t PROPERTY(breaktruce_prestige_status_quo); + fixed_point_t PROPERTY(breaktruce_prestige_annex); + fixed_point_t PROPERTY(breaktruce_prestige_demand_state); + fixed_point_t PROPERTY(breaktruce_prestige_install_communist_gov_type); + fixed_point_t PROPERTY(breaktruce_prestige_uninstall_communist_gov_type); + fixed_point_t PROPERTY(breaktruce_prestige_colony); + fixed_point_t PROPERTY(breaktruce_militancy_add_to_sphere); + fixed_point_t PROPERTY(breaktruce_militancy_release_puppet); + fixed_point_t PROPERTY(breaktruce_militancy_make_puppet); + fixed_point_t PROPERTY(breaktruce_militancy_disarmament); + fixed_point_t PROPERTY(breaktruce_militancy_destroy_forts); + fixed_point_t PROPERTY(breaktruce_militancy_destroy_naval_bases); + fixed_point_t PROPERTY(breaktruce_militancy_reparations); + fixed_point_t PROPERTY(breaktruce_militancy_transfer_provinces); + fixed_point_t PROPERTY(breaktruce_militancy_remove_cores); + fixed_point_t PROPERTY(breaktruce_militancy_prestige); + fixed_point_t PROPERTY(breaktruce_militancy_concede); + fixed_point_t PROPERTY(breaktruce_militancy_status_quo); + fixed_point_t PROPERTY(breaktruce_militancy_annex); + fixed_point_t PROPERTY(breaktruce_militancy_demand_state); + fixed_point_t PROPERTY(breaktruce_militancy_install_communist_gov_type); + fixed_point_t PROPERTY(breaktruce_militancy_uninstall_communist_gov_type); + fixed_point_t PROPERTY(breaktruce_militancy_colony); + fixed_point_t PROPERTY(goodrelation_infamy_add_to_sphere); + fixed_point_t PROPERTY(goodrelation_infamy_release_puppet); + fixed_point_t PROPERTY(goodrelation_infamy_make_puppet); + fixed_point_t PROPERTY(goodrelation_infamy_disarmament); + fixed_point_t PROPERTY(goodrelation_infamy_destroy_forts); + fixed_point_t PROPERTY(goodrelation_infamy_destroy_naval_bases); + fixed_point_t PROPERTY(goodrelation_infamy_reparations); + fixed_point_t PROPERTY(goodrelation_infamy_transfer_provinces); + fixed_point_t PROPERTY(goodrelation_infamy_remove_cores); + fixed_point_t PROPERTY(goodrelation_infamy_prestige); + fixed_point_t PROPERTY(goodrelation_infamy_concede); + fixed_point_t PROPERTY(goodrelation_infamy_status_quo); + fixed_point_t PROPERTY(goodrelation_infamy_annex); + fixed_point_t PROPERTY(goodrelation_infamy_demand_state); + fixed_point_t PROPERTY(goodrelation_infamy_install_communist_gov_type); + fixed_point_t PROPERTY(goodrelation_infamy_uninstall_communist_gov_type); + fixed_point_t PROPERTY(goodrelation_infamy_colony); + fixed_point_t PROPERTY(goodrelation_prestige_add_to_sphere); + fixed_point_t PROPERTY(goodrelation_prestige_release_puppet); + fixed_point_t PROPERTY(goodrelation_prestige_make_puppet); + fixed_point_t PROPERTY(goodrelation_prestige_disarmament); + fixed_point_t PROPERTY(goodrelation_prestige_destroy_forts); + fixed_point_t PROPERTY(goodrelation_prestige_destroy_naval_bases); + fixed_point_t PROPERTY(goodrelation_prestige_reparations); + fixed_point_t PROPERTY(goodrelation_prestige_transfer_provinces); + fixed_point_t PROPERTY(goodrelation_prestige_remove_cores); + fixed_point_t PROPERTY(goodrelation_prestige_prestige); + fixed_point_t PROPERTY(goodrelation_prestige_concede); + fixed_point_t PROPERTY(goodrelation_prestige_status_quo); + fixed_point_t PROPERTY(goodrelation_prestige_annex); + fixed_point_t PROPERTY(goodrelation_prestige_demand_state); + fixed_point_t PROPERTY(goodrelation_prestige_install_communist_gov_type); + fixed_point_t PROPERTY(goodrelation_prestige_uninstall_communist_gov_type); + fixed_point_t PROPERTY(goodrelation_prestige_colony); + fixed_point_t PROPERTY(goodrelation_militancy_add_to_sphere); + fixed_point_t PROPERTY(goodrelation_militancy_release_puppet); + fixed_point_t PROPERTY(goodrelation_militancy_make_puppet); + fixed_point_t PROPERTY(goodrelation_militancy_disarmament); + fixed_point_t PROPERTY(goodrelation_militancy_destroy_forts); + fixed_point_t PROPERTY(goodrelation_militancy_destroy_naval_bases); + fixed_point_t PROPERTY(goodrelation_militancy_reparations); + fixed_point_t PROPERTY(goodrelation_militancy_transfer_provinces); + fixed_point_t PROPERTY(goodrelation_militancy_remove_cores); + fixed_point_t PROPERTY(goodrelation_militancy_prestige); + fixed_point_t PROPERTY(goodrelation_militancy_concede); + fixed_point_t PROPERTY(goodrelation_militancy_status_quo); + fixed_point_t PROPERTY(goodrelation_militancy_annex); + fixed_point_t PROPERTY(goodrelation_militancy_demand_state); + fixed_point_t PROPERTY(goodrelation_militancy_install_communist_gov_type); + fixed_point_t PROPERTY(goodrelation_militancy_uninstall_communist_gov_type); + fixed_point_t PROPERTY(goodrelation_militancy_colony); + fixed_point_t PROPERTY(war_prestige_cost_base); + fixed_point_t PROPERTY(war_prestige_cost_high_prestige); + fixed_point_t PROPERTY(war_prestige_cost_neg_prestige); + fixed_point_t PROPERTY(war_prestige_cost_truce); + fixed_point_t PROPERTY(war_prestige_cost_honor_alliance); + fixed_point_t PROPERTY(war_prestige_cost_honor_guarnatee); + fixed_point_t PROPERTY(war_prestige_cost_uncivilized); + fixed_point_t PROPERTY(war_prestige_cost_core); + fixed_point_t PROPERTY(war_failed_goal_militancy); + fixed_point_t PROPERTY(war_failed_goal_prestige_base); + fixed_point_t PROPERTY(war_failed_goal_prestige); + Timespan PROPERTY(discredit_days); + fixed_point_t PROPERTY(discredit_influence_cost_factor); + fixed_point_t PROPERTY(discredit_influence_gain_factor); + Timespan PROPERTY(banembassy_days); + fixed_point_t PROPERTY(declarewar_relation_on_accept); + fixed_point_t PROPERTY(declarewar_diplomatic_cost); + fixed_point_t PROPERTY(addwargoal_relation_on_accept); + fixed_point_t PROPERTY(addwargoal_diplomatic_cost); + fixed_point_t PROPERTY(add_unjustified_goal_badboy); + fixed_point_t PROPERTY(peace_relation_on_accept); + fixed_point_t PROPERTY(peace_relation_on_decline); + fixed_point_t PROPERTY(peace_diplomatic_cost); + fixed_point_t PROPERTY(alliance_relation_on_accept); + fixed_point_t PROPERTY(alliance_relation_on_decline); + fixed_point_t PROPERTY(alliance_diplomatic_cost); + fixed_point_t PROPERTY(cancelalliance_relation_on_accept); + fixed_point_t PROPERTY(cancelalliance_diplomatic_cost); + fixed_point_t PROPERTY(callally_relation_on_accept); + fixed_point_t PROPERTY(callally_relation_on_decline); + fixed_point_t PROPERTY(callally_diplomatic_cost); + fixed_point_t PROPERTY(askmilaccess_relation_on_accept); + fixed_point_t PROPERTY(askmilaccess_relation_on_decline); + fixed_point_t PROPERTY(askmilaccess_diplomatic_cost); + fixed_point_t PROPERTY(cancelaskmilaccess_relation_on_accept); + fixed_point_t PROPERTY(cancelaskmilaccess_diplomatic_cost); + fixed_point_t PROPERTY(givemilaccess_relation_on_accept); + fixed_point_t PROPERTY(givemilaccess_relation_on_decline); + fixed_point_t PROPERTY(givemilaccess_diplomatic_cost); + fixed_point_t PROPERTY(cancelgivemilaccess_relation_on_accept); + fixed_point_t PROPERTY(cancelgivemilaccess_diplomatic_cost); + fixed_point_t PROPERTY(warsubsidy_relation_on_accept); + fixed_point_t PROPERTY(warsubsidy_diplomatic_cost); + fixed_point_t PROPERTY(cancelwarsubsidy_relation_on_accept); + fixed_point_t PROPERTY(cancelwarsubsidy_diplomatic_cost); + fixed_point_t PROPERTY(discredit_relation_on_accept); + fixed_point_t PROPERTY(discredit_influence_cost); + fixed_point_t PROPERTY(expeladvisors_relation_on_accept); + fixed_point_t PROPERTY(expeladvisors_influence_cost); + fixed_point_t PROPERTY(ceasecolonization_relation_on_accept); + fixed_point_t PROPERTY(ceasecolonization_relation_on_decline); + fixed_point_t PROPERTY(ceasecolonization_diplomatic_cost); + fixed_point_t PROPERTY(banembassy_relation_on_accept); + fixed_point_t PROPERTY(banembassy_influence_cost); + fixed_point_t PROPERTY(increaserelation_relation_on_accept); + fixed_point_t PROPERTY(increaserelation_relation_on_decline); + fixed_point_t PROPERTY(increaserelation_diplomatic_cost); + fixed_point_t PROPERTY(decreaserelation_relation_on_accept); + fixed_point_t PROPERTY(decreaserelation_diplomatic_cost); + fixed_point_t PROPERTY(addtosphere_relation_on_accept); + fixed_point_t PROPERTY(addtosphere_influence_cost); + fixed_point_t PROPERTY(removefromsphere_relation_on_accept); + fixed_point_t PROPERTY(removefromsphere_influence_cost); + fixed_point_t PROPERTY(removefromsphere_prestige_cost); + fixed_point_t PROPERTY(removefromsphere_infamy_cost); + fixed_point_t PROPERTY(increaseopinion_relation_on_accept); + fixed_point_t PROPERTY(increaseopinion_influence_cost); + fixed_point_t PROPERTY(decreaseopinion_relation_on_accept); + fixed_point_t PROPERTY(decreaseopinion_influence_cost); + fixed_point_t PROPERTY(make_cb_diplomatic_cost); + fixed_point_t PROPERTY(make_cb_relation_on_accept); + fixed_point_t PROPERTY(disarmed_penalty); + fixed_point_t PROPERTY(reparations_tax_hit); + fixed_point_t PROPERTY(prestige_reduction_base); + fixed_point_t PROPERTY(prestige_reduction); + Timespan PROPERTY(reparations_duration); + fixed_point_t PROPERTY(min_warscore_to_intervene); + Timespan PROPERTY(min_time_to_intervene); + fixed_point_t PROPERTY(max_warscore_from_battles); + fixed_point_t PROPERTY(gunboat_diplomatic_cost); + fixed_point_t PROPERTY(gunboat_relation_on_accept); + fixed_point_t PROPERTY(wargoal_jingoism_requirement); + fixed_point_t PROPERTY(liberate_state_relation_increase); + fixed_point_t PROPERTY(dishonored_callally_prestige_penalty); + Timespan PROPERTY(base_truce_duration); + fixed_point_t PROPERTY(max_influence); + fixed_point_t PROPERTY(warsubsidies_percent); + fixed_point_t PROPERTY(neighbour_bonus_influence_percent); + fixed_point_t PROPERTY(sphere_neighbour_bonus_influence_percent); + fixed_point_t PROPERTY(other_continent_bonus_influence_percent); + fixed_point_t PROPERTY(puppet_bonus_influence_percent); + fixed_point_t PROPERTY(release_nation_prestige); + fixed_point_t PROPERTY(release_nation_infamy); + fixed_point_t PROPERTY(infamy_clear_union_sphere); + fixed_point_t PROPERTY(breaktruce_infamy_clear_union_sphere); + fixed_point_t PROPERTY(breaktruce_prestige_clear_union_sphere); + fixed_point_t PROPERTY(breaktruce_militancy_clear_union_sphere); + fixed_point_t PROPERTY(goodrelation_infamy_clear_union_sphere); + fixed_point_t PROPERTY(goodrelation_prestige_clear_union_sphere); + fixed_point_t PROPERTY(goodrelation_militancy_clear_union_sphere); + fixed_point_t PROPERTY(peace_cost_clear_union_sphere); + fixed_point_t PROPERTY(good_peace_refusal_militancy); + fixed_point_t PROPERTY(good_peace_refusal_warexh); + fixed_point_t PROPERTY(peace_cost_gunboat); + fixed_point_t PROPERTY(infamy_gunboat); + fixed_point_t PROPERTY(breaktruce_infamy_gunboat); + fixed_point_t PROPERTY(breaktruce_prestige_gunboat); + fixed_point_t PROPERTY(breaktruce_militancy_gunboat); + fixed_point_t PROPERTY(goodrelation_infamy_gunboat); + fixed_point_t PROPERTY(goodrelation_prestige_gunboat); + fixed_point_t PROPERTY(goodrelation_militancy_gunboat); + fixed_point_t PROPERTY(cb_generation_base_speed); + fixed_point_t PROPERTY(cb_generation_speed_bonus_on_colony_competition); + fixed_point_t PROPERTY(cb_generation_speed_bonus_on_colony_competition_troops_presence); + fixed_point_t PROPERTY(make_cb_relation_limit); + fixed_point_t PROPERTY(cb_detection_chance_base); + fixed_point_t PROPERTY(investment_influence_defense); + fixed_point_t PROPERTY(relation_influence_modifier); + fixed_point_t PROPERTY(on_cb_detected_relation_change); + fixed_point_t PROPERTY(gw_intervene_min_relations); + fixed_point_t PROPERTY(gw_intervene_max_exhaustion); + fixed_point_t PROPERTY(gw_justify_cb_badboy_impact); + fixed_point_t PROPERTY(gw_cb_construction_speed); + fixed_point_t PROPERTY(gw_wargoal_jingoism_requirement_mod); + fixed_point_t PROPERTY(gw_warscore_cost_mod); + fixed_point_t PROPERTY(gw_warscore_cost_mod_2); + fixed_point_t PROPERTY(gw_warscore_2_threshold); + fixed_point_t PROPERTY(tension_decay); + fixed_point_t PROPERTY(tension_from_cb); + fixed_point_t PROPERTY(tension_from_movement); + fixed_point_t PROPERTY(tension_from_movement_max); + fixed_point_t PROPERTY(at_war_tension_decay); + fixed_point_t PROPERTY(tension_on_cb_discovered); + fixed_point_t PROPERTY(tension_on_revolt); + fixed_point_t PROPERTY(tension_while_crisis); + Timespan PROPERTY(crisis_cooldown_duration); + fixed_point_t PROPERTY(crisis_base_chance); + fixed_point_t PROPERTY(crisis_temperature_increase); + fixed_point_t PROPERTY(crisis_offer_diplomatic_cost); + fixed_point_t PROPERTY(crisis_offer_relation_on_accept); + fixed_point_t PROPERTY(crisis_offer_relation_on_decline); + fixed_point_t PROPERTY(crisis_did_not_take_side_prestige_factor_base); + fixed_point_t PROPERTY(crisis_did_not_take_side_prestige_factor_year); + fixed_point_t PROPERTY(crisis_winner_prestige_factor_base); + fixed_point_t PROPERTY(crisis_winner_prestige_factor_year); + fixed_point_t PROPERTY(crisis_winner_relations_impact); + fixed_point_t PROPERTY(back_crisis_diplomatic_cost); + fixed_point_t PROPERTY(back_crisis_relation_on_accept); + fixed_point_t PROPERTY(back_crisis_relation_on_decline); + fixed_point_t PROPERTY(crisis_temperature_on_offer_decline); + fixed_point_t PROPERTY(crisis_temperature_participant_factor); + fixed_point_t PROPERTY(crisis_temperature_on_mobilize); + fixed_point_t PROPERTY(crisis_wargoal_infamy_mult); + fixed_point_t PROPERTY(crisis_wargoal_prestige_mult); + fixed_point_t PROPERTY(crisis_wargoal_militancy_mult); + fixed_point_t PROPERTY(crisis_interest_war_exhaustion_limit); + fixed_point_t PROPERTY(rank_1_tension_decay); + fixed_point_t PROPERTY(rank_2_tension_decay); + fixed_point_t PROPERTY(rank_3_tension_decay); + fixed_point_t PROPERTY(rank_4_tension_decay); + fixed_point_t PROPERTY(rank_5_tension_decay); + fixed_point_t PROPERTY(rank_6_tension_decay); + fixed_point_t PROPERTY(rank_7_tension_decay); + fixed_point_t PROPERTY(rank_8_tension_decay); + fixed_point_t PROPERTY(tws_fulfilled_speed); + fixed_point_t PROPERTY(tws_not_fulfilled_speed); + Timespan PROPERTY(tws_grace_period_days); + fixed_point_t PROPERTY(tws_cb_limit_default); + fixed_point_t PROPERTY(tws_fulfilled_idle_space); + size_t PROPERTY(tws_battle_min_count); + fixed_point_t PROPERTY(tws_battle_max_aspect); + fixed_point_t PROPERTY(large_population_influence_penalty); + fixed_point_t PROPERTY(lone_backer_prestige_factor); + + DiplomacyDefines(); + + std::string_view get_name() const; + NodeTools::node_callback_t expect_defines(); + }; +} diff --git a/src/openvic-simulation/defines/EconomyDefines.cpp b/src/openvic-simulation/defines/EconomyDefines.cpp new file mode 100644 index 0000000..57c0157 --- /dev/null +++ b/src/openvic-simulation/defines/EconomyDefines.cpp @@ -0,0 +1,92 @@ +#include "EconomyDefines.hpp" + +using namespace OpenVic; +using namespace OpenVic::NodeTools; + +EconomyDefines::EconomyDefines() + : max_daily_research {}, + loan_base_interest {}, + bankruptcy_external_loan_duration {}, + bankruptcy_factor {}, + shadowy_financiers_max_loan_amount {}, + max_loan_cap_from_banks {}, + gunboat_low_tax_cap {}, + gunboat_high_tax_cap {}, + gunboat_fleet_size_factor {}, + province_size_divider {}, + capitalist_build_factory_state_employment_percent {}, + goods_focus_swap_chance {}, + num_closed_factories_per_state_lassiez_faire {}, + min_num_factories_per_state_before_deleting_lassiez_faire {}, + bankrupcy_duration {}, + second_rank_base_share_factor {}, + civ_base_share_factor {}, + unciv_base_share_factor {}, + factory_paychecks_leftover_factor {}, + max_factory_money_save {}, + small_debt_limit {}, + factory_upgrade_employee_factor {}, + rgo_supply_demand_factor_hire_hi {}, + rgo_supply_demand_factor_hire_lo {}, + rgo_supply_demand_factor_fire {}, + employment_hire_lowest {}, + employment_fire_lowest {}, + trade_cap_low_limit_land {}, + trade_cap_low_limit_naval {}, + trade_cap_low_limit_constructions {}, + factory_purchase_min_factor {}, + factory_purchase_drawdown_factor {} {} + +std::string_view EconomyDefines::get_name() const { + return "economy"; +} + +node_callback_t EconomyDefines::expect_defines() { + return expect_dictionary_keys( + "MAX_DAILY_RESEARCH", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(max_daily_research)), + "LOAN_BASE_INTEREST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(loan_base_interest)), + "BANKRUPTCY_EXTERNAL_LOAN_YEARS", ONE_EXACTLY, + expect_years(assign_variable_callback(bankruptcy_external_loan_duration)), + "BANKRUPTCY_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(bankruptcy_factor)), + "SHADOWY_FINANCIERS_MAX_LOAN_AMOUNT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(shadowy_financiers_max_loan_amount)), + "MAX_LOAN_CAP_FROM_BANKS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(max_loan_cap_from_banks)), + "GUNBOAT_LOW_TAX_CAP", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(gunboat_low_tax_cap)), + "GUNBOAT_HIGH_TAX_CAP", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(gunboat_high_tax_cap)), + "GUNBOAT_FLEET_SIZE_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(gunboat_fleet_size_factor)), + "PROVINCE_SIZE_DIVIDER", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(province_size_divider)), + "CAPITALIST_BUILD_FACTORY_STATE_EMPLOYMENT_PERCENT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(capitalist_build_factory_state_employment_percent)), + "GOODS_FOCUS_SWAP_CHANCE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(goods_focus_swap_chance)), + "NUM_CLOSED_FACTORIES_PER_STATE_LASSIEZ_FAIRE", ONE_EXACTLY, + expect_uint(assign_variable_callback(num_closed_factories_per_state_lassiez_faire)), + "MIN_NUM_FACTORIES_PER_STATE_BEFORE_DELETING_LASSIEZ_FAIRE", ONE_EXACTLY, + expect_uint(assign_variable_callback(min_num_factories_per_state_before_deleting_lassiez_faire)), + "BANKRUPCY_DURATION", ONE_EXACTLY, expect_years(assign_variable_callback(bankrupcy_duration)), + "SECOND_RANK_BASE_SHARE_FACTOR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(second_rank_base_share_factor)), + "CIV_BASE_SHARE_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(civ_base_share_factor)), + "UNCIV_BASE_SHARE_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(unciv_base_share_factor)), + "FACTORY_PAYCHECKS_LEFTOVER_FACTOR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(factory_paychecks_leftover_factor)), + "MAX_FACTORY_MONEY_SAVE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(max_factory_money_save)), + "SMALL_DEBT_LIMIT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(small_debt_limit)), + "FACTORY_UPGRADE_EMPLOYEE_FACTOR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(factory_upgrade_employee_factor)), + "RGO_SUPPLY_DEMAND_FACTOR_HIRE_HI", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(rgo_supply_demand_factor_hire_hi)), + "RGO_SUPPLY_DEMAND_FACTOR_HIRE_LO", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(rgo_supply_demand_factor_hire_lo)), + "RGO_SUPPLY_DEMAND_FACTOR_FIRE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(rgo_supply_demand_factor_fire)), + "EMPLOYMENT_HIRE_LOWEST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(employment_hire_lowest)), + "EMPLOYMENT_FIRE_LOWEST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(employment_fire_lowest)), + "TRADE_CAP_LOW_LIMIT_LAND", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(trade_cap_low_limit_land)), + "TRADE_CAP_LOW_LIMIT_NAVAL", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(trade_cap_low_limit_naval)), + "TRADE_CAP_LOW_LIMIT_CONSTRUCTIONS", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(trade_cap_low_limit_constructions)), + "FACTORY_PURCHASE_MIN_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(factory_purchase_min_factor)), + "FACTORY_PURCHASE_DRAWDOWN_FACTOR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(factory_purchase_drawdown_factor)) + ); +} diff --git a/src/openvic-simulation/defines/EconomyDefines.hpp b/src/openvic-simulation/defines/EconomyDefines.hpp new file mode 100644 index 0000000..122475f --- /dev/null +++ b/src/openvic-simulation/defines/EconomyDefines.hpp @@ -0,0 +1,53 @@ +#pragma once + +#include "openvic-simulation/dataloader/NodeTools.hpp" +#include "openvic-simulation/types/Date.hpp" +#include "openvic-simulation/types/fixed_point/FixedPoint.hpp" +#include "openvic-simulation/utility/Getters.hpp" + +namespace OpenVic { + struct DefineManager; + + struct EconomyDefines { + friend struct DefineManager; + + private: + fixed_point_t PROPERTY(max_daily_research); + fixed_point_t PROPERTY(loan_base_interest); + Timespan PROPERTY(bankruptcy_external_loan_duration); + fixed_point_t PROPERTY(bankruptcy_factor); + fixed_point_t PROPERTY(shadowy_financiers_max_loan_amount); + fixed_point_t PROPERTY(max_loan_cap_from_banks); + fixed_point_t PROPERTY(gunboat_low_tax_cap); + fixed_point_t PROPERTY(gunboat_high_tax_cap); + fixed_point_t PROPERTY(gunboat_fleet_size_factor); + fixed_point_t PROPERTY(province_size_divider); + fixed_point_t PROPERTY(capitalist_build_factory_state_employment_percent); + fixed_point_t PROPERTY(goods_focus_swap_chance); + size_t PROPERTY(num_closed_factories_per_state_lassiez_faire); + size_t PROPERTY(min_num_factories_per_state_before_deleting_lassiez_faire); + Timespan PROPERTY(bankrupcy_duration); + fixed_point_t PROPERTY(second_rank_base_share_factor); + fixed_point_t PROPERTY(civ_base_share_factor); + fixed_point_t PROPERTY(unciv_base_share_factor); + fixed_point_t PROPERTY(factory_paychecks_leftover_factor); + fixed_point_t PROPERTY(max_factory_money_save); + fixed_point_t PROPERTY(small_debt_limit); + fixed_point_t PROPERTY(factory_upgrade_employee_factor); + fixed_point_t PROPERTY(rgo_supply_demand_factor_hire_hi); + fixed_point_t PROPERTY(rgo_supply_demand_factor_hire_lo); + fixed_point_t PROPERTY(rgo_supply_demand_factor_fire); + fixed_point_t PROPERTY(employment_hire_lowest); + fixed_point_t PROPERTY(employment_fire_lowest); + fixed_point_t PROPERTY(trade_cap_low_limit_land); + fixed_point_t PROPERTY(trade_cap_low_limit_naval); + fixed_point_t PROPERTY(trade_cap_low_limit_constructions); + fixed_point_t PROPERTY(factory_purchase_min_factor); + fixed_point_t PROPERTY(factory_purchase_drawdown_factor); + + EconomyDefines(); + + std::string_view get_name() const; + NodeTools::node_callback_t expect_defines(); + }; +} diff --git a/src/openvic-simulation/defines/GraphicsDefines.cpp b/src/openvic-simulation/defines/GraphicsDefines.cpp new file mode 100644 index 0000000..e68afe2 --- /dev/null +++ b/src/openvic-simulation/defines/GraphicsDefines.cpp @@ -0,0 +1,41 @@ +#include "GraphicsDefines.hpp" + +using namespace OpenVic; +using namespace OpenVic::NodeTools; + +GraphicsDefines::GraphicsDefines() + : cities_sprawl_offset {}, + cities_sprawl_width {}, + cities_sprawl_height {}, + cities_sprawl_iterations {}, + cities_mesh_pool_size_for_country {}, + cities_mesh_pool_size_for_culture {}, + cities_mesh_pool_size_for_generic {}, + cities_mesh_types_count {}, + cities_mesh_sizes_count {}, + cities_special_buildings_pool_size {}, + cities_size_max_population_k {} {} + +std::string_view GraphicsDefines::get_name() const { + return "graphics"; +} + +node_callback_t GraphicsDefines::expect_defines() { + return expect_dictionary_keys( + "CITIES_SPRAWL_OFFSET", ONE_EXACTLY, expect_uint(assign_variable_callback(cities_sprawl_offset)), + "CITIES_SPRAWL_WIDTH", ONE_EXACTLY, expect_uint(assign_variable_callback(cities_sprawl_width)), + "CITIES_SPRAWL_HEIGHT", ONE_EXACTLY, expect_uint(assign_variable_callback(cities_sprawl_height)), + "CITIES_SPRAWL_ITERATIONS", ONE_EXACTLY, expect_uint(assign_variable_callback(cities_sprawl_iterations)), + "CITIES_MESH_POOL_SIZE_FOR_COUNTRY", ONE_EXACTLY, + expect_uint(assign_variable_callback(cities_mesh_pool_size_for_country)), + "CITIES_MESH_POOL_SIZE_FOR_CULTURE", ONE_EXACTLY, + expect_uint(assign_variable_callback(cities_mesh_pool_size_for_culture)), + "CITIES_MESH_POOL_SIZE_FOR_GENERIC", ONE_EXACTLY, + expect_uint(assign_variable_callback(cities_mesh_pool_size_for_generic)), + "CITIES_MESH_TYPES_COUNT", ONE_EXACTLY, expect_uint(assign_variable_callback(cities_mesh_types_count)), + "CITIES_MESH_SIZES_COUNT", ONE_EXACTLY, expect_uint(assign_variable_callback(cities_mesh_sizes_count)), + "CITIES_SPECIAL_BUILDINGS_POOL_SIZE", ONE_EXACTLY, + expect_uint(assign_variable_callback(cities_special_buildings_pool_size)), + "CITIES_SIZE_MAX_POPULATION_K", ONE_EXACTLY, expect_uint(assign_variable_callback(cities_size_max_population_k)) + ); +} diff --git a/src/openvic-simulation/defines/GraphicsDefines.hpp b/src/openvic-simulation/defines/GraphicsDefines.hpp new file mode 100644 index 0000000..f4cd7e2 --- /dev/null +++ b/src/openvic-simulation/defines/GraphicsDefines.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include "openvic-simulation/dataloader/NodeTools.hpp" +#include "openvic-simulation/utility/Getters.hpp" + +namespace OpenVic { + struct DefineManager; + + struct GraphicsDefines { + friend struct DefineManager; + + private: + size_t PROPERTY(cities_sprawl_offset); + size_t PROPERTY(cities_sprawl_width); + size_t PROPERTY(cities_sprawl_height); + size_t PROPERTY(cities_sprawl_iterations); + size_t PROPERTY(cities_mesh_pool_size_for_country); + size_t PROPERTY(cities_mesh_pool_size_for_culture); + size_t PROPERTY(cities_mesh_pool_size_for_generic); + size_t PROPERTY(cities_mesh_types_count); + size_t PROPERTY(cities_mesh_sizes_count); + size_t PROPERTY(cities_special_buildings_pool_size); + size_t PROPERTY(cities_size_max_population_k); + + GraphicsDefines(); + + std::string_view get_name() const; + NodeTools::node_callback_t expect_defines(); + }; +} diff --git a/src/openvic-simulation/defines/MilitaryDefines.cpp b/src/openvic-simulation/defines/MilitaryDefines.cpp new file mode 100644 index 0000000..0ce4cb1 --- /dev/null +++ b/src/openvic-simulation/defines/MilitaryDefines.cpp @@ -0,0 +1,168 @@ +#include "MilitaryDefines.hpp" + +using namespace OpenVic; +using namespace OpenVic::NodeTools; + +MilitaryDefines::MilitaryDefines() + : dig_in_increase_each_days {}, + reinforce_speed {}, + combat_difficulty_impact {}, + base_combat_width {}, + min_pop_size_for_regiment {}, + pop_size_per_regiment {}, + soldier_to_pop_damage {}, + land_speed_modifier {}, + naval_speed_modifier {}, + exp_gain_div {}, + leader_recruit_cost {}, + supply_range {}, + pop_size_per_regiment_protectorate_multiplier {}, + pop_size_per_regiment_colony_multiplier {}, + pop_size_per_regiment_non_core_multiplier {}, + gas_attack_modifier {}, + combatloss_war_exhaustion {}, + leader_max_random_prestige {}, + leader_age_death_factor {}, + leader_prestige_to_morale_factor {}, + leader_prestige_to_max_org_factor {}, + leader_transfer_penalty_on_country_prestige {}, + leader_prestige_land_gain {}, + leader_prestige_naval_gain {}, + naval_combat_seeking_chance {}, + naval_combat_seeking_chance_min {}, + naval_combat_self_defence_chance {}, + naval_combat_shift_back_on_next_target {}, + naval_combat_shift_back_duration_scale {}, + naval_combat_speed_to_distance_factor {}, + naval_combat_change_target_chance {}, + naval_combat_damage_org_mult {}, + naval_combat_damage_str_mult {}, + naval_combat_damage_mult_no_org {}, + naval_combat_retreat_chance {}, + naval_combat_retreat_str_org_level {}, + naval_combat_retreat_speed_mod {}, + naval_combat_retreat_min_distance {}, + naval_combat_damaged_target_selection {}, + naval_combat_stacking_target_change {}, + naval_combat_stacking_target_select {}, + naval_combat_max_targets {}, + ai_bigship_proportion {}, + ai_lightship_proportion {}, + ai_transport_proportion {}, + ai_cavalry_proportion {}, + ai_support_proportion {}, + ai_special_proportion {}, + ai_escort_ratio {}, + ai_army_taxbase_fraction {}, + ai_navy_taxbase_fraction {}, + ai_blockade_range {}, + recon_unit_ratio {}, + engineer_unit_ratio {}, + siege_brigades_min {}, + siege_brigades_max {}, + siege_brigades_bonus {}, + recon_siege_effect {}, + siege_attrition {}, + base_military_tactics {}, + naval_low_supply_damage_supply_status {}, + naval_low_supply_damage_days_delay {}, + naval_low_supply_damage_min_str {}, + naval_low_supply_damage_per_day {} {} + +std::string_view MilitaryDefines::get_name() const { + return "military"; +} + +node_callback_t MilitaryDefines::expect_defines() { + return expect_dictionary_keys( + "DIG_IN_INCREASE_EACH_DAYS", ONE_EXACTLY, expect_days(assign_variable_callback(dig_in_increase_each_days)), + "REINFORCE_SPEED", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(reinforce_speed)), + "COMBAT_DIFFICULTY_IMPACT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(combat_difficulty_impact)), + "BASE_COMBAT_WIDTH", ONE_EXACTLY, expect_uint(assign_variable_callback(base_combat_width)), + "POP_MIN_SIZE_FOR_REGIMENT", ONE_EXACTLY, expect_uint(assign_variable_callback(min_pop_size_for_regiment)), + "POP_SIZE_PER_REGIMENT", ONE_EXACTLY, expect_uint(assign_variable_callback(pop_size_per_regiment)), + "SOLDIER_TO_POP_DAMAGE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(soldier_to_pop_damage)), + "LAND_SPEED_MODIFIER", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(land_speed_modifier)), + "NAVAL_SPEED_MODIFIER", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(naval_speed_modifier)), + "EXP_GAIN_DIV", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(exp_gain_div)), + "LEADER_RECRUIT_COST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(leader_recruit_cost)), + "SUPPLY_RANGE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(supply_range)), + "POP_MIN_SIZE_FOR_REGIMENT_PROTECTORATE_MULTIPLIER", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(pop_size_per_regiment_protectorate_multiplier)), + "POP_MIN_SIZE_FOR_REGIMENT_COLONY_MULTIPLIER", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(pop_size_per_regiment_colony_multiplier)), + "POP_MIN_SIZE_FOR_REGIMENT_NONCORE_MULTIPLIER", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(pop_size_per_regiment_non_core_multiplier)), + "GAS_ATTACK_MODIFIER", ONE_EXACTLY, expect_uint(assign_variable_callback(gas_attack_modifier)), + "COMBATLOSS_WAR_EXHAUSTION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(combatloss_war_exhaustion)), + "LEADER_MAX_RANDOM_PRESTIGE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(leader_max_random_prestige)), + "LEADER_AGE_DEATH_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(leader_age_death_factor)), + "LEADER_PRESTIGE_TO_MORALE_FACTOR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(leader_prestige_to_morale_factor)), + "LEADER_PRESTIGE_TO_MAX_ORG_FACTOR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(leader_prestige_to_max_org_factor)), + "LEADER_TRANSFER_PENALTY_ON_COUNTRY_PRESTIGE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(leader_transfer_penalty_on_country_prestige)), + "LEADER_PRESTIGE_LAND_GAIN", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(leader_prestige_land_gain)), + "LEADER_PRESTIGE_NAVAL_GAIN", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(leader_prestige_naval_gain)), + "NAVAL_COMBAT_SEEKING_CHANCE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(naval_combat_seeking_chance)), + "NAVAL_COMBAT_SEEKING_CHANCE_MIN", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_combat_seeking_chance_min)), + "NAVAL_COMBAT_SELF_DEFENCE_CHANCE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_combat_self_defence_chance)), + "NAVAL_COMBAT_SHIFT_BACK_ON_NEXT_TARGET", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_combat_shift_back_on_next_target)), + "NAVAL_COMBAT_SHIFT_BACK_DURATION_SCALE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_combat_shift_back_duration_scale)), + "NAVAL_COMBAT_SPEED_TO_DISTANCE_FACTOR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_combat_speed_to_distance_factor)), + "NAVAL_COMBAT_CHANGE_TARGET_CHANCE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_combat_change_target_chance)), + "NAVAL_COMBAT_DAMAGE_ORG_MULT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_combat_damage_org_mult)), + "NAVAL_COMBAT_DAMAGE_STR_MULT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_combat_damage_str_mult)), + "NAVAL_COMBAT_DAMAGE_MULT_NO_ORG", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_combat_damage_mult_no_org)), + "NAVAL_COMBAT_RETREAT_CHANCE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(naval_combat_retreat_chance)), + "NAVAL_COMBAT_RETREAT_STR_ORG_LEVEL", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_combat_retreat_str_org_level)), + "NAVAL_COMBAT_RETREAT_SPEED_MOD", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_combat_retreat_speed_mod)), + "NAVAL_COMBAT_RETREAT_MIN_DISTANCE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_combat_retreat_min_distance)), + "NAVAL_COMBAT_DAMAGED_TARGET_SELECTION", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_combat_damaged_target_selection)), + "NAVAL_COMBAT_STACKING_TARGET_CHANGE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_combat_stacking_target_change)), + "NAVAL_COMBAT_STACKING_TARGET_SELECT", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_combat_stacking_target_select)), + "NAVAL_COMBAT_MAX_TARGETS", ONE_EXACTLY, expect_uint(assign_variable_callback(naval_combat_max_targets)), + "AI_BIGSHIP_PROPORTION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(ai_bigship_proportion)), + "AI_LIGHTSHIP_PROPORTION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(ai_lightship_proportion)), + "AI_TRANSPORT_PROPORTION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(ai_transport_proportion)), + "AI_CAVALRY_PROPORTION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(ai_cavalry_proportion)), + "AI_SUPPORT_PROPORTION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(ai_support_proportion)), + "AI_SPECIAL_PROPORTION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(ai_special_proportion)), + "AI_ESCORT_RATIO", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(ai_escort_ratio)), + "AI_ARMY_TAXBASE_FRACTION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(ai_army_taxbase_fraction)), + "AI_NAVY_TAXBASE_FRACTION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(ai_navy_taxbase_fraction)), + "AI_BLOCKADE_RANGE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(ai_blockade_range)), + "RECON_UNIT_RATIO", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(recon_unit_ratio)), + "ENGINEER_UNIT_RATIO", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(engineer_unit_ratio)), + "SIEGE_BRIGADES_MIN", ONE_EXACTLY, expect_uint(assign_variable_callback(siege_brigades_min)), + "SIEGE_BRIGADES_MAX", ONE_EXACTLY, expect_uint(assign_variable_callback(siege_brigades_max)), + "SIEGE_BRIGADES_BONUS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(siege_brigades_bonus)), + "RECON_SIEGE_EFFECT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(recon_siege_effect)), + "SIEGE_ATTRITION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(siege_attrition)), + "BASE_MILITARY_TACTICS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(base_military_tactics)), + "NAVAL_LOW_SUPPLY_DAMAGE_SUPPLY_STATUS", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_low_supply_damage_supply_status)), + "NAVAL_LOW_SUPPLY_DAMAGE_DAYS_DELAY", ONE_EXACTLY, + expect_days(assign_variable_callback(naval_low_supply_damage_days_delay)), + "NAVAL_LOW_SUPPLY_DAMAGE_MIN_STR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_low_supply_damage_min_str)), + "NAVAL_LOW_SUPPLY_DAMAGE_PER_DAY", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(naval_low_supply_damage_per_day)) + ); +} diff --git a/src/openvic-simulation/defines/MilitaryDefines.hpp b/src/openvic-simulation/defines/MilitaryDefines.hpp new file mode 100644 index 0000000..2921195 --- /dev/null +++ b/src/openvic-simulation/defines/MilitaryDefines.hpp @@ -0,0 +1,86 @@ +#pragma once + +#include "openvic-simulation/dataloader/NodeTools.hpp" +#include "openvic-simulation/pop/Pop.hpp" +#include "openvic-simulation/types/Date.hpp" +#include "openvic-simulation/types/fixed_point/FixedPoint.hpp" +#include "openvic-simulation/utility/Getters.hpp" + +namespace OpenVic { + struct DefineManager; + + struct MilitaryDefines { + friend struct DefineManager; + + private: + Timespan PROPERTY(dig_in_increase_each_days); + fixed_point_t PROPERTY(reinforce_speed); + fixed_point_t PROPERTY(combat_difficulty_impact); + size_t PROPERTY(base_combat_width); + Pop::pop_size_t PROPERTY(min_pop_size_for_regiment); + Pop::pop_size_t PROPERTY(pop_size_per_regiment); + fixed_point_t PROPERTY(soldier_to_pop_damage); + fixed_point_t PROPERTY(land_speed_modifier); + fixed_point_t PROPERTY(naval_speed_modifier); + fixed_point_t PROPERTY(exp_gain_div); + fixed_point_t PROPERTY(leader_recruit_cost); + fixed_point_t PROPERTY(supply_range); + fixed_point_t PROPERTY(pop_size_per_regiment_protectorate_multiplier); + fixed_point_t PROPERTY(pop_size_per_regiment_colony_multiplier); + fixed_point_t PROPERTY(pop_size_per_regiment_non_core_multiplier); + size_t PROPERTY(gas_attack_modifier); + fixed_point_t PROPERTY(combatloss_war_exhaustion); + fixed_point_t PROPERTY(leader_max_random_prestige); + fixed_point_t PROPERTY(leader_age_death_factor); + fixed_point_t PROPERTY(leader_prestige_to_morale_factor); + fixed_point_t PROPERTY(leader_prestige_to_max_org_factor); + fixed_point_t PROPERTY(leader_transfer_penalty_on_country_prestige); + fixed_point_t PROPERTY(leader_prestige_land_gain); + fixed_point_t PROPERTY(leader_prestige_naval_gain); + fixed_point_t PROPERTY(naval_combat_seeking_chance); + fixed_point_t PROPERTY(naval_combat_seeking_chance_min); + fixed_point_t PROPERTY(naval_combat_self_defence_chance); + fixed_point_t PROPERTY(naval_combat_shift_back_on_next_target); + fixed_point_t PROPERTY(naval_combat_shift_back_duration_scale); + fixed_point_t PROPERTY(naval_combat_speed_to_distance_factor); + fixed_point_t PROPERTY(naval_combat_change_target_chance); + fixed_point_t PROPERTY(naval_combat_damage_org_mult); + fixed_point_t PROPERTY(naval_combat_damage_str_mult); + fixed_point_t PROPERTY(naval_combat_damage_mult_no_org); + fixed_point_t PROPERTY(naval_combat_retreat_chance); + fixed_point_t PROPERTY(naval_combat_retreat_str_org_level); + fixed_point_t PROPERTY(naval_combat_retreat_speed_mod); + fixed_point_t PROPERTY(naval_combat_retreat_min_distance); + fixed_point_t PROPERTY(naval_combat_damaged_target_selection); + fixed_point_t PROPERTY(naval_combat_stacking_target_change); + fixed_point_t PROPERTY(naval_combat_stacking_target_select); + size_t PROPERTY(naval_combat_max_targets); + fixed_point_t PROPERTY(ai_bigship_proportion); + fixed_point_t PROPERTY(ai_lightship_proportion); + fixed_point_t PROPERTY(ai_transport_proportion); + fixed_point_t PROPERTY(ai_cavalry_proportion); + fixed_point_t PROPERTY(ai_support_proportion); + fixed_point_t PROPERTY(ai_special_proportion); + fixed_point_t PROPERTY(ai_escort_ratio); + fixed_point_t PROPERTY(ai_army_taxbase_fraction); + fixed_point_t PROPERTY(ai_navy_taxbase_fraction); + fixed_point_t PROPERTY(ai_blockade_range); + fixed_point_t PROPERTY(recon_unit_ratio); + fixed_point_t PROPERTY(engineer_unit_ratio); + size_t PROPERTY(siege_brigades_min); + size_t PROPERTY(siege_brigades_max); + fixed_point_t PROPERTY(siege_brigades_bonus); + fixed_point_t PROPERTY(recon_siege_effect); + fixed_point_t PROPERTY(siege_attrition); + fixed_point_t PROPERTY(base_military_tactics); + fixed_point_t PROPERTY(naval_low_supply_damage_supply_status); + Timespan PROPERTY(naval_low_supply_damage_days_delay); + fixed_point_t PROPERTY(naval_low_supply_damage_min_str); + fixed_point_t PROPERTY(naval_low_supply_damage_per_day); + + MilitaryDefines(); + + std::string_view get_name() const; + NodeTools::node_callback_t expect_defines(); + }; +} diff --git a/src/openvic-simulation/defines/PopsDefines.cpp b/src/openvic-simulation/defines/PopsDefines.cpp new file mode 100644 index 0000000..6fc8d21 --- /dev/null +++ b/src/openvic-simulation/defines/PopsDefines.cpp @@ -0,0 +1,142 @@ +#include "PopsDefines.hpp" + +using namespace OpenVic; +using namespace OpenVic::NodeTools; + +PopsDefines::PopsDefines() + : base_clergy_for_literacy {}, + max_clergy_for_literacy {}, + literacy_change_speed {}, + assimilation_scale {}, + conversion_scale {}, + immigration_scale {}, + promotion_scale {}, + promotion_assimilation_chance {}, + luxury_threshold {}, + base_goods_demand {}, + base_popgrowth {}, + min_life_rating_for_growth {}, + life_rating_growth_bonus {}, + life_need_starvation_limit {}, + mil_lack_everyday_need {}, + mil_has_everyday_need {}, + mil_has_luxury_need {}, + mil_no_life_need {}, + mil_require_reform {}, + mil_ideology {}, + mil_ruling_party {}, + mil_reform_impact {}, + mil_war_exhaustion {}, + mil_non_accepted {}, + con_literacy {}, + con_luxury_goods {}, + con_poor_clergy {}, + con_midrich_clergy {}, + con_reform_impact {}, + con_colonial_factor {}, + ruling_party_happy_change {}, + ruling_party_angry_change {}, + pdef_base_con {}, + national_focus_divider {}, + pop_savings {}, + state_creation_admin_limit {}, + mil_to_join_rebel {}, + mil_to_join_rising {}, + mil_to_autorise {}, + reduction_after_riseing {}, + reduction_after_defeat {}, + pop_to_leadership {}, + artisan_min_productivity {}, + slave_growth_divisor {}, + mil_hit_from_conquest {}, + luxury_con_change {}, + invention_impact_on_demand {}, + artisan_suppressed_colonial_goods_category {}, + issue_movement_join_limit {}, + issue_movement_leave_limit {}, + movement_con_factor {}, + movement_lit_factor {}, + mil_on_reb_move {}, + population_suppression_factor {}, + population_movement_radical_factor {}, + nationalist_movement_mil_cap {}, + movement_support_uh_factor {}, + rebel_occupation_strength_bonus {}, + large_population_limit {}, + large_population_influence_penalty_chunk {} {} + +std::string_view PopsDefines::get_name() const { + return "pops"; +} + +node_callback_t PopsDefines::expect_defines() { + return expect_dictionary_keys( + "BASE_CLERGY_FOR_LITERACY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(base_clergy_for_literacy)), + "MAX_CLERGY_FOR_LITERACY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(max_clergy_for_literacy)), + "LITERACY_CHANGE_SPEED", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(literacy_change_speed)), + "ASSIMILATION_SCALE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(assimilation_scale)), + "CONVERSION_SCALE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(conversion_scale)), + "IMMIGRATION_SCALE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(immigration_scale)), + "PROMOTION_SCALE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(promotion_scale)), + "PROMOTION_ASSIMILATION_CHANCE", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(promotion_assimilation_chance)), + "LUXURY_THRESHOLD", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(luxury_threshold)), + "BASE_GOODS_DEMAND", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(base_goods_demand)), + "BASE_POPGROWTH", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(base_popgrowth)), + "MIN_LIFE_RATING_FOR_GROWTH", ONE_EXACTLY, expect_uint(assign_variable_callback(min_life_rating_for_growth)), + "LIFE_RATING_GROWTH_BONUS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(life_rating_growth_bonus)), + "LIFE_NEED_STARVATION_LIMIT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(life_need_starvation_limit)), + "MIL_LACK_EVERYDAY_NEED", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(mil_lack_everyday_need)), + "MIL_HAS_EVERYDAY_NEED", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(mil_has_everyday_need)), + "MIL_HAS_LUXURY_NEED", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(mil_has_luxury_need)), + "MIL_NO_LIFE_NEED", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(mil_no_life_need)), + "MIL_REQUIRE_REFORM", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(mil_require_reform)), + "MIL_IDEOLOGY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(mil_ideology)), + "MIL_RULING_PARTY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(mil_ruling_party)), + "MIL_REFORM_IMPACT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(mil_reform_impact)), + "MIL_WAR_EXHAUSTION", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(mil_war_exhaustion)), + "MIL_NON_ACCEPTED", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(mil_non_accepted)), + "CON_LITERACY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(con_literacy)), + "CON_LUXURY_GOODS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(con_luxury_goods)), + "CON_POOR_CLERGY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(con_poor_clergy)), + "CON_MIDRICH_CLERGY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(con_midrich_clergy)), + "CON_REFORM_IMPACT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(con_reform_impact)), + "CON_COLONIAL_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(con_colonial_factor)), + "RULING_PARTY_HAPPY_CHANGE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(ruling_party_happy_change)), + "RULING_PARTY_ANGRY_CHANGE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(ruling_party_angry_change)), + "PDEF_BASE_CON", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(pdef_base_con)), + "NATIONAL_FOCUS_DIVIDER", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(national_focus_divider)), + "POP_SAVINGS", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(pop_savings)), + "STATE_CREATION_ADMIN_LIMIT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(state_creation_admin_limit)), + "MIL_TO_JOIN_REBEL", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(mil_to_join_rebel)), + "MIL_TO_JOIN_RISING", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(mil_to_join_rising)), + "MIL_TO_AUTORISE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(mil_to_autorise)), + "REDUCTION_AFTER_RISEING", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(reduction_after_riseing)), + "REDUCTION_AFTER_DEFEAT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(reduction_after_defeat)), + "POP_TO_LEADERSHIP", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(pop_to_leadership)), + "ARTISAN_MIN_PRODUCTIVITY", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(artisan_min_productivity)), + "SLAVE_GROWTH_DIVISOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(slave_growth_divisor)), + "MIL_HIT_FROM_CONQUEST", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(mil_hit_from_conquest)), + "LUXURY_CON_CHANGE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(luxury_con_change)), + "INVENTION_IMPACT_ON_DEMAND", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(invention_impact_on_demand)), + "ARTISAN_SUPPRESSED_COLONIAL_GOODS_CATEGORY", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(artisan_suppressed_colonial_goods_category)), + "ISSUE_MOVEMENT_JOIN_LIMIT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(issue_movement_join_limit)), + "ISSUE_MOVEMENT_LEAVE_LIMIT", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(issue_movement_leave_limit)), + "MOVEMENT_CON_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(movement_con_factor)), + "MOVEMENT_LIT_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(movement_lit_factor)), + "MIL_ON_REB_MOVE", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(mil_on_reb_move)), + "POPULATION_SUPPRESSION_FACTOR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(population_suppression_factor)), + "POPULATION_MOVEMENT_RADICAL_FACTOR", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(population_movement_radical_factor)), + "NATIONALIST_MOVEMENT_MIL_CAP", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(nationalist_movement_mil_cap)), + "MOVEMENT_SUPPORT_UH_FACTOR", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(movement_support_uh_factor)), + "REBEL_OCCUPATION_STRENGTH_BONUS", ONE_EXACTLY, + expect_fixed_point(assign_variable_callback(rebel_occupation_strength_bonus)), + "LARGE_POPULATION_LIMIT", ONE_EXACTLY, expect_uint(assign_variable_callback(large_population_limit)), + "LARGE_POPULATION_INFLUENCE_PENALTY_CHUNK", ONE_EXACTLY, + expect_uint(assign_variable_callback(large_population_influence_penalty_chunk)) + ); +} diff --git a/src/openvic-simulation/defines/PopsDefines.hpp b/src/openvic-simulation/defines/PopsDefines.hpp new file mode 100644 index 0000000..50d5b79 --- /dev/null +++ b/src/openvic-simulation/defines/PopsDefines.hpp @@ -0,0 +1,82 @@ +#pragma once + +#include "openvic-simulation/dataloader/NodeTools.hpp" +#include "openvic-simulation/map/ProvinceInstance.hpp" +#include "openvic-simulation/pop/Pop.hpp" +#include "openvic-simulation/types/fixed_point/FixedPoint.hpp" +#include "openvic-simulation/utility/Getters.hpp" + +namespace OpenVic { + struct DefineManager; + + struct PopsDefines { + friend struct DefineManager; + + private: + fixed_point_t PROPERTY(base_clergy_for_literacy); + fixed_point_t PROPERTY(max_clergy_for_literacy); + fixed_point_t PROPERTY(literacy_change_speed); + fixed_point_t PROPERTY(assimilation_scale); + fixed_point_t PROPERTY(conversion_scale); + fixed_point_t PROPERTY(immigration_scale); + fixed_point_t PROPERTY(promotion_scale); + fixed_point_t PROPERTY(promotion_assimilation_chance); + fixed_point_t PROPERTY(luxury_threshold); + fixed_point_t PROPERTY(base_goods_demand); + fixed_point_t PROPERTY(base_popgrowth); + ProvinceInstance::life_rating_t PROPERTY(min_life_rating_for_growth); + fixed_point_t PROPERTY(life_rating_growth_bonus); + fixed_point_t PROPERTY(life_need_starvation_limit); + fixed_point_t PROPERTY(mil_lack_everyday_need); + fixed_point_t PROPERTY(mil_has_everyday_need); + fixed_point_t PROPERTY(mil_has_luxury_need); + fixed_point_t PROPERTY(mil_no_life_need); + fixed_point_t PROPERTY(mil_require_reform); + fixed_point_t PROPERTY(mil_ideology); + fixed_point_t PROPERTY(mil_ruling_party); + fixed_point_t PROPERTY(mil_reform_impact); + fixed_point_t PROPERTY(mil_war_exhaustion); + fixed_point_t PROPERTY(mil_non_accepted); + fixed_point_t PROPERTY(con_literacy); + fixed_point_t PROPERTY(con_luxury_goods); + fixed_point_t PROPERTY(con_poor_clergy); + fixed_point_t PROPERTY(con_midrich_clergy); + fixed_point_t PROPERTY(con_reform_impact); + fixed_point_t PROPERTY(con_colonial_factor); + fixed_point_t PROPERTY(ruling_party_happy_change); + fixed_point_t PROPERTY(ruling_party_angry_change); + fixed_point_t PROPERTY(pdef_base_con); + fixed_point_t PROPERTY(national_focus_divider); + fixed_point_t PROPERTY(pop_savings); + fixed_point_t PROPERTY(state_creation_admin_limit); + fixed_point_t PROPERTY(mil_to_join_rebel); + fixed_point_t PROPERTY(mil_to_join_rising); + fixed_point_t PROPERTY(mil_to_autorise); + fixed_point_t PROPERTY(reduction_after_riseing); + fixed_point_t PROPERTY(reduction_after_defeat); + fixed_point_t PROPERTY(pop_to_leadership); + fixed_point_t PROPERTY(artisan_min_productivity); + fixed_point_t PROPERTY(slave_growth_divisor); + fixed_point_t PROPERTY(mil_hit_from_conquest); + fixed_point_t PROPERTY(luxury_con_change); + fixed_point_t PROPERTY(invention_impact_on_demand); + fixed_point_t PROPERTY(artisan_suppressed_colonial_goods_category); + fixed_point_t PROPERTY(issue_movement_join_limit); + fixed_point_t PROPERTY(issue_movement_leave_limit); + fixed_point_t PROPERTY(movement_con_factor); + fixed_point_t PROPERTY(movement_lit_factor); + fixed_point_t PROPERTY(mil_on_reb_move); + fixed_point_t PROPERTY(population_suppression_factor); + fixed_point_t PROPERTY(population_movement_radical_factor); + fixed_point_t PROPERTY(nationalist_movement_mil_cap); + fixed_point_t PROPERTY(movement_support_uh_factor); + fixed_point_t PROPERTY(rebel_occupation_strength_bonus); + Pop::pop_size_t PROPERTY(large_population_limit); + Pop::pop_size_t PROPERTY(large_population_influence_penalty_chunk); + + PopsDefines(); + + std::string_view get_name() const; + NodeTools::node_callback_t expect_defines(); + }; +} diff --git a/src/openvic-simulation/map/ProvinceInstance.cpp b/src/openvic-simulation/map/ProvinceInstance.cpp index 64a104b..b3d2df3 100644 --- a/src/openvic-simulation/map/ProvinceInstance.cpp +++ b/src/openvic-simulation/map/ProvinceInstance.cpp @@ -1,6 +1,7 @@ #include "ProvinceInstance.hpp" #include "openvic-simulation/country/CountryInstance.hpp" +#include "openvic-simulation/defines/Define.hpp" #include "openvic-simulation/economy/production/ProductionType.hpp" #include "openvic-simulation/economy/production/ResourceGatheringOperation.hpp" #include "openvic-simulation/history/ProvinceHistory.hpp" @@ -9,7 +10,6 @@ #include "openvic-simulation/map/Region.hpp" #include "openvic-simulation/map/TerrainType.hpp" #include "openvic-simulation/military/UnitInstanceGroup.hpp" -#include "openvic-simulation/misc/Define.hpp" #include "openvic-simulation/modifier/StaticModifierCache.hpp" #include "openvic-simulation/politics/Ideology.hpp" #include "openvic-simulation/pop/Pop.hpp" @@ -184,12 +184,14 @@ void ProvinceInstance::_update_pops(DefineManager const& define_manager) { max_supported_regiments = 0; + MilitaryDefines const& military_defines = define_manager.get_military_defines(); + using enum colony_status_t; const fixed_point_t pop_size_per_regiment_multiplier = - colony_status == PROTECTORATE ? define_manager.get_pop_size_per_regiment_protectorate_multiplier() - : colony_status == COLONY ? define_manager.get_pop_size_per_regiment_colony_multiplier() - : is_owner_core() ? fixed_point_t::_1() : define_manager.get_pop_size_per_regiment_non_core_multiplier(); + colony_status == PROTECTORATE ? military_defines.get_pop_size_per_regiment_protectorate_multiplier() + : colony_status == COLONY ? military_defines.get_pop_size_per_regiment_colony_multiplier() + : is_owner_core() ? fixed_point_t::_1() : military_defines.get_pop_size_per_regiment_non_core_multiplier(); for (Pop& pop : pops) { pop.update_gamestate(define_manager, owner, pop_size_per_regiment_multiplier); diff --git a/src/openvic-simulation/misc/Define.cpp b/src/openvic-simulation/misc/Define.cpp deleted file mode 100644 index c28aab0..0000000 --- a/src/openvic-simulation/misc/Define.cpp +++ /dev/null @@ -1,270 +0,0 @@ -#include "Define.hpp" - -#include - -#include "openvic-simulation/dataloader/NodeTools.hpp" -#include "openvic-simulation/types/Date.hpp" -#include "openvic-simulation/types/IdentifierRegistry.hpp" -#include "openvic-simulation/types/fixed_point/FixedPoint.hpp" -#include "openvic-simulation/utility/StringUtils.hpp" - -using namespace OpenVic; -using namespace OpenVic::NodeTools; - -std::string_view Define::type_to_string(Type type) { - using enum Type; - - switch (type) { - case Date: return "date"; - case Country: return "country"; - case Economy: return "economy"; - case Military: return "military"; - case Diplomacy: return "diplomacy"; - case Pops: return "pops"; - case Ai: return "ai"; - case Graphics: return "graphics"; - default: return "unknown"; - } -} - -Define::Type Define::string_to_type(std::string_view str) { - using enum Type; - - static const string_map_t type_map { - { "country", Country }, - { "economy", Economy }, - { "military", Military }, - { "diplomacy", Diplomacy }, - { "pops", Pops }, - { "ai", Ai }, - { "graphics", Graphics }, - }; - - const string_map_t::const_iterator type_it = type_map.find(str); - - if (type_it != type_map.end()) { - return type_it->second; - } else { - return Unknown; - } -} - -Define::Define(std::string_view new_identifier, std::string_view new_value, Type new_type) - : HasIdentifier { new_identifier }, value { new_value }, type { new_type } {} - -Date Define::get_value_as_date(bool* successful) const { - return Date::from_string(value, successful); -} - -fixed_point_t Define::get_value_as_fp(bool* successful) const { - return fixed_point_t::parse(value, successful); -} - -int64_t Define::get_value_as_int(bool* successful) const { - return StringUtils::string_to_int64(value, successful); -} - -uint64_t Define::get_value_as_uint(bool* successful) const { - return StringUtils::string_to_uint64(value, successful); -} - -std::ostream& OpenVic::operator<<(std::ostream& os, Define::Type type) { - return os << Define::type_to_string(type); -} - -template -bool DefineManager::load_define(T& value, Define::Type type, std::string_view name) const { - static_assert( - std::same_as || std::same_as || std::integral - ); - - Define const* define = defines.get_item_by_identifier(name); - - if (define != nullptr) { - if (define->type != type) { - Logger::warning("Mismatched define type for \"", name, "\" - expected ", type, ", got ", define->type); - } - - const auto parse = - [define, &value, &name](std::string_view type_name) -> bool { - bool success = false; - const U result = (define->*Func)(&success); - if (success) { - value = static_cast(result); - return true; - } else { - Logger::error("Failed to parse ", type_name, " \"", define->get_value(), "\" for define \"", name, "\""); - return false; - } - }; - - if constexpr (std::same_as) { - return parse.template operator()("date"); - } else if constexpr (std::same_as) { - return parse.template operator()("fixed point"); - } else if constexpr (std::signed_integral) { - return parse.template operator()("signed int"); - } else if constexpr (std::unsigned_integral) { - return parse.template operator()("unsigned int"); - } - } else { - Logger::error("Missing define \"", name, "\""); - return false; - } -} - -template -bool DefineManager::_load_define_timespan(Timespan& value, Define::Type type, std::string_view name) const { - Define const* define = defines.get_item_by_identifier(name); - if (define != nullptr) { - if (define->type != type) { - Logger::warning("Mismatched define type for \"", name, "\" - expected ", type, ", got ", define->type); - } - bool success = false; - const int64_t result = define->get_value_as_int(&success); - if (success) { - value = Func(result); - return true; - } else { - Logger::error("Failed to parse days \"", define->get_value(), "\" for define \"", name, "\""); - return false; - } - } else { - Logger::error("Missing define \"", name, "\""); - return false; - } -} - -bool DefineManager::load_define_days(Timespan& value, Define::Type type, std::string_view name) const { - return _load_define_timespan(value, type, name); -} - -bool DefineManager::load_define_months(Timespan& value, Define::Type type, std::string_view name) const { - return _load_define_timespan(value, type, name); -} - -bool DefineManager::load_define_years(Timespan& value, Define::Type type, std::string_view name) const { - return _load_define_timespan(value, type, name); -} - -DefineManager::DefineManager() - : // Date - start_date { 1836, 1, 1 }, - end_date { 1936, 1, 1 }, - - // Country - great_power_rank { 8 }, - lose_great_power_grace_days { Timespan::from_years(1) }, - secondary_power_rank { 16 }, - country_investment_industrial_score_factor { 1 }, - - // Economy - - // Military - pop_size_per_regiment { 1000 }, - min_pop_size_for_regiment { 1000 }, - pop_size_per_regiment_protectorate_multiplier { 1 }, - pop_size_per_regiment_colony_multiplier { 1 }, - pop_size_per_regiment_non_core_multiplier { 1 }, - - // Diplomacy - disarmed_penalty { 0 } - - // Pops - - // Ai - - // Graphics - - {} - -bool DefineManager::add_define(std::string_view name, std::string_view value, Define::Type type) { - if (name.empty()) { - Logger::error("Invalid define identifier - empty!"); - return false; - } - - if (value.empty()) { - Logger::error("Invalid define value for \"", name, "\" - empty!"); - return false; - } - - return defines.add_item({ name, value, type }, duplicate_warning_callback); -} - -bool DefineManager::in_game_period(Date date) const { - return date.in_range(start_date, end_date); -} - -bool DefineManager::load_defines_file(ast::NodeCPtr root) { - using enum Define::Type; - - bool ret = expect_dictionary_keys( - "defines", ONE_EXACTLY, expect_dictionary([this](std::string_view key, ast::NodeCPtr value) -> bool { - - const Define::Type type = Define::string_to_type(key); - - if (type != Unknown) { - - return expect_dictionary_reserve_length( - defines, - [this, type](std::string_view inner_key, ast::NodeCPtr value) -> bool { - return expect_identifier_or_string( - [this, &inner_key, type](std::string_view value) -> bool { - return add_define(inner_key, value, type); - } - )(value); - } - )(value); - - } else if (key == "start_date" || key == "end_date") { - - return expect_identifier_or_string( - [this, &key](std::string_view value) -> bool { - return add_define(key, value, Date); - } - )(value); - - } else { - - Logger::error("Invalid define type - \"", key, "\""); - return false; - - } - }) - )(root); - - lock_defines(); - - // Date - ret &= load_define(start_date, Date, "start_date"); - ret &= load_define(end_date, Date, "end_date"); - - // Country - ret &= load_define(great_power_rank, Country, "GREAT_NATIONS_COUNT"); - ret &= load_define_days(lose_great_power_grace_days, Country, "GREATNESS_DAYS"); - ret &= load_define(secondary_power_rank, Country, "COLONIAL_RANK"); - ret &= load_define(country_investment_industrial_score_factor, Country, "INVESTMENT_SCORE_FACTOR"); - - // Economy - - // Military - ret &= load_define(pop_size_per_regiment, Military, "POP_SIZE_PER_REGIMENT"); - ret &= load_define(min_pop_size_for_regiment, Military, "POP_MIN_SIZE_FOR_REGIMENT"); - ret &= load_define( - pop_size_per_regiment_protectorate_multiplier, Military, "POP_MIN_SIZE_FOR_REGIMENT_PROTECTORATE_MULTIPLIER" - ); - ret &= load_define(pop_size_per_regiment_colony_multiplier, Military, "POP_MIN_SIZE_FOR_REGIMENT_COLONY_MULTIPLIER"); - ret &= load_define(pop_size_per_regiment_non_core_multiplier, Military, "POP_MIN_SIZE_FOR_REGIMENT_NONCORE_MULTIPLIER"); - - // Diplomacy - ret &= load_define(disarmed_penalty, Diplomacy, "DISARMAMENT_ARMY_HIT"); - - // Pops - - // Ai - - // Graphics - - return ret; -} diff --git a/src/openvic-simulation/misc/Define.hpp b/src/openvic-simulation/misc/Define.hpp deleted file mode 100644 index 064883c..0000000 --- a/src/openvic-simulation/misc/Define.hpp +++ /dev/null @@ -1,88 +0,0 @@ -#pragma once - -#include "openvic-simulation/pop/Pop.hpp" -#include "openvic-simulation/types/IdentifierRegistry.hpp" -#include "openvic-simulation/types/fixed_point/FixedPoint.hpp" - -namespace OpenVic { - struct DefineManager; - - struct Define : HasIdentifier { - friend struct DefineManager; - - enum class Type : unsigned char { Unknown, Date, Country, Economy, Military, Diplomacy, Pops, Ai, Graphics }; - - static std::string_view type_to_string(Type type); - // This only accepts type names found in defines.lua, so it will never return Type::Date - static Type string_to_type(std::string_view str); - - private: - std::string PROPERTY(value); - const Type PROPERTY(type); - - Define(std::string_view new_identifier, std::string_view new_value, Type new_type); - - public: - Define(Define&&) = default; - - Date get_value_as_date(bool* successful = nullptr) const; - fixed_point_t get_value_as_fp(bool* successful = nullptr) const; - int64_t get_value_as_int(bool* successful = nullptr) const; - uint64_t get_value_as_uint(bool* successful = nullptr) const; - }; - - std::ostream& operator<<(std::ostream& os, Define::Type type); - - struct DefineManager { - private: - IdentifierRegistry IDENTIFIER_REGISTRY(define); - - // Date - Date PROPERTY(start_date); // start_date - Date PROPERTY(end_date); // end_date - - // Country - size_t PROPERTY(great_power_rank); // GREAT_NATIONS_COUNT - Timespan PROPERTY(lose_great_power_grace_days); // GREATNESS_DAYS - size_t PROPERTY(secondary_power_rank); // COLONIAL_RANK - fixed_point_t PROPERTY(country_investment_industrial_score_factor); // INVESTMENT_SCORE_FACTOR - - // Economy - - // Military - Pop::pop_size_t PROPERTY(pop_size_per_regiment); // POP_SIZE_PER_REGIMENT - Pop::pop_size_t PROPERTY(min_pop_size_for_regiment); // POP_MIN_SIZE_FOR_REGIMENT - // POP_MIN_SIZE_FOR_REGIMENT_PROTECTORATE_MULTIPLIER - fixed_point_t PROPERTY(pop_size_per_regiment_protectorate_multiplier); - fixed_point_t PROPERTY(pop_size_per_regiment_colony_multiplier); // POP_MIN_SIZE_FOR_REGIMENT_COLONY_MULTIPLIER - fixed_point_t PROPERTY(pop_size_per_regiment_non_core_multiplier); // POP_MIN_SIZE_FOR_REGIMENT_NONCORE_MULTIPLIER - - // Diplomacy - fixed_point_t PROPERTY(disarmed_penalty); // DISARMAMENT_ARMY_HIT - - // Pops - - // Ai - - // Graphics - - template - bool load_define(T& value, Define::Type type, std::string_view name) const; - - template - bool _load_define_timespan(Timespan& value, Define::Type type, std::string_view name) const; - - bool load_define_days(Timespan& value, Define::Type type, std::string_view name) const; - bool load_define_months(Timespan& value, Define::Type type, std::string_view name) const; - bool load_define_years(Timespan& value, Define::Type type, std::string_view name) const; - - public: - DefineManager(); - - bool add_define(std::string_view name, std::string_view value, Define::Type type); - - bool in_game_period(Date date) const; - - bool load_defines_file(ast::NodeCPtr root); - }; -} diff --git a/src/openvic-simulation/pop/Pop.cpp b/src/openvic-simulation/pop/Pop.cpp index 5780450..d92aa24 100644 --- a/src/openvic-simulation/pop/Pop.cpp +++ b/src/openvic-simulation/pop/Pop.cpp @@ -2,9 +2,9 @@ #include "openvic-simulation/country/CountryDefinition.hpp" #include "openvic-simulation/country/CountryInstance.hpp" +#include "openvic-simulation/defines/Define.hpp" #include "openvic-simulation/map/ProvinceInstance.hpp" #include "openvic-simulation/military/UnitType.hpp" -#include "openvic-simulation/misc/Define.hpp" #include "openvic-simulation/modifier/ModifierManager.hpp" #include "openvic-simulation/politics/Ideology.hpp" #include "openvic-simulation/politics/Issue.hpp" @@ -144,14 +144,16 @@ void Pop::update_gamestate( DefineManager const& define_manager, CountryInstance const* owner, const fixed_point_t pop_size_per_regiment_multiplier ) { if (type->get_can_be_recruited()) { + MilitaryDefines const& military_defines = define_manager.get_military_defines(); + if ( - size < define_manager.get_min_pop_size_for_regiment() || owner == nullptr || + size < military_defines.get_min_pop_size_for_regiment() || owner == nullptr || !RegimentType::allowed_cultures_check_culture_in_country(owner->get_allowed_regiment_cultures(), culture, *owner) ) { max_supported_regiments = 0; } else { max_supported_regiments = (fixed_point_t::parse(size) / ( - fixed_point_t::parse(define_manager.get_pop_size_per_regiment()) * pop_size_per_regiment_multiplier + fixed_point_t::parse(military_defines.get_pop_size_per_regiment()) * pop_size_per_regiment_multiplier )).to_int64_t() + 1; } } -- cgit v1.2.3-56-ga3b1