From 572ac597d8b43c4c97be4b68aa40de0e7ae6bfe0 Mon Sep 17 00:00:00 2001 From: hop311 Date: Sat, 19 Oct 2024 11:39:08 +0100 Subject: Require modifier type when parsing ModifierValues --- src/openvic-simulation/military/LeaderTrait.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/openvic-simulation/military/LeaderTrait.cpp') 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; } ); -- cgit v1.2.3-56-ga3b1