#include "Director.h" namespace NVL::Director { Director::Director(const Compiler::NVLGraph& g) : g(g), current_position(0), active(true), description(g.nodes[0].description), current_node(g.nodes[0]) { for (const String& s : g.static_refs) resolve.push_back(Environment::ENVIRONMENT.get(s)); } Environment::Variable Director::CollectVariable(const Environment::Variable& v) { if (v.type == Environment::Type::StaticReference) return this->resolve[static_cast(std::get(v.value))]; else if (v.type == Environment::Type::Array) { Vector a{}; for (const auto& x : std::get>(v.value)) a.push_back(CollectVariable(x)); return Environment::Variable(a); } else return v; } void Director::Advance() { if (current_position >= current_node.sequence.size()) { this->active = false; return; } const auto& cmd = this->current_node.sequence[current_position]; Vector args{}; for (u32 i = 1; i < cmd.size(); i++) { args.push_back(CollectVariable(cmd[i])); } std::get)>>(CollectVariable(cmd[0]).value)(args); this->current_position++; } void Director::GetBacklog() { } void Director::Save() { } void Director::Load() { } void Director::Jump() { } }