aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/economy
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/economy')
-rw-r--r--src/openvic-simulation/economy/Building.cpp62
-rw-r--r--src/openvic-simulation/economy/Building.hpp25
-rw-r--r--src/openvic-simulation/economy/Good.hpp2
-rw-r--r--src/openvic-simulation/economy/ProductionType.cpp66
-rw-r--r--src/openvic-simulation/economy/ProductionType.hpp39
5 files changed, 97 insertions, 97 deletions
diff --git a/src/openvic-simulation/economy/Building.cpp b/src/openvic-simulation/economy/Building.cpp
index 23bd04c..d132e8e 100644
--- a/src/openvic-simulation/economy/Building.cpp
+++ b/src/openvic-simulation/economy/Building.cpp
@@ -5,18 +5,24 @@
using namespace OpenVic;
using namespace OpenVic::NodeTools;
-Building::Building(std::string_view identifier, BuildingType const& type, ARGS) : HasIdentifier { identifier }, ModifierValue { std::move(modifiers) }, type { type },
- on_completion { on_completion }, completion_size { completion_size }, max_level { max_level }, goods_cost { goods_cost }, cost { cost }, build_time { build_time },
- visibility { visibility }, on_map { on_map }, default_enabled { default_enabled }, production_type { production_type }, pop_build_factory { pop_build_factory },
- strategic_factory { strategic_factory }, advanced_factory { advanced_factory }, fort_level { fort_level }, naval_capacity { naval_capacity },
- colonial_points { colonial_points }, in_province { in_province }, one_per_state { one_per_state }, colonial_range { colonial_range },
- infrastructure { infrastructure }, movement_cost { movement_cost }, local_ship_build { local_ship_build }, spawn_railway_track { spawn_railway_track },
+Building::Building(std::string_view identifier, BuildingType const& type, ARGS)
+ : HasIdentifier { identifier }, type { type }, modifier { std::move(modifier) }, on_completion { on_completion },
+ completion_size { completion_size }, max_level { max_level }, goods_cost { std::move(goods_cost) }, cost { cost },
+ build_time { build_time }, visibility { visibility }, on_map { on_map }, default_enabled { default_enabled },
+ production_type { production_type }, pop_build_factory { pop_build_factory }, strategic_factory { strategic_factory },
+ advanced_factory { advanced_factory }, fort_level { fort_level }, naval_capacity { naval_capacity },
+ colonial_points { std::move(colonial_points) }, in_province { in_province }, one_per_state { one_per_state },
+ colonial_range { colonial_range }, infrastructure { infrastructure }, spawn_railway_track { spawn_railway_track },
sail { sail }, steam { steam }, capital { capital }, port { port } {}
BuildingType const& Building::get_type() const {
return type;
}
+ModifierValue const& Building::get_modifier() const {
+ return modifier;
+}
+
std::string_view Building::get_on_completion() const {
return on_completion;
}
@@ -29,7 +35,7 @@ Building::level_t Building::get_max_level() const {
return max_level;
}
-std::map<Good const*, fixed_point_t> const& Building::get_goods_cost() const {
+Good::good_map_t const& Building::get_goods_cost() const {
return goods_cost;
}
@@ -97,17 +103,14 @@ fixed_point_t Building::get_infrastructure() const {
return infrastructure;
}
-fixed_point_t Building::get_movement_cost() const {
- return movement_cost;
-}
-
bool Building::spawned_railway_track() const {
return spawn_railway_track;
}
BuildingType::BuildingType(std::string_view new_identifier) : HasIdentifier { new_identifier } {}
-BuildingInstance::BuildingInstance(Building const& building) : HasIdentifier { building.get_identifier() }, building { building } {}
+BuildingInstance::BuildingInstance(Building const& building)
+ : HasIdentifier { building.get_identifier() }, building { building } {}
Building const& BuildingInstance::get_building() const {
return building;
@@ -181,7 +184,7 @@ bool BuildingManager::add_building_type(std::string_view identifier) {
Logger::error("Invalid building type identifier - empty!");
return false;
}
- return building_types.add_item({ identifier });
+ return building_types.add_item({ identifier }, duplicate_ignore_callback);
}
bool BuildingManager::add_building(std::string_view identifier, BuildingType const* type, ARGS) {
@@ -195,21 +198,16 @@ bool BuildingManager::add_building(std::string_view identifier, BuildingType con
}
return buildings.add_item({
- identifier, *type, on_completion, completion_size, max_level, goods_cost, cost, build_time, visibility, on_map, default_enabled,
- production_type, pop_build_factory, strategic_factory, advanced_factory, fort_level, naval_capacity, colonial_points, in_province, one_per_state,
- colonial_range, infrastructure, movement_cost, local_ship_build, spawn_railway_track, sail, steam, capital, port, std::move(modifiers)
+ identifier, *type, std::move(modifier), on_completion, completion_size, max_level, std::move(goods_cost), cost, build_time, visibility, on_map, default_enabled,
+ production_type, pop_build_factory, strategic_factory, advanced_factory, fort_level, naval_capacity, std::move(colonial_points), in_province, one_per_state,
+ colonial_range, infrastructure, spawn_railway_track, sail, steam, capital, port
});
}
bool BuildingManager::load_buildings_file(GoodManager const& good_manager, ProductionTypeManager const& production_type_manager, ModifierManager const& modifier_manager, ast::NodeCPtr root) {
bool ret = expect_dictionary_reserve_length(buildings, [this](std::string_view, ast::NodeCPtr value) -> bool {
return expect_key("type", expect_identifier(
- [this](std::string_view identifier) -> bool {
- if (!building_types.has_identifier(identifier)) {
- return building_types.add_item({ identifier });
- }
- return true;
- }
+ std::bind(&BuildingManager::add_building_type, this, std::placeholders::_1)
))(value);
})(root);
lock_building_types();
@@ -218,17 +216,17 @@ bool BuildingManager::load_buildings_file(GoodManager const& good_manager, Produ
BuildingType const* type = nullptr;
ProductionType const* production_type = nullptr;
std::string_view on_completion;
- fixed_point_t completion_size = 0, cost = 0, infrastructure = 0, movement_cost = 0, colonial_range = 0, local_ship_build = 0;
+ fixed_point_t completion_size = 0, cost = 0, infrastructure = 0, colonial_range = 0;
Building::level_t max_level = 0, fort_level = 0;
- std::map<Good const*, fixed_point_t> goods_cost;
+ Good::good_map_t goods_cost;
Timespan build_time;
bool visibility = false, on_map = false, default_enabled = false, pop_build_factory = false, strategic_factory = false, advanced_factory = false;
bool in_province = false, one_per_state = false, spawn_railway_track = false, sail = false, steam = false, capital = false, port = false;
uint64_t naval_capacity = 0;
std::vector<fixed_point_t> colonial_points;
- ModifierValue modifiers;
+ ModifierValue modifier;
- bool ret = modifier_manager.expect_modifier_value_and_keys(move_variable_callback(modifiers),
+ bool ret = modifier_manager.expect_modifier_value_and_keys(move_variable_callback(modifier),
"type", ONE_EXACTLY, expect_identifier(expect_building_type_identifier(assign_variable_callback_pointer(type))),
"on_completion", ZERO_OR_ONE, expect_identifier(assign_variable_callback(on_completion)),
"completion_size", ZERO_OR_ONE, expect_fixed_point(assign_variable_callback(completion_size)),
@@ -239,7 +237,8 @@ bool BuildingManager::load_buildings_file(GoodManager const& good_manager, Produ
"visibility", ONE_EXACTLY, expect_bool(assign_variable_callback(visibility)),
"onmap", ONE_EXACTLY, expect_bool(assign_variable_callback(on_map)),
"default_enabled", ZERO_OR_ONE, expect_bool(assign_variable_callback(default_enabled)),
- "production_type", ZERO_OR_ONE, expect_identifier(production_type_manager.expect_production_type_identifier(assign_variable_callback_pointer(production_type))),
+ "production_type", ZERO_OR_ONE, expect_identifier(production_type_manager.expect_production_type_identifier(
+ assign_variable_callback_pointer(production_type))),
"pop_build_factory", ZERO_OR_ONE, expect_bool(assign_variable_callback(pop_build_factory)),
"strategic_factory", ZERO_OR_ONE, expect_bool(assign_variable_callback(strategic_factory)),
"advanced_factory", ZERO_OR_ONE, expect_bool(assign_variable_callback(advanced_factory)),
@@ -253,8 +252,6 @@ bool BuildingManager::load_buildings_file(GoodManager const& good_manager, Produ
"one_per_state", ZERO_OR_ONE, expect_bool(assign_variable_callback(one_per_state)),
"colonial_range", ZERO_OR_ONE, expect_fixed_point(assign_variable_callback(colonial_range)),
"infrastructure", ZERO_OR_ONE, expect_fixed_point(assign_variable_callback(infrastructure)),
- "movement_cost", ZERO_OR_ONE, expect_fixed_point(assign_variable_callback(movement_cost)),
- "local_ship_build", ZERO_OR_ONE, expect_fixed_point(assign_variable_callback(local_ship_build)),
"spawn_railway_track", ZERO_OR_ONE, expect_bool(assign_variable_callback(spawn_railway_track)),
"sail", ZERO_OR_ONE, expect_bool(assign_variable_callback(sail)),
"steam", ZERO_OR_ONE, expect_bool(assign_variable_callback(steam)),
@@ -263,9 +260,10 @@ bool BuildingManager::load_buildings_file(GoodManager const& good_manager, Produ
)(value);
ret &= add_building(
- key, type, on_completion, completion_size, max_level, goods_cost, cost, build_time, visibility, on_map, default_enabled,
- production_type, pop_build_factory, strategic_factory, advanced_factory, fort_level, naval_capacity, colonial_points, in_province,
- one_per_state, colonial_range, infrastructure, movement_cost, local_ship_build, spawn_railway_track, sail, steam, capital, port, std::move(modifiers)
+ key, type,std::move(modifier), on_completion, completion_size, max_level, std::move(goods_cost), cost, build_time,
+ visibility, on_map, default_enabled, production_type, pop_build_factory, strategic_factory, advanced_factory,
+ fort_level, naval_capacity, std::move(colonial_points), in_province, one_per_state, colonial_range, infrastructure,
+ spawn_railway_track, sail, steam, capital, port
);
return ret;
diff --git a/src/openvic-simulation/economy/Building.hpp b/src/openvic-simulation/economy/Building.hpp
index 3d1e24b..cbf5bfd 100644
--- a/src/openvic-simulation/economy/Building.hpp
+++ b/src/openvic-simulation/economy/Building.hpp
@@ -7,12 +7,13 @@
#include "openvic-simulation/economy/ProductionType.hpp"
#include "openvic-simulation/Modifier.hpp"
-#define ARGS std::string_view on_completion, fixed_point_t completion_size, level_t max_level, \
- std::map<Good const*, fixed_point_t> goods_cost, fixed_point_t cost, Timespan build_time, bool visibility, bool on_map, bool default_enabled, \
- ProductionType const* production_type, bool pop_build_factory, bool strategic_factory, bool advanced_factory, level_t fort_level, \
- uint64_t naval_capacity, std::vector<fixed_point_t> colonial_points, bool in_province, bool one_per_state, fixed_point_t colonial_range, \
- fixed_point_t infrastructure, fixed_point_t movement_cost, fixed_point_t local_ship_build, bool spawn_railway_track, bool sail, bool steam, \
- bool capital, bool port, ModifierValue&& modifiers
+#define ARGS \
+ ModifierValue&& modifier, std::string_view on_completion, fixed_point_t completion_size, level_t max_level, \
+ Good::good_map_t&& goods_cost, fixed_point_t cost, Timespan build_time, bool visibility, bool on_map, bool default_enabled, \
+ ProductionType const* production_type, bool pop_build_factory, bool strategic_factory, bool advanced_factory, level_t fort_level, \
+ uint64_t naval_capacity, std::vector<fixed_point_t>&& colonial_points, bool in_province, bool one_per_state, fixed_point_t colonial_range, \
+ fixed_point_t infrastructure, bool spawn_railway_track, bool sail, bool steam, \
+ bool capital, bool port
namespace OpenVic {
@@ -24,17 +25,18 @@ namespace OpenVic {
* MAP-12, MAP-75, MAP-76
* MAP-13, MAP-78, MAP-79
*/
- struct Building : HasIdentifier, ModifierValue {
+ struct Building : HasIdentifier {
friend struct BuildingManager;
using level_t = int16_t;
private:
BuildingType const& type;
+ ModifierValue modifier;
const std::string on_completion; //probably sound played on completion
const fixed_point_t completion_size;
const level_t max_level;
- const std::map<Good const*, fixed_point_t> goods_cost;
+ const Good::good_map_t goods_cost;
const fixed_point_t cost;
const Timespan build_time; //time
const bool visibility;
@@ -55,8 +57,6 @@ namespace OpenVic {
const fixed_point_t colonial_range;
const fixed_point_t infrastructure;
- const fixed_point_t movement_cost;
- const fixed_point_t local_ship_build;
const bool spawn_railway_track;
const bool sail; //only in clipper shipyard
@@ -70,10 +70,11 @@ namespace OpenVic {
Building(Building&&) = default;
BuildingType const& get_type() const;
+ ModifierValue const& get_modifier() const;
std::string_view get_on_completion() const;
fixed_point_t get_completion_size() const;
level_t get_max_level() const;
- std::map<Good const*, fixed_point_t> const& get_goods_cost() const;
+ Good::good_map_t const& get_goods_cost() const;
fixed_point_t get_cost() const;
Timespan get_build_time() const;
bool has_visibility() const;
@@ -94,8 +95,6 @@ namespace OpenVic {
fixed_point_t get_colonial_range() const;
fixed_point_t get_infrastructure() const;
- fixed_point_t get_movement_cost() const;
- fixed_point_t get_local_ship_build() const;
bool spawned_railway_track() const;
};
diff --git a/src/openvic-simulation/economy/Good.hpp b/src/openvic-simulation/economy/Good.hpp
index 1dce41f..2a850fa 100644
--- a/src/openvic-simulation/economy/Good.hpp
+++ b/src/openvic-simulation/economy/Good.hpp
@@ -33,6 +33,8 @@ namespace OpenVic {
using price_t = fixed_point_t;
static constexpr price_t NULL_PRICE = fixed_point_t::_0();
+ using good_map_t = decimal_map_t<Good const*>;
+
private:
GoodCategory const& category;
const price_t base_price;
diff --git a/src/openvic-simulation/economy/ProductionType.cpp b/src/openvic-simulation/economy/ProductionType.cpp
index 01d45be..3a27cd6 100644
--- a/src/openvic-simulation/economy/ProductionType.cpp
+++ b/src/openvic-simulation/economy/ProductionType.cpp
@@ -8,29 +8,29 @@ using namespace OpenVic::NodeTools;
EmployedPop::EmployedPop(PopType const* pop_type, bool artisan, effect_t effect, fixed_point_t effect_multiplier, fixed_point_t amount)
: pop_type { pop_type }, artisan { artisan }, effect { effect }, effect_multiplier { effect_multiplier }, amount { amount } {}
-PopType const* EmployedPop::get_pop_type() {
+PopType const* EmployedPop::get_pop_type() const {
return pop_type;
}
-bool EmployedPop::is_artisan() {
+bool EmployedPop::is_artisan() const {
return artisan;
}
-EmployedPop::effect_t EmployedPop::get_effect() {
+EmployedPop::effect_t EmployedPop::get_effect() const {
return effect;
}
-fixed_point_t EmployedPop::get_effect_multiplier() {
+fixed_point_t EmployedPop::get_effect_multiplier() const {
return effect_multiplier;
}
-fixed_point_t EmployedPop::get_amount() {
+fixed_point_t EmployedPop::get_amount() const {
return amount;
}
-ProductionType::ProductionType(PRODUCTION_TYPE_ARGS) : HasIdentifier { identifier }, owner { owner },
- employees { employees }, type { type }, workforce { workforce }, input_goods { input_goods }, output_goods { output_goods },
- value { value }, bonuses { bonuses }, efficiency { efficiency }, coastal { coastal }, farm { farm }, mine { mine } {}
+ProductionType::ProductionType(PRODUCTION_TYPE_ARGS) : HasIdentifier { identifier }, owner { owner }, employees { employees },
+ type { type }, workforce { workforce }, input_goods { std::move(input_goods) }, output_goods { output_goods },
+ value { value }, bonuses { std::move(bonuses) }, efficiency { std::move(efficiency) }, coastal { coastal }, farm { farm }, mine { mine } {}
EmployedPop const& ProductionType::get_owner() const {
return owner;
@@ -48,7 +48,7 @@ Pop::pop_size_t ProductionType::get_workforce() const {
return workforce;
}
-std::map<Good const*, fixed_point_t> const& ProductionType::get_input_goods() {
+Good::good_map_t const& ProductionType::get_input_goods() const {
return input_goods;
}
@@ -60,11 +60,11 @@ fixed_point_t ProductionType::get_value() const {
return value;
}
-std::vector<Bonus> const& ProductionType::get_bonuses() {
+std::vector<Bonus> const& ProductionType::get_bonuses() const {
return bonuses;
}
-std::map<Good const*, fixed_point_t> const& ProductionType::get_efficiency() {
+Good::good_map_t const& ProductionType::get_efficiency() const {
return efficiency;
}
@@ -83,7 +83,7 @@ bool ProductionType::is_mine() const {
ProductionTypeManager::ProductionTypeManager() : production_types { "production types" } {}
node_callback_t ProductionTypeManager::_expect_employed_pop(GoodManager const& good_manager, PopManager const& pop_manager,
- callback_t<EmployedPop> cb) {
+ callback_t<EmployedPop&&> cb) {
return [this, &good_manager, &pop_manager, cb](ast::NodeCPtr node) -> bool {
std::string_view pop_type;
@@ -113,12 +113,12 @@ node_callback_t ProductionTypeManager::_expect_employed_pop(GoodManager const& g
}
}
- return res & cb(EmployedPop { found_pop_type, artisan, effect, effect_multiplier, amount });
+ return res & cb({ found_pop_type, artisan, effect, effect_multiplier, amount });
};
}
node_callback_t ProductionTypeManager::_expect_employed_pop_list(GoodManager const& good_manager, PopManager const& pop_manager,
- callback_t<std::vector<EmployedPop>> cb) {
+ callback_t<std::vector<EmployedPop>&&> cb) {
return [this, &good_manager, &pop_manager, cb](ast::NodeCPtr node) -> bool {
std::vector<EmployedPop> employed_pops;
@@ -128,7 +128,7 @@ node_callback_t ProductionTypeManager::_expect_employed_pop_list(GoodManager con
employed_pops.push_back(owner);
return res_partial;
})(node);
- return res & cb(employed_pops);
+ return res & cb(std::move(employed_pops));
};
}
@@ -166,25 +166,25 @@ bool ProductionTypeManager::add_production_type(PRODUCTION_TYPE_ARGS, GoodManage
}
return production_types.add_item({
- identifier, owner, employees, type, workforce, input_goods,
- output_goods, value, bonuses, efficiency, coastal, farm, mine
+ identifier, owner, employees, type, workforce, std::move(input_goods),
+ output_goods, value, std::move(bonuses), std::move(efficiency), coastal, farm, mine
});
}
#define PARSE_NODE expect_dictionary_keys_and_default( \
- key_value_success_callback, \
- "owner", ZERO_OR_ONE, _expect_employed_pop(good_manager, pop_manager, move_variable_callback(owner)), \
- "employees", ZERO_OR_ONE, _expect_employed_pop_list(good_manager, pop_manager, move_variable_callback(employees)), \
- "type", ZERO_OR_ONE, expect_identifier(expect_mapped_string(type_map, assign_variable_callback(type))), \
- "workforce", ZERO_OR_ONE, expect_uint(assign_variable_callback(workforce)), \
- "input_goods", ZERO_OR_ONE, good_manager.expect_good_decimal_map(move_variable_callback(input_goods)), \
- "output_goods", ZERO_OR_ONE, expect_identifier(good_manager.expect_good_identifier(assign_variable_callback_pointer(output_goods))), \
- "value", ZERO_OR_ONE, expect_fixed_point(assign_variable_callback(value)), \
- "efficiency", ZERO_OR_ONE, good_manager.expect_good_decimal_map(move_variable_callback(efficiency)), \
- "is_coastal", ZERO_OR_ONE, expect_bool(assign_variable_callback(coastal)), \
- "farm", ZERO_OR_ONE, expect_bool(assign_variable_callback(farm)), \
- "mine", ZERO_OR_ONE, expect_bool(assign_variable_callback(mine)) \
- )
+ key_value_success_callback, \
+ "owner", ZERO_OR_ONE, _expect_employed_pop(good_manager, pop_manager, move_variable_callback(owner)), \
+ "employees", ZERO_OR_ONE, _expect_employed_pop_list(good_manager, pop_manager, move_variable_callback(employees)), \
+ "type", ZERO_OR_ONE, expect_identifier(expect_mapped_string(type_map, assign_variable_callback(type))), \
+ "workforce", ZERO_OR_ONE, expect_uint(assign_variable_callback(workforce)), \
+ "input_goods", ZERO_OR_ONE, good_manager.expect_good_decimal_map(move_variable_callback(input_goods)), \
+ "output_goods", ZERO_OR_ONE, expect_identifier(good_manager.expect_good_identifier(assign_variable_callback_pointer(output_goods))), \
+ "value", ZERO_OR_ONE, expect_fixed_point(assign_variable_callback(value)), \
+ "efficiency", ZERO_OR_ONE, good_manager.expect_good_decimal_map(move_variable_callback(efficiency)), \
+ "is_coastal", ZERO_OR_ONE, expect_bool(assign_variable_callback(coastal)), \
+ "farm", ZERO_OR_ONE, expect_bool(assign_variable_callback(farm)), \
+ "mine", ZERO_OR_ONE, expect_bool(assign_variable_callback(mine)) \
+ )
bool ProductionTypeManager::load_production_types_file(GoodManager const& good_manager, PopManager const& pop_manager, ast::NodeCPtr root) {
size_t expected_types = 0;
@@ -236,7 +236,7 @@ bool ProductionTypeManager::load_production_types_file(GoodManager const& good_m
ProductionType::type_t type;
Good const* output_goods = nullptr;
Pop::pop_size_t workforce = 0; // 0 is a meaningless value -> unset
- std::map<Good const*, fixed_point_t> input_goods, efficiency;
+ Good::good_map_t input_goods, efficiency;
fixed_point_t value = 0; // 0 is a meaningless value -> unset
std::vector<Bonus> bonuses;
bool coastal = false, farm = false, mine = false;
@@ -260,8 +260,8 @@ bool ProductionTypeManager::load_production_types_file(GoodManager const& good_m
ret &= PARSE_NODE(node);
ret &= add_production_type(
- key, owner, employees, type, workforce, input_goods, output_goods, value,
- bonuses, efficiency, coastal, farm, mine, good_manager
+ key, owner, employees, type, workforce, std::move(input_goods), output_goods, value,
+ std::move(bonuses), std::move(efficiency), coastal, farm, mine, good_manager
);
return ret;
}
diff --git a/src/openvic-simulation/economy/ProductionType.hpp b/src/openvic-simulation/economy/ProductionType.hpp
index 420e70e..2deb461 100644
--- a/src/openvic-simulation/economy/ProductionType.hpp
+++ b/src/openvic-simulation/economy/ProductionType.hpp
@@ -7,9 +7,8 @@
#define PRODUCTION_TYPE_ARGS \
std::string_view identifier, EmployedPop owner, std::vector<EmployedPop> employees, ProductionType::type_t type, \
- Pop::pop_size_t workforce, std::map<Good const*, fixed_point_t> input_goods, Good const* output_goods, \
- fixed_point_t value, std::vector<Bonus> bonuses, std::map<Good const*, fixed_point_t> efficiency, \
- bool coastal, bool farm, bool mine
+ Pop::pop_size_t workforce, Good::good_map_t&& input_goods, Good const* output_goods, fixed_point_t value, \
+ std::vector<Bonus>&& bonuses, Good::good_map_t&& efficiency, bool coastal, bool farm, bool mine
namespace OpenVic {
struct ProductionTypeManager;
@@ -17,14 +16,16 @@ namespace OpenVic {
struct EmployedPop {
friend struct ProductionTypeManager;
- private:
- PopType const* pop_type; // poptype
- bool artisan; // set by the parser if the magic "artisan" poptype is passed
enum struct effect_t {
INPUT,
OUTPUT,
THROUGHPUT
- } effect;
+ };
+
+ private:
+ PopType const* pop_type; // poptype
+ bool artisan; // set by the parser if the magic "artisan" poptype is passed
+ effect_t effect;
fixed_point_t effect_multiplier;
fixed_point_t amount;
@@ -33,11 +34,11 @@ namespace OpenVic {
public:
EmployedPop() = default;
- PopType const* get_pop_type();
- bool is_artisan();
- effect_t get_effect();
- fixed_point_t get_effect_multiplier();
- fixed_point_t get_amount();
+ PopType const* get_pop_type() const;
+ bool is_artisan() const;
+ effect_t get_effect() const;
+ fixed_point_t get_effect_multiplier() const;
+ fixed_point_t get_amount() const;
};
struct Bonus {
@@ -58,12 +59,12 @@ namespace OpenVic {
} type;
const Pop::pop_size_t workforce;
- const std::map<Good const*, fixed_point_t> input_goods;
+ const Good::good_map_t input_goods;
Good const* output_goods;
const fixed_point_t value;
const std::vector<Bonus> bonuses;
- const std::map<Good const*, fixed_point_t> efficiency;
+ const Good::good_map_t efficiency;
const bool coastal; // is_coastal
const bool farm;
@@ -79,12 +80,12 @@ namespace OpenVic {
type_t get_type() const;
Pop::pop_size_t get_workforce() const;
- std::map<Good const*, fixed_point_t> const& get_input_goods();
+ Good::good_map_t const& get_input_goods() const;
Good const* get_output_goods() const;
fixed_point_t get_value() const;
- std::vector<Bonus> const& get_bonuses();
+ std::vector<Bonus> const& get_bonuses() const;
- std::map<Good const*, fixed_point_t> const& get_efficiency();
+ Good::good_map_t const& get_efficiency() const;
bool is_coastal() const;
bool is_farm() const;
@@ -96,9 +97,9 @@ namespace OpenVic {
IdentifierRegistry<ProductionType> production_types;
NodeTools::node_callback_t _expect_employed_pop(GoodManager const& good_manager, PopManager const& pop_manager,
- NodeTools::callback_t<EmployedPop> cb);
+ NodeTools::callback_t<EmployedPop&&> cb);
NodeTools::node_callback_t _expect_employed_pop_list(GoodManager const& good_manager, PopManager const& pop_manager,
- NodeTools::callback_t<std::vector<EmployedPop>> cb);
+ NodeTools::callback_t<std::vector<EmployedPop>&&> cb);
public:
ProductionTypeManager();