6474: update selected group correctly after dragging r=def- a=Marmare314

When dragging a layer up, the wrong layer is selected after. Should be merged before #6467.

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: marmare314 <49279081+Marmare314@users.noreply.github.com>
This commit is contained in:
bors[bot] 2023-03-27 09:19:24 +00:00 committed by GitHub
commit b31d28dcaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3750,7 +3750,7 @@ void CEditor::RenderLayers(CUIRect LayersBox)
auto InsertPosition = std::find(m_Map.m_vpGroups.begin(), m_Map.m_vpGroups.end(), pNextGroup);
m_Map.m_vpGroups.insert(InsertPosition, pSelectedGroup);
m_SelectedGroup = GroupAfterDraggedLayer == 0 ? 0 : GroupAfterDraggedLayer - 1;
m_SelectedGroup = InsertPosition - m_Map.m_vpGroups.begin();
m_Map.m_Modified = true;
}