diff options
author | wvpm <24685035+wvpm@users.noreply.github.com> | 2024-10-26 18:25:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-26 18:25:15 +0200 |
commit | 8d9ff3266439c6a94c35fdf0d8a0642a2cb34de3 (patch) | |
tree | 46039d0eb5d630cf000e94aed584aebaaa8f3f9b /src/openvic-simulation/military/LeaderTrait.cpp | |
parent | c88cf59997529cbca008f9a2b629822de9deaa2a (diff) | |
parent | 3daebe5db14949f55be2c50220323138260dbaea (diff) |
Merge pull request #210 from OpenVicProject/contextual_modifier_parsing
Contextual modifier parsing
Diffstat (limited to 'src/openvic-simulation/military/LeaderTrait.cpp')
-rw-r--r-- | src/openvic-simulation/military/LeaderTrait.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/openvic-simulation/military/LeaderTrait.cpp b/src/openvic-simulation/military/LeaderTrait.cpp index 7835636..e00deec 100644 --- a/src/openvic-simulation/military/LeaderTrait.cpp +++ b/src/openvic-simulation/military/LeaderTrait.cpp @@ -1,5 +1,6 @@ #include "LeaderTrait.hpp" +#include "openvic-simulation/dataloader/NodeTools.hpp" #include "openvic-simulation/modifier/ModifierManager.hpp" using namespace OpenVic; @@ -32,17 +33,10 @@ 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 leader", "morale", "organisation", "reconnaissance", - "speed", "attrition", "experience", "reliability" - }; - ModifierValue modifiers; - bool ret = modifier_manager.expect_whitelisted_modifier_value( - move_variable_callback(modifiers), LEADER, allowed_modifiers + bool ret = NodeTools::expect_dictionary( + modifier_manager.expect_leader_modifier(modifiers) )(value); ret &= add_leader_trait(trait_identifier, type, std::move(modifiers)); |