aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/country
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/country')
-rw-r--r--src/openvic-simulation/country/CountryInstance.cpp16
-rw-r--r--src/openvic-simulation/country/CountryInstance.hpp12
2 files changed, 28 insertions, 0 deletions
diff --git a/src/openvic-simulation/country/CountryInstance.cpp b/src/openvic-simulation/country/CountryInstance.cpp
index 043494d..ea9596f 100644
--- a/src/openvic-simulation/country/CountryInstance.cpp
+++ b/src/openvic-simulation/country/CountryInstance.cpp
@@ -18,6 +18,9 @@ using enum CountryInstance::country_status_t;
static constexpr colour_t ERROR_COLOUR = colour_t::from_integer(0xFF0000);
CountryInstance::CountryInstance(
+#if OV_MODIFIER_CALCULATION_TEST
+ bool new_ADD_OWNER_CONTRIBUTION,
+#endif
CountryDefinition const* new_country_definition,
decltype(building_type_unlock_levels)::keys_t const& building_type_keys,
decltype(technology_unlock_levels)::keys_t const& technology_keys,
@@ -30,6 +33,9 @@ CountryInstance::CountryInstance(
decltype(regiment_type_unlock_levels)::keys_t const& regiment_type_unlock_levels_keys,
decltype(ship_type_unlock_levels)::keys_t const& ship_type_unlock_levels_keys
) : /* Main attributes */
+#if OV_MODIFIER_CALCULATION_TEST
+ ADD_OWNER_CONTRIBUTION { new_ADD_OWNER_CONTRIBUTION },
+#endif
country_definition { new_country_definition },
colour { ERROR_COLOUR },
capital { nullptr },
@@ -1009,7 +1015,11 @@ void CountryInstance::update_modifier_sum(Date today, StaticModifierCache const&
}
}
+#if OV_MODIFIER_CALCULATION_TEST
+ if (ADD_OWNER_CONTRIBUTION) {
+#else
if constexpr (ProvinceInstance::ADD_OWNER_CONTRIBUTION) {
+#endif
// Add province base modifiers (with local province modifier effects removed)
for (ProvinceInstance const* province : controlled_provinces) {
contribute_province_modifier_sum(province->get_modifier_sum());
@@ -1219,6 +1229,9 @@ CountryInstance const& CountryInstanceManager::get_country_instance_from_definit
}
bool CountryInstanceManager::generate_country_instances(
+#if OV_MODIFIER_CALCULATION_TEST
+ bool ADD_OWNER_CONTRIBUTION,
+#endif
CountryDefinitionManager const& country_definition_manager,
decltype(CountryInstance::building_type_unlock_levels)::keys_t const& building_type_keys,
decltype(CountryInstance::technology_unlock_levels)::keys_t const& technology_keys,
@@ -1237,6 +1250,9 @@ bool CountryInstanceManager::generate_country_instances(
for (CountryDefinition const& country_definition : country_definition_manager.get_country_definitions()) {
ret &= country_instances.add_item({
+#if OV_MODIFIER_CALCULATION_TEST
+ ADD_OWNER_CONTRIBUTION,
+#endif
&country_definition,
building_type_keys,
technology_keys,
diff --git a/src/openvic-simulation/country/CountryInstance.hpp b/src/openvic-simulation/country/CountryInstance.hpp
index ea30c0d..d62a138 100644
--- a/src/openvic-simulation/country/CountryInstance.hpp
+++ b/src/openvic-simulation/country/CountryInstance.hpp
@@ -14,6 +14,8 @@
#include "openvic-simulation/types/IndexedMap.hpp"
#include "openvic-simulation/utility/Getters.hpp"
+#include "openvic-simulation/ModifierCalculationTestToggle.hpp"
+
namespace OpenVic {
struct CountryInstanceManager;
struct CountryDefinition;
@@ -64,6 +66,10 @@ namespace OpenVic {
using unit_variant_t = uint8_t;
private:
+#if OV_MODIFIER_CALCULATION_TEST
+ const bool ADD_OWNER_CONTRIBUTION;
+#endif
+
/* Main attributes */
// We can always assume country_definition is not null, as it is initialised from a reference and only ever changed
// by swapping with another CountryInstance's country_definition.
@@ -187,6 +193,9 @@ namespace OpenVic {
UNIT_BRANCHED_GETTER(get_unit_type_unlock_levels, regiment_type_unlock_levels, ship_type_unlock_levels);
CountryInstance(
+#if OV_MODIFIER_CALCULATION_TEST
+ bool new_ADD_OWNER_CONTRIBUTION,
+#endif
CountryDefinition const* new_country_definition,
decltype(building_type_unlock_levels)::keys_t const& building_type_keys,
decltype(technology_unlock_levels)::keys_t const& technology_keys,
@@ -345,6 +354,9 @@ namespace OpenVic {
CountryInstance const& get_country_instance_from_definition(CountryDefinition const& country) const;
bool generate_country_instances(
+#if OV_MODIFIER_CALCULATION_TEST
+ bool ADD_OWNER_CONTRIBUTION,
+#endif
CountryDefinitionManager const& country_definition_manager,
decltype(CountryInstance::building_type_unlock_levels)::keys_t const& building_type_keys,
decltype(CountryInstance::technology_unlock_levels)::keys_t const& technology_keys,