simulators

use diff instead of custom garbage
This commit is contained in:
2024-08-22 11:20:20 +02:00
parent 619f565480
commit 835dc2c0a8
+6 -16
View File
@@ -90,24 +90,14 @@ json Simulators::changed_UI_items()
json after = this->m_simulators.at(m_current_simulator)->get_UI_items();
json changed;
changed["event"] = "UI_changed";
if (m_before["UI_items"].empty())
changed["diff"] = json::diff(m_before, after);
if (changed["diff"].empty())
{
changed = after;
return changed;
return "{}"_json;
}
for (const json& item : after["UI_items"])
{
for (const json& before_item : m_before["UI_items"])
{
if (before_item["id"] == item["id"])
{
if (before_item != item)
{
changed["UI_items"].push_back(item);
}
}
}
}
m_before = after;
return changed;
}