fix(tracker): ID collisions in ClearUnit and Instruments.unmarshal

This commit is contained in:
5684185+vsariola@users.noreply.github.com
2024-09-07 15:20:12 +03:00
parent 9da6c2216c
commit 74972b5ff4
4 changed files with 20 additions and 4 deletions

View File

@ -154,6 +154,7 @@ func (m *Model) ClearUnit() Action {
defer (*Model)(m).change("DeleteUnitAction", PatchChange, MajorChange)()
m.d.UnitIndex = intMax(intMin(m.d.UnitIndex, len(m.d.Song.Patch[m.d.InstrIndex].Units)-1), 0)
m.d.Song.Patch[m.d.InstrIndex].Units[m.d.UnitIndex] = sointu.Unit{}
m.d.Song.Patch[m.d.InstrIndex].Units[m.d.UnitIndex].ID = m.maxID() + 1
},
allowed: func() bool {
return m.d.InstrIndex >= 0 &&