Discover how frames are encoded, use that knowledge to (finally) get the viewport locked in
This commit is contained in:
@@ -19,13 +19,13 @@ type MapSet struct {
|
||||
Palette []string
|
||||
}
|
||||
|
||||
func LoadSets(dir string) (map[string]MapSet, error) {
|
||||
func LoadSets(dir string) (map[string]*MapSet, error) {
|
||||
fis, err := ioutil.ReadDir(dir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := make(map[string]MapSet, len(fis))
|
||||
out := make(map[string]*MapSet, len(fis))
|
||||
|
||||
for _, fi := range fis {
|
||||
filename := filepath.Join(dir, fi.Name())
|
||||
@@ -48,35 +48,34 @@ func LoadSets(dir string) (map[string]MapSet, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func LoadSet(filename string) (MapSet, error) {
|
||||
var out MapSet
|
||||
var err error
|
||||
func LoadSet(filename string) (*MapSet, error) {
|
||||
out := &MapSet{}
|
||||
|
||||
s, err := asciiscan.New(filename)
|
||||
if err != nil {
|
||||
return out, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer s.Close()
|
||||
|
||||
out.Description, err = s.ConsumeString()
|
||||
if err != nil {
|
||||
return out, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.Defs, err = consumeDefs(s)
|
||||
if err != nil {
|
||||
return out, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for {
|
||||
str, err := s.ConsumeString()
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
err = nil
|
||||
return out, nil
|
||||
}
|
||||
|
||||
return out, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out.Palette = append(out.Palette, str)
|
||||
|
Reference in New Issue
Block a user