diff options
Diffstat (limited to 'src/openvic-simulation/pop')
-rw-r--r-- | src/openvic-simulation/pop/Culture.cpp | 11 | ||||
-rw-r--r-- | src/openvic-simulation/pop/Pop.cpp | 6 | ||||
-rw-r--r-- | src/openvic-simulation/pop/Pop.hpp | 2 | ||||
-rw-r--r-- | src/openvic-simulation/pop/Religion.cpp | 2 |
4 files changed, 13 insertions, 8 deletions
diff --git a/src/openvic-simulation/pop/Culture.cpp b/src/openvic-simulation/pop/Culture.cpp index 709f305..dadc0a6 100644 --- a/src/openvic-simulation/pop/Culture.cpp +++ b/src/openvic-simulation/pop/Culture.cpp @@ -1,5 +1,7 @@ #include "Culture.hpp" +#include <set> + #include "openvic-simulation/dataloader/NodeTools.hpp" using namespace OpenVic; @@ -27,7 +29,7 @@ bool CultureGroup::get_is_overseas() const { Culture::Culture(const std::string_view new_identifier, colour_t new_colour, CultureGroup const& new_group, std::vector<std::string> const& new_first_names, std::vector<std::string> const& new_last_names) - : HasIdentifierAndColour { new_identifier, new_colour, true }, + : HasIdentifierAndColour { new_identifier, new_colour, true, false }, group { new_group }, first_names { new_first_names }, last_names { new_last_names } {} @@ -128,7 +130,7 @@ bool CultureManager::_load_culture_group(size_t& total_expected_cultures, }, "unit", ZERO_OR_ONE, [this, &total_expected_cultures, &unit_graphical_culture_type](ast::NodeCPtr node) -> bool { total_expected_cultures--; - return expect_graphical_culture_type(unit_graphical_culture_type)(node); + return expect_graphical_culture_type_identifier(assign_variable_callback_pointer(unit_graphical_culture_type))(node); }, "union", ZERO_OR_ONE, [&total_expected_cultures](ast::NodeCPtr) -> bool { total_expected_cultures--; @@ -207,7 +209,10 @@ 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 { - if (key == "leader" || key == "unit" || key == "union" || key == "is_overseas") return true; + static const std::set<std::string, std::less<void>> reserved_keys = { + "leader", "unit", "union", "is_overseas" + }; + if (reserved_keys.find(key) != reserved_keys.end()) return true; return _load_culture(culture_group, key, value); } )(culture_group_value); diff --git a/src/openvic-simulation/pop/Pop.cpp b/src/openvic-simulation/pop/Pop.cpp index 72aef87..96b17fc 100644 --- a/src/openvic-simulation/pop/Pop.cpp +++ b/src/openvic-simulation/pop/Pop.cpp @@ -53,7 +53,7 @@ PopType::PopType(const std::string_view new_identifier, colour_t new_colour, strata_t new_strata, sprite_t new_sprite, Pop::pop_size_t new_max_size, Pop::pop_size_t new_merge_max_size, bool new_state_capital_only, bool new_demote_migrant, bool new_is_artisan, bool new_is_slave) - : HasIdentifierAndColour { new_identifier, new_colour, true }, + : HasIdentifierAndColour { new_identifier, new_colour, true, false }, strata { new_strata }, sprite { new_sprite }, max_size { new_max_size }, @@ -200,8 +200,8 @@ bool PopManager::load_pop_into_province(Province& province, const std::string_vi Religion const* religion = nullptr; Pop::pop_size_t size = 0; bool ret = expect_dictionary_keys( - "culture", ONE_EXACTLY, culture_manager.expect_culture(culture), - "religion", ONE_EXACTLY, religion_manager.expect_religion(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_uint("pop size", 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 e70bc0b..1dc1d32 100644 --- a/src/openvic-simulation/pop/Pop.hpp +++ b/src/openvic-simulation/pop/Pop.hpp @@ -9,7 +9,7 @@ namespace OpenVic { struct PopType; /* REQUIREMENTS: - * POP-18, POP-19, POP-20, POP-21 + * POP-18, POP-19, POP-20, POP-21, POP-34, POP-35, POP-36, POP-37 */ struct Pop { friend struct PopManager; diff --git a/src/openvic-simulation/pop/Religion.cpp b/src/openvic-simulation/pop/Religion.cpp index 0652eb2..ec919fe 100644 --- a/src/openvic-simulation/pop/Religion.cpp +++ b/src/openvic-simulation/pop/Religion.cpp @@ -9,7 +9,7 @@ ReligionGroup::ReligionGroup(const std::string_view new_identifier) : HasIdentif Religion::Religion(const std::string_view new_identifier, colour_t new_colour, ReligionGroup const& new_group, icon_t new_icon, bool new_pagan) - : HasIdentifierAndColour { new_identifier, new_colour, true }, + : HasIdentifierAndColour { new_identifier, new_colour, true, false }, group { new_group }, icon { new_icon }, pagan { new_pagan } { |