aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/scripts/ConditionScript.cpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-11-01 22:38:23 +0100
committer hop311 <hop3114@gmail.com>2024-11-01 22:38:23 +0100
commitfa0235d4eac01816a4832249f28ccadfb6dd6e40 (patch)
treeb1d3e6bb4b3a0accc42dd8e0038e51b134ad99ae /src/openvic-simulation/scripts/ConditionScript.cpp
parent8defcd5daa1acd2c61aa1cd0a26478d472fed9b0 (diff)
Create basic condition script parsing and execution framework
Diffstat (limited to 'src/openvic-simulation/scripts/ConditionScript.cpp')
-rw-r--r--src/openvic-simulation/scripts/ConditionScript.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/openvic-simulation/scripts/ConditionScript.cpp b/src/openvic-simulation/scripts/ConditionScript.cpp
index c556bd2..a3db1ce 100644
--- a/src/openvic-simulation/scripts/ConditionScript.cpp
+++ b/src/openvic-simulation/scripts/ConditionScript.cpp
@@ -18,3 +18,13 @@ bool ConditionScript::_parse_script(ast::NodeCPtr root, DefinitionManager const&
move_variable_callback(condition_root)
)(root);
}
+
+bool ConditionScript::execute(
+ InstanceManager const& instance_manager,
+ ConditionNode::scope_t const& initial_scope,
+ ConditionNode::scope_t const& this_scope,
+ ConditionNode::scope_t const& from_scope
+) const {
+ return !condition_root.is_initialised()
+ || condition_root.execute(instance_manager, initial_scope, this_scope, from_scope);
+}