aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/economy/production/ResourceGatheringOperation.hpp
diff options
context:
space:
mode:
author wvpm <24685035+wvpm@users.noreply.github.com>2024-11-03 22:23:39 +0100
committer wvpm <24685035+wvpm@users.noreply.github.com>2024-11-03 22:39:01 +0100
commit4eba08af501560e9139a562c53fbbc8b694fb4cf (patch)
treee9553d2f4ed09abb920921006b976c7ef4baa46c /src/openvic-simulation/economy/production/ResourceGatheringOperation.hpp
parent19026ff6aee8748df4777ec044065d13460e806a (diff)
ModifierEffectCache & location to fieldsto_fields
Diffstat (limited to 'src/openvic-simulation/economy/production/ResourceGatheringOperation.hpp')
-rw-r--r--src/openvic-simulation/economy/production/ResourceGatheringOperation.hpp26
1 files changed, 17 insertions, 9 deletions
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<PopType, Pop::pop_size_t> 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<Pop*> 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<Pop*>* 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<Employee>&& 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();
};
}