diff options
author | Hop311 <Hop3114@gmail.com> | 2024-10-31 21:20:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-31 21:20:11 +0100 |
commit | 968c60580997d26035496cc675138e580354332f (patch) | |
tree | a0340ae5e92e219c5e0f5ddc825e28465f22a29e /src/openvic-simulation/misc/Decision.cpp | |
parent | c6f7c8047abbe0a91b2a88365eee2259d8a91a65 (diff) | |
parent | 84deeffe04d730064e89b4ceaf508f3f30113ea9 (diff) |
Merge pull request #218 from OpenVicProject/condition-scripts-prep-work
Condition scripts prep work
Diffstat (limited to 'src/openvic-simulation/misc/Decision.cpp')
-rw-r--r-- | src/openvic-simulation/misc/Decision.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/openvic-simulation/misc/Decision.cpp b/src/openvic-simulation/misc/Decision.cpp index 41d4f81..7812fc1 100644 --- a/src/openvic-simulation/misc/Decision.cpp +++ b/src/openvic-simulation/misc/Decision.cpp @@ -55,12 +55,15 @@ bool DecisionManager::load_decision_file(ast::NodeCPtr root) { "political_decisions", ZERO_OR_ONE, expect_dictionary_reserve_length( decisions, [this](std::string_view identifier, ast::NodeCPtr node) -> bool { + using enum scope_type_t; + bool alert = true, news = false; std::string_view news_title, news_desc_long, news_desc_medium, news_desc_short, picture; - ConditionScript potential { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE }; - ConditionScript allow { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE }; - ConditionalWeight ai_will_do { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE }; + ConditionScript potential { COUNTRY, COUNTRY, NO_SCOPE }; + ConditionScript allow { COUNTRY, COUNTRY, NO_SCOPE }; + ConditionalWeight ai_will_do { COUNTRY, COUNTRY, NO_SCOPE }; EffectScript effect; + bool ret = expect_dictionary_keys( "alert", ZERO_OR_ONE, expect_bool(assign_variable_callback(alert)), "news", ZERO_OR_ONE, expect_bool(assign_variable_callback(news)), @@ -74,10 +77,12 @@ bool DecisionManager::load_decision_file(ast::NodeCPtr root) { "effect", ONE_EXACTLY, effect.expect_script(), "ai_will_do", ZERO_OR_ONE, ai_will_do.expect_conditional_weight(ConditionalWeight::FACTOR) )(node); + ret &= add_decision( identifier, alert, news, news_title, news_desc_long, news_desc_medium, news_desc_short, picture, std::move(potential), std::move(allow), std::move(ai_will_do), std::move(effect) ); + return ret; } ) |