aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/pop
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/pop')
-rw-r--r--src/openvic-simulation/pop/Culture.cpp6
-rw-r--r--src/openvic-simulation/pop/Pop.cpp20
-rw-r--r--src/openvic-simulation/pop/Pop.hpp6
3 files changed, 6 insertions, 26 deletions
diff --git a/src/openvic-simulation/pop/Culture.cpp b/src/openvic-simulation/pop/Culture.cpp
index bbfa35a..85c96a0 100644
--- a/src/openvic-simulation/pop/Culture.cpp
+++ b/src/openvic-simulation/pop/Culture.cpp
@@ -1,7 +1,5 @@
#include "Culture.hpp"
-#include <set>
-
#include "openvic-simulation/dataloader/NodeTools.hpp"
using namespace OpenVic;
@@ -121,7 +119,7 @@ bool CultureManager::_load_culture_group(size_t& total_expected_cultures,
bool ret = expect_dictionary_keys_and_default(
increment_callback(total_expected_cultures),
"leader", ONE_EXACTLY, expect_identifier(assign_variable_callback(leader)),
- "unit", ZERO_OR_ONE, expect_identifier(expect_graphical_culture_type_identifier(assign_variable_callback_pointer(unit_graphical_culture_type))),
+ "unit", ZERO_OR_ONE, expect_graphical_culture_type_identifier(assign_variable_callback_pointer(unit_graphical_culture_type)),
"union", ZERO_OR_ONE, success_callback,
"is_overseas", ZERO_OR_ONE, expect_bool(assign_variable_callback(is_overseas))
)(culture_group_node);
@@ -193,7 +191,7 @@ bool CultureManager::load_culture_file(ast::NodeCPtr root) {
CultureGroup const* culture_group = get_culture_group_by_identifier(culture_group_key);
return expect_dictionary(
[this, culture_group](std::string_view key, ast::NodeCPtr value) -> bool {
- static const std::set<std::string, std::less<void>> reserved_keys = {
+ static const string_set_t reserved_keys = {
"leader", "unit", "union", "is_overseas"
};
if (reserved_keys.find(key) != reserved_keys.end()) return true;
diff --git a/src/openvic-simulation/pop/Pop.cpp b/src/openvic-simulation/pop/Pop.cpp
index dc53201..5286393 100644
--- a/src/openvic-simulation/pop/Pop.cpp
+++ b/src/openvic-simulation/pop/Pop.cpp
@@ -123,22 +123,6 @@ bool PopType::get_is_slave() const {
PopManager::PopManager() : pop_types { "pop types" } {}
-CultureManager& PopManager::get_culture_manager() {
- return culture_manager;
-}
-
-CultureManager const& PopManager::get_culture_manager() const {
- return culture_manager;
-}
-
-ReligionManager& PopManager::get_religion_manager() {
- return religion_manager;
-}
-
-ReligionManager const& PopManager::get_religion_manager() const {
- return religion_manager;
-}
-
bool PopManager::add_pop_type(std::string_view identifier, colour_t colour, PopType::strata_t strata,
PopType::sprite_t sprite, Good::good_map_t&& life_needs, Good::good_map_t&& everyday_needs,
Good::good_map_t&& luxury_needs, PopType::rebel_units_t&& rebel_units, Pop::pop_size_t max_size,
@@ -237,8 +221,8 @@ bool PopManager::load_pop_into_province(Province& province, std::string_view pop
Religion const* religion = nullptr;
Pop::pop_size_t size = 0;
bool ret = expect_dictionary_keys(
- "culture", ONE_EXACTLY, expect_identifier(culture_manager.expect_culture_identifier(assign_variable_callback_pointer(culture))),
- "religion", ONE_EXACTLY, expect_identifier(religion_manager.expect_religion_identifier(assign_variable_callback_pointer(religion))),
+ "culture", ONE_EXACTLY, culture_manager.expect_culture_identifier(assign_variable_callback_pointer(culture)),
+ "religion", ONE_EXACTLY, religion_manager.expect_religion_identifier(assign_variable_callback_pointer(religion)),
"size", ONE_EXACTLY, expect_uint(assign_variable_callback(size)),
"militancy", ZERO_OR_ONE, success_callback,
"rebel_type", ZERO_OR_ONE, success_callback
diff --git a/src/openvic-simulation/pop/Pop.hpp b/src/openvic-simulation/pop/Pop.hpp
index 26f89db..7261831 100644
--- a/src/openvic-simulation/pop/Pop.hpp
+++ b/src/openvic-simulation/pop/Pop.hpp
@@ -99,10 +99,8 @@ namespace OpenVic {
public:
PopManager();
- CultureManager& get_culture_manager();
- CultureManager const& get_culture_manager() const;
- ReligionManager& get_religion_manager();
- ReligionManager const& get_religion_manager() const;
+ REF_GETTERS(culture_manager)
+ REF_GETTERS(religion_manager)
bool add_pop_type(std::string_view identifier, colour_t new_colour, PopType::strata_t strata, PopType::sprite_t sprite,
Good::good_map_t&& life_needs, Good::good_map_t&& everyday_needs, Good::good_map_t&& luxury_needs,