Skip to content

Commit 2270673

Browse files
committed
Engine: Resolve field info in monitor blocks
1 parent 5709034 commit 2270673

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/engine/internal/engine.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,40 @@ void Engine::resolveIds()
123123
}
124124
}
125125
}
126+
127+
for (auto monitor : m_monitors) {
128+
auto block = monitor->block();
129+
auto container = blockSectionContainer(block->opcode());
130+
const auto &fields = block->fields();
131+
Target *target;
132+
133+
if (monitor->sprite())
134+
target = monitor->sprite();
135+
else
136+
target = stage();
137+
138+
assert(target);
139+
140+
for (auto field : fields) {
141+
field->setValuePtr(getEntity(field->valueId()));
142+
143+
if (container) {
144+
field->setFieldId(container->resolveField(field->name()));
145+
146+
if (!field->valuePtr())
147+
field->setSpecialValueId(container->resolveFieldValue(field->value().toString()));
148+
}
149+
150+
// TODO: Move field information out of Engine
151+
if (field->name() == "VARIABLE")
152+
field->setValuePtr(target->variableAt(target->findVariable(field->value().toString())));
153+
else if (field->name() == "LIST")
154+
field->setValuePtr(target->listAt(target->findList(field->value().toString())));
155+
}
156+
157+
block->updateInputMap();
158+
block->updateFieldMap();
159+
}
126160
}
127161

128162
void Engine::compile()

0 commit comments

Comments
 (0)