Switch from encoding/binary to struc

It's not perfect, but struc can deserialize the whole thing into one
struct while encoding/binary can't. It's nice to have that.
This commit is contained in:
2020-06-09 00:35:57 +01:00
parent 65bae80d40
commit cf624cc77b
7 changed files with 118 additions and 172 deletions

View File

@@ -47,7 +47,7 @@ func (a *AssetStore) Map(name string) (*Map, error) {
}
m := &Map{
Rect: raw.Rect(),
Rect: raw.Rect(),
assets: a,
raw: raw,
set: set,
@@ -74,8 +74,8 @@ func (m *Map) LoadSprites() error {
}
// FIXME: get rid of this
func (m *Map) Cell(x, y, z int) maps.Cell {
return m.raw.Cells.At(x, y, z)
func (m *Map) Cell(x, y, z int) *maps.Cell {
return m.raw.At(x, y, z)
}
// SpritesForCell returns the sprites needed to correctly render this cell.