mirror of
https://github.com/vsariola/sointu.git
synced 2026-03-16 11:50:21 -04:00
refactor: put all info about different unit types into UnitTypes map
This commit is contained in:
parent
8ea9d3a191
commit
6a331f7a57
@ -270,12 +270,7 @@ func (m *UnitModel) SetType(t string) {
|
||||
for len(m.d.Song.Patch[m.d.InstrIndex].Units) <= m.d.UnitIndex {
|
||||
m.d.Song.Patch[m.d.InstrIndex].Units = append(m.d.Song.Patch[m.d.InstrIndex].Units, sointu.Unit{})
|
||||
}
|
||||
unit, ok := defaultUnits[t]
|
||||
if !ok { // if the type is invalid, we just set it to empty unit
|
||||
unit = sointu.Unit{Parameters: make(map[string]int)}
|
||||
} else {
|
||||
unit = unit.Copy()
|
||||
}
|
||||
unit := sointu.MakeUnit(t)
|
||||
oldUnit := m.d.Song.Patch[m.d.InstrIndex].Units[m.d.UnitIndex]
|
||||
if oldUnit.Type == unit.Type {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user