aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/pop/Culture.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-09-19 17:40:09 +0200
committer GitHub <noreply@github.com>2023-09-19 17:40:09 +0200
commit9c89100e0c8854dff3174b078d235148585a8b03 (patch)
tree77f81dfd3ec85a659741e979c148b33b22595dd0 /src/openvic-simulation/pop/Culture.cpp
parent64d134ad20c333afa60373526d6fab27a07c6adc (diff)
parent72add97c47f0d17fc0019bb4cfec7506740a9c7d (diff)
Merge pull request #17 from OpenVicProject/dataloading-the-third
Scaffolding for `positions.txt` + modifier loading
Diffstat (limited to 'src/openvic-simulation/pop/Culture.cpp')
-rw-r--r--src/openvic-simulation/pop/Culture.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/openvic-simulation/pop/Culture.cpp b/src/openvic-simulation/pop/Culture.cpp
index bf14df9..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;
@@ -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);