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

@@ -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),
)
}
}