aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/military/LeaderTrait.cpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-10-19 12:39:08 +0200
committer hop311 <hop3114@gmail.com>2024-10-19 12:39:08 +0200
commit572ac597d8b43c4c97be4b68aa40de0e7ae6bfe0 (patch)
treec529d60fe49fbcd167522c0fb21ca10139cb5cc7 /src/openvic-simulation/military/LeaderTrait.cpp
parent35909d6e79d524f19f9b69dffd02fcf162be5093 (diff)
Require modifier type when parsing ModifierValues
Diffstat (limited to 'src/openvic-simulation/military/LeaderTrait.cpp')
-rw-r--r--src/openvic-simulation/military/LeaderTrait.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/openvic-simulation/military/LeaderTrait.cpp b/src/openvic-simulation/military/LeaderTrait.cpp
index 4378a67..85d0890 100644
--- a/src/openvic-simulation/military/LeaderTrait.cpp
+++ b/src/openvic-simulation/military/LeaderTrait.cpp
@@ -32,17 +32,21 @@ bool LeaderTraitManager::load_leader_traits_file(ModifierManager const& modifier
return expect_dictionary_reserve_length(
leader_traits,
[this, &modifier_manager, type](std::string_view trait_identifier, ast::NodeCPtr value) -> bool {
+ using enum Modifier::modifier_type_t;
+
static const string_set_t allowed_modifiers = {
"attack", "defence", "morale", "organisation", "reconnaissance",
"speed", "attrition", "experience", "reliability"
};
ModifierValue modifiers;
+
bool ret = modifier_manager.expect_whitelisted_modifier_value(
- move_variable_callback(modifiers), allowed_modifiers
+ move_variable_callback(modifiers), LEADER, allowed_modifiers
)(value);
ret &= add_leader_trait(trait_identifier, type, std::move(modifiers));
+
return ret;
}
);