aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/ProvinceInstance.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/map/ProvinceInstance.hpp')
-rw-r--r--src/openvic-simulation/map/ProvinceInstance.hpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/openvic-simulation/map/ProvinceInstance.hpp b/src/openvic-simulation/map/ProvinceInstance.hpp
index 7e2754f..ba800a9 100644
--- a/src/openvic-simulation/map/ProvinceInstance.hpp
+++ b/src/openvic-simulation/map/ProvinceInstance.hpp
@@ -1,4 +1,5 @@
#pragma once
+
#include <plf_colony.h>
#include "openvic-simulation/economy/BuildingInstance.hpp"
@@ -6,11 +7,11 @@
#include "openvic-simulation/economy/production/ResourceGatheringOperation.hpp"
#include "openvic-simulation/military/UnitInstance.hpp"
#include "openvic-simulation/military/UnitType.hpp"
+#include "openvic-simulation/modifier/ModifierSum.hpp"
#include "openvic-simulation/pop/Pop.hpp"
#include "openvic-simulation/types/HasIdentifier.hpp"
#include "openvic-simulation/types/OrderedContainers.hpp"
-
namespace OpenVic {
struct MapInstance;
struct ProvinceDefinition;
@@ -22,6 +23,7 @@ namespace OpenVic {
struct Ideology;
struct Culture;
struct Religion;
+ struct StaticModifierCache;
struct BuildingTypeManager;
struct ProvinceHistoryEntry;
struct IssueManager;
@@ -69,6 +71,15 @@ namespace OpenVic {
CountryInstance* PROPERTY(controller);
ordered_set<CountryInstance*> PROPERTY(cores);
+ public:
+ static constexpr bool ADD_OWNER_CONTRIBUTION = true;
+
+ private:
+ // The total/resultant modifier affecting this province, including owner country contributions if
+ // ADD_OWNER_CONTRIBUTION is true.
+ ModifierSum PROPERTY(modifier_sum);
+ std::vector<ModifierInstance> PROPERTY(event_modifiers);
+
bool PROPERTY(slave);
Crime const* PROPERTY_RW(crime);
ResourceGatheringOperation PROPERTY(rgo);
@@ -84,7 +95,7 @@ namespace OpenVic {
fixed_point_t PROPERTY(average_literacy);
fixed_point_t PROPERTY(average_consciousness);
fixed_point_t PROPERTY(average_militancy);
- IndexedMap<PopType, fixed_point_t> PROPERTY(pop_type_distribution);
+ IndexedMap<PopType, Pop::pop_size_t> PROPERTY(pop_type_distribution);
IndexedMap<Ideology, fixed_point_t> PROPERTY(ideology_distribution);
fixed_point_map_t<Culture const*> PROPERTY(culture_distribution);
fixed_point_map_t<Religion const*> PROPERTY(religion_distribution);
@@ -97,7 +108,7 @@ namespace OpenVic {
void _add_pop(Pop&& pop);
void _update_pops(DefineManager const& define_manager);
- void convert_rgo_worker_pops_to_equivalent(ProductionType const& production_type);
+ bool convert_rgo_worker_pops_to_equivalent(ProductionType const& production_type);
public:
ProvinceInstance(ProvinceInstance&&) = default;
@@ -114,7 +125,7 @@ namespace OpenVic {
}
GoodDefinition const* get_rgo_good() const;
- void set_rgo_production_type(ProductionType const& rgo_production_type);
+ bool set_rgo_production_type_nullable(ProductionType const* rgo_production_type_nullable);
bool set_owner(CountryInstance* new_owner);
bool set_controller(CountryInstance* new_controller);
@@ -128,6 +139,15 @@ namespace OpenVic {
bool add_pop_vec(std::vector<PopBase> const& pop_vec);
size_t get_pop_count() const;
+ void update_modifier_sum(Date today, StaticModifierCache const& static_modifier_cache);
+ void contribute_country_modifier_sum(ModifierSum const& owner_modifier_sum);
+ fixed_point_t get_modifier_effect_value(ModifierEffect const& effect) const;
+ fixed_point_t get_modifier_effect_value_nullcheck(ModifierEffect const* effect) const;
+ void push_contributing_modifiers(
+ ModifierEffect const& effect, std::vector<ModifierSum::modifier_entry_t>& contributions
+ ) const;
+ std::vector<ModifierSum::modifier_entry_t> get_contributing_modifiers(ModifierEffect const& effect) const;
+
void update_gamestate(Date today, DefineManager const& define_manager);
void tick(Date today);
@@ -139,9 +159,9 @@ namespace OpenVic {
bool setup(BuildingTypeManager const& building_type_manager);
bool apply_history_to_province(ProvinceHistoryEntry const& entry, CountryInstanceManager& country_manager);
- //after history and pops!
- void setup_rgo(ProductionType const& rgo_production_type);
+ void initialise_for_new_game(ModifierEffectCache const& modifier_effect_cache);
void setup_pop_test_values(IssueManager const& issue_manager);
+ plf::colony<Pop>& get_mutable_pops();
};
}