From 4eba08af501560e9139a562c53fbbc8b694fb4cf Mon Sep 17 00:00:00 2001 From: wvpm <24685035+wvpm@users.noreply.github.com> Date: Sun, 3 Nov 2024 22:23:39 +0100 Subject: ModifierEffectCache & location to fields --- .../production/ResourceGatheringOperation.hpp | 26 ++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'src/openvic-simulation/economy/production/ResourceGatheringOperation.hpp') diff --git a/src/openvic-simulation/economy/production/ResourceGatheringOperation.hpp b/src/openvic-simulation/economy/production/ResourceGatheringOperation.hpp index d94a22a..4b87cb4 100644 --- a/src/openvic-simulation/economy/production/ResourceGatheringOperation.hpp +++ b/src/openvic-simulation/economy/production/ResourceGatheringOperation.hpp @@ -8,8 +8,12 @@ #include "openvic-simulation/utility/Getters.hpp" namespace OpenVic { + struct ProvinceInstance; + struct ResourceGatheringOperation { private: + ModifierEffectCache const& modifier_effect_cache; + ProvinceInstance* location_ptr; ProductionType const* PROPERTY_RW(production_type_nullable); fixed_point_t PROPERTY(revenue_yesterday); fixed_point_t PROPERTY(output_quantity_yesterday); @@ -23,16 +27,13 @@ namespace OpenVic { fixed_point_t PROPERTY(total_employee_income_cache); IndexedMap PROPERTY(employee_count_per_type_cache); - fixed_point_t calculate_size_modifier(ProvinceInstance const& location, ModifierEffectCache const& modifier_effect_cache) const; - void hire(ProvinceInstance& location, const Pop::pop_size_t available_worker_count); + fixed_point_t calculate_size_modifier() const; + void hire(const Pop::pop_size_t available_worker_count); fixed_point_t produce( - ProvinceInstance& location, std::vector const* const owner_pops_cache, - const Pop::pop_size_t total_owner_count_in_state_cache, - ModifierEffectCache const& modifier_effect_cache + const Pop::pop_size_t total_owner_count_in_state_cache ); void pay_employees( - ProvinceInstance& location, const fixed_point_t revenue, const Pop::pop_size_t total_worker_count_in_province, std::vector* const owner_pops_cache, @@ -41,6 +42,7 @@ namespace OpenVic { public: ResourceGatheringOperation( + ModifierEffectCache const& new_modifier_effect_cache, ProductionType const* new_production_type_nullable, fixed_point_t new_size_multiplier, fixed_point_t new_revenue_yesterday, @@ -49,11 +51,17 @@ namespace OpenVic { std::vector&& new_employees, decltype(employee_count_per_type_cache)::keys_t const& pop_type_keys ); - ResourceGatheringOperation(decltype(employee_count_per_type_cache)::keys_t const& pop_type_keys); + + ResourceGatheringOperation( + ModifierEffectCache const& new_modifier_effect_cache, + decltype(employee_count_per_type_cache)::keys_t const& pop_type_keys + ); + constexpr bool is_valid() const { return production_type_nullable != nullptr; } - void initialise_rgo_size_multiplier(ProvinceInstance& location, ModifierEffectCache const& modifier_effect_cache); - void rgo_tick(ProvinceInstance& location, ModifierEffectCache const& modifier_effect_cache); + void setup_location_ptr(ProvinceInstance& location); + void initialise_rgo_size_multiplier(); + void rgo_tick(); }; } -- cgit v1.2.3-56-ga3b1