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:
@@ -139,16 +139,15 @@ func loadMapsFrom(mapsPath string) {
|
||||
}
|
||||
|
||||
log.Printf("Maps in %s:", mapsPath)
|
||||
for key, gameMap := range gameMaps {
|
||||
rect := gameMap.Rect()
|
||||
hdr := gameMap.Header
|
||||
for key, gm := range gameMaps {
|
||||
rect := gm.Rect()
|
||||
fmt.Printf(
|
||||
" * `%s`: IsCampaignMap=%v W=%v:%v L=%v:%v SetName=%s\n",
|
||||
key,
|
||||
hdr.IsCampaignMap,
|
||||
gm.IsCampaignMap,
|
||||
rect.Min.X, rect.Max.X,
|
||||
rect.Min.Y, rect.Max.Y,
|
||||
string(hdr.SetName[:]),
|
||||
string(gm.SetName),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@@ -181,8 +181,8 @@ func (e *env) Draw(screen *ebiten.Image) error {
|
||||
|
||||
for y := int(rect.Min.Y); y < int(rect.Max.Y); y++ {
|
||||
for x := int(rect.Min.X); x < int(rect.Max.X); x++ {
|
||||
cell := gameMap.Cells.At(x, y, int(e.state.zIdx))
|
||||
imd.Set(x, y, makeColour(&cell, e.state.cellIdx))
|
||||
cell := gameMap.At(x, y, int(e.state.zIdx))
|
||||
imd.Set(x, y, makeColour(cell, e.state.cellIdx))
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user