From b8cfc0f407c639a2ddfa6e4044f338b9fc20c66a Mon Sep 17 00:00:00 2001 From: Julius <43428735+Juliusfrank11@users.noreply.github.com> Date: Wed, 13 Nov 2024 17:19:16 -0500 Subject: Created Slider header file Need to work on updating tax rate --- src/openvic-simulation/country/CountryInstance.cpp | 17 ++++++++++++++--- src/openvic-simulation/country/CountryInstance.hpp | 10 ++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) (limited to 'src/openvic-simulation/country') diff --git a/src/openvic-simulation/country/CountryInstance.cpp b/src/openvic-simulation/country/CountryInstance.cpp index 4ecb902..d3a0f2a 100644 --- a/src/openvic-simulation/country/CountryInstance.cpp +++ b/src/openvic-simulation/country/CountryInstance.cpp @@ -10,6 +10,8 @@ #include "openvic-simulation/politics/Ideology.hpp" #include "openvic-simulation/research/Invention.hpp" #include "openvic-simulation/research/Technology.hpp" +#include "openvic-simulation/types/Sliders.hpp" +#include "openvic-simulation/types/fixed_point/FixedPoint.hpp" using namespace OpenVic; @@ -56,6 +58,11 @@ CountryInstance::CountryInstance( /* Budget */ cash_stockpile { 0 }, + poor_tax_rate_slider {50}, + middle_tax_rate_slider { 50}, + rich_tax_rate_slider {50}, + + // TODO: /* Technology */ technology_unlock_levels { &technology_keys }, @@ -280,6 +287,10 @@ bool CountryInstance::add_reform(Reform const& new_reform) { } } +bool CountryInstance::set_value_for_slider(SliderManager& slider, int const* new_value) { + +} + template bool CountryInstance::add_unit_instance_group(UnitInstanceGroup& group) { if (get_unit_instance_groups().emplace(static_cast*>(&group)).second) { @@ -974,8 +985,8 @@ void CountryInstance::update_modifier_sum(Date today, StaticModifierCache const& modifier_sum.add_modifier(static_modifier_cache.get_infamy(), country_source, infamy); modifier_sum.add_modifier(static_modifier_cache.get_literacy(), country_source, national_literacy); modifier_sum.add_modifier(static_modifier_cache.get_plurality(), country_source, plurality); - // TODO - difficulty modifiers, war, peace, debt_default_to, bad_debter, generalised_debt_default, - // total_occupation, total_blockaded, in_bankrupcy + // TODO - difficulty modifiers, war, peace, debt_default_to, bad_debtor, generalised_debt_default, + // total_occupation, total_blockaded, in_bankruptcy // TODO - handle triggered modifiers @@ -1198,7 +1209,7 @@ void CountryInstanceManager::update_rankings(Date today, DefineManager const& de } // Sort the great powers list by total rank, as pre-existing great powers may have changed rank order and new great - // powers will have beeen added to the end of the list regardless of rank. + // powers will have been added to the end of the list regardless of rank. std::sort(great_powers.begin(), great_powers.end(), [](CountryInstance const* a, CountryInstance const* b) -> bool { return a->get_total_rank() < b->get_total_rank(); }); diff --git a/src/openvic-simulation/country/CountryInstance.hpp b/src/openvic-simulation/country/CountryInstance.hpp index 6e01649..67a2981 100644 --- a/src/openvic-simulation/country/CountryInstance.hpp +++ b/src/openvic-simulation/country/CountryInstance.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include @@ -12,8 +13,11 @@ #include "openvic-simulation/types/Date.hpp" #include "openvic-simulation/types/IdentifierRegistry.hpp" #include "openvic-simulation/types/IndexedMap.hpp" +#include "openvic-simulation/types/fixed_point/FixedPoint.hpp" +#include "openvic-simulation/types/Sliders.hpp" #include "openvic-simulation/utility/Getters.hpp" + namespace OpenVic { struct CountryInstanceManager; struct CountryDefinition; @@ -98,6 +102,10 @@ namespace OpenVic { /* Budget */ fixed_point_t PROPERTY(cash_stockpile); + slider_value_t PROPERTY(poor_tax_rate_slider); + slider_value_t PROPERTY(middle_tax_rate_slider); + slider_value_t PROPERTY(rich_tax_rate_slider); + // TODO - cash stockpile change over last 30 days /* Technology */ @@ -227,6 +235,8 @@ namespace OpenVic { bool set_ruling_party(CountryParty const& new_ruling_party); bool add_reform(Reform const& new_reform); + bool set_value_for_slider(SliderManager& slider_manager, int const* new_value); + template bool add_unit_instance_group(UnitInstanceGroup& group); template -- cgit v1.2.3-56-ga3b1