convert selected

move from string to index to reduce data size
This commit is contained in:
2026-02-14 14:32:03 +01:00
parent 99d537ac29
commit 7c91a64d71
8 changed files with 54 additions and 52 deletions
+2 -10
View File
@@ -49,20 +49,12 @@ std::string UI_combobox::selected_text() const
void UI_combobox::from_json(const json &j)
{
UI_x_boxes::from_json(j);
std::string selected_str = j.at("selected");
for (size_t i = 0; i < m_options.size(); i++)
{
if (m_options[i] == selected_str)
{
m_selected = i;
break;
}
}
m_selected = j.at("selected");
}
json UI_combobox::to_json(size_t id) const
{
json j = UI_x_boxes::to_json(id);
j["selected"] = m_options[m_selected];
j["selected"] = m_selected;
return j;
}