This commit is contained in:
T0b1
2023-06-15 02:25:57 +02:00
parent b393f3dd28
commit 9ab08de243
15 changed files with 1294 additions and 166 deletions

View File

@@ -348,10 +348,37 @@ void Frontend::handle_msgs()
case data_result:
{
const auto &result = std::get<BackToFront::DataResult>(msg->data);
printf("Result ID: %lu\n", result.result.id);
for (auto &window : _windows)
for (size_t i = 0; i < result.nodes.size(); ++i)
{
window.handle_data_res(result);
uint16_t idx = result.nodes[i].idx;
if (this->target->data_res_nodes.size() <= idx)
{
this->target->data_res_nodes.resize(idx + 1);
}
this->target->data_res_nodes[idx] = std::move(result.nodes[i]);
}
if (result.src_node_id)
{
auto id = result.src_node_id->second;
auto found = false;
for (auto &entry : this->target->src_id_to_data_idx)
{
if (entry.first == id)
{
entry.second = result.src_node_id->first;
found = true;
break;
}
}
if (!found)
{
this->target->src_id_to_data_idx.push_back(
std::make_pair(id, result.src_node_id->first));
}
for (auto &window : _windows)
{
window.handle_source_updated(*this->target, id);
}
}
break;
}