Sort levels and doodads in the Open menu
This commit is contained in:
parent
1ac85c9297
commit
0cc1d17f4f
|
@ -8,7 +8,6 @@ import (
|
|||
"path/filepath"
|
||||
|
||||
"git.kirsle.net/apps/doodle/pkg/balance"
|
||||
"git.kirsle.net/apps/doodle/pkg/log"
|
||||
"git.kirsle.net/apps/doodle/pkg/usercfg"
|
||||
)
|
||||
|
||||
|
@ -44,7 +43,6 @@ func FromJSON(filename string, data []byte) (*Doodad, error) {
|
|||
}
|
||||
} else if len(data) > 1 && data[0] == 0x1f && data[1] == 0x8b {
|
||||
// Gzip compressed. `1F8B` is gzip magic number.
|
||||
log.Debug("Decompress doodad %s", filename)
|
||||
if gzd, err := FromGzip(data); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
|
|
|
@ -234,6 +234,7 @@ func (s *PlayScene) setupPlayer() {
|
|||
// from right here.
|
||||
log.Info("Found start-flag.doodad at %s (ID %s)", actor.Point, actorID)
|
||||
flag = actor
|
||||
flagCount++
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package windows
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"git.kirsle.net/apps/doodle/pkg/balance"
|
||||
"git.kirsle.net/apps/doodle/pkg/level"
|
||||
|
@ -67,6 +69,13 @@ func NewOpenLevelEditor(config OpenLevelEditor) *ui.Window {
|
|||
sysLevels, _ := level.ListSystemLevels()
|
||||
levels = append(levels, sysLevels...)
|
||||
|
||||
// Sort them!
|
||||
sort.Slice(
|
||||
levels, func(i, j int) bool {
|
||||
return strings.ToLower(levels[i]) < strings.ToLower(levels[j])
|
||||
},
|
||||
)
|
||||
|
||||
lvlRow := ui.NewFrame("Level Row 0")
|
||||
frame.Pack(lvlRow, ui.Pack{
|
||||
Side: ui.N,
|
||||
|
@ -156,6 +165,14 @@ func NewOpenLevelEditor(config OpenLevelEditor) *ui.Window {
|
|||
})
|
||||
|
||||
files, _ := userdir.ListDoodads()
|
||||
|
||||
// Sort them!
|
||||
sort.Slice(
|
||||
files, func(i, j int) bool {
|
||||
return strings.ToLower(files[i]) < strings.ToLower(files[j])
|
||||
},
|
||||
)
|
||||
|
||||
ddRow := ui.NewFrame("Doodad Row 0")
|
||||
frame.Pack(ddRow, ui.Pack{
|
||||
Side: ui.N,
|
||||
|
|
Loading…
Reference in New Issue
Block a user