From d49d82e9823700cc9956e7061de90eaf18754064 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Tue, 23 Jul 2024 20:32:16 +0200 Subject: [PATCH] fix: Building with latest pattern language changes --- plugins/ui/source/ui/pattern_drawer.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/ui/source/ui/pattern_drawer.cpp b/plugins/ui/source/ui/pattern_drawer.cpp index 3ac1c59e2..15b788929 100644 --- a/plugins/ui/source/ui/pattern_drawer.cpp +++ b/plugins/ui/source/ui/pattern_drawer.cpp @@ -571,12 +571,12 @@ namespace hex::ui { if (auto enumPattern = dynamic_cast(&pattern); enumPattern != nullptr) { if (ImGui::BeginCombo("##Enum", pattern.getFormattedValue().c_str())) { auto currValue = pattern.getValue().toUnsigned(); - for (auto &enumValue : enumPattern->getEnumValues()) { + for (auto &[name, enumValue] : enumPattern->getEnumValues()) { auto min = enumValue.min.toUnsigned(); auto max = enumValue.max.toUnsigned(); bool isSelected = min <= currValue && max >= currValue; - if (ImGui::Selectable(fmt::format("{}::{}", pattern.getTypeName(), enumValue.name, min, pattern.getSize() * 2).c_str(), isSelected)) { + if (ImGui::Selectable(fmt::format("{}::{}", pattern.getTypeName(), name, min, pattern.getSize() * 2).c_str(), isSelected)) { pattern.setValue(enumValue.min); this->resetEditing(); } @@ -723,13 +723,13 @@ namespace hex::ui { if (ImGui::BeginCombo("##Enum", pattern.getFormattedValue().c_str())) { auto currValue = pattern.getValue().toUnsigned(); - for (auto &value : pattern.getEnumValues()) { - auto min = value.min.toUnsigned(); - auto max = value.max.toUnsigned(); + for (auto &[name, enumValue] : pattern.getEnumValues()) { + auto min = enumValue.min.toUnsigned(); + auto max = enumValue.max.toUnsigned(); bool isSelected = min <= currValue && max >= currValue; - if (ImGui::Selectable(fmt::format("{}::{}", pattern.getTypeName(), value.name, min, pattern.getSize() * 2).c_str(), isSelected)) { - pattern.setValue(value.min); + if (ImGui::Selectable(fmt::format("{}::{}", pattern.getTypeName(), name, min, pattern.getSize() * 2).c_str(), isSelected)) { + pattern.setValue(enumValue.min); this->resetEditing(); } if (isSelected)