Skip to content

Commit

Permalink
[#197]: Fix SA issues
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobDomagala committed Apr 20, 2024
1 parent bee08b6 commit 536dfa5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion editor/gui/editor_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ EditorGUI::EditGroup(const std::string& oldName)
if (ImGui::Button("Rename", {ImGui::GetWindowWidth() / 3.0f, 35}))
{
renameGroupPushed_ = false;
auto& objects = groups_.at(oldName);
const auto& objects = groups_.at(oldName);
for (auto obj : objects)
{
objectsInfo_.at(obj).groupName = newName;
Expand Down
18 changes: 9 additions & 9 deletions editor/gui/editor_gui_level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,13 @@ EditorGUI::RenderLevelMenu() // NOLINT
// The second parameter is the label previewed before opening the combo.
if (ImGui::BeginCombo("##filterByGroup", selectedGroup.c_str()))
{
for (const auto& group : groupNames_)
auto selected = std::find_if(groupNames_.begin() + 1, groupNames_.end(),
[](const auto& group) { return ImGui::Selectable(group.c_str()); });
if (selected != groupNames_.end())
{
if (ImGui::Selectable(group.c_str()))
{
selectedGroup = group;
break;
}
selectedGroup = *selected;
}

ImGui::EndCombo();
}
});
Expand Down Expand Up @@ -424,15 +423,16 @@ EditorGUI::RenderLevelMenu() // NOLINT
ImGui::TableSetupColumn("GroupName", ImGuiTableColumnFlags_WidthStretch, 0.90f * totalWidth);
ImGui::TableSetupColumn("EditGroup", ImGuiTableColumnFlags_WidthStretch, 0.10f * totalWidth);

// NOLINTNEXTLINE
static std::string groupNameToEdit = "";

for (uint32_t idx = 1; idx < groupNames_.size(); ++idx)
{
CreateActionRow(
[this, idx] {
const auto& groupName = groupNames_.at(idx);
bool selected = selectedGroup_ == groupName;

if (ImGui::Selectable(groupName.c_str(), selected))
if (ImGui::Selectable(groupName.c_str(), selectedGroup_ == groupName))
{
parent_.UnselectAll();
selectedGroup_ = groupName;
Expand All @@ -448,7 +448,7 @@ EditorGUI::RenderLevelMenu() // NOLINT
}
},
[this, idx] {
if (ImGui::Button(std::format("{} ##ChangeGroupButton{}", ICON_FA_PENCIL, idx).c_str()))
if (ImGui::Button(fmt::format("{} ##ChangeGroupButton{}", ICON_FA_PENCIL, idx).c_str()))
{
groupNameToEdit = groupNames_.at(idx);
renameGroupPushed_ = true;
Expand Down

0 comments on commit 536dfa5

Please sign in to comment.