From bb8ddfbc5574a7682594fd15178083f5308766e7 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Mon, 12 Aug 2013 15:20:47 +0200 Subject: Getting rid of some magic numbers. --- mcmap/region.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'mcmap/region.go') diff --git a/mcmap/region.go b/mcmap/region.go index 0e569da..8a5fd9f 100644 --- a/mcmap/region.go +++ b/mcmap/region.go @@ -97,24 +97,24 @@ func (reg *Region) MaxDims() (xmin, xmax, zmin, zmax int) { xmax++ zmax++ - xmin *= 32 - xmax *= 32 - zmin *= 32 - zmax *= 32 + xmin *= superchunkSizeXZ + xmax *= superchunkSizeXZ + zmin *= superchunkSizeXZ + zmax *= superchunkSizeXZ return } func chunkToSuperchunk(cx, cz int) (scx, scz, rx, rz int) { scx = cx >> 5 scz = cz >> 5 - rx = ((cx % 32) + 32) % 32 - rz = ((cz % 32) + 32) % 32 + rx = ((cx % superchunkSizeXZ) + superchunkSizeXZ) % superchunkSizeXZ + rz = ((cz % superchunkSizeXZ) + superchunkSizeXZ) % superchunkSizeXZ return } func superchunkToChunk(scx, scz, rx, rz int) (cx, cz int) { - cx = scx*32 + rx - cz = scz*32 + rz + cx = scx*superchunkSizeXZ + rx + cz = scz*superchunkSizeXZ + rz return } @@ -250,8 +250,8 @@ func (reg *Region) AllChunks() <-chan XZPos { go func(ch chan<- XZPos) { for spos, _ := range reg.superchunksAvail { scx, scz := spos.X, spos.Z - for rx := 0; rx < 32; rx++ { - for rz := 0; rz < 32; rz++ { + for rx := 0; rx < superchunkSizeXZ; rx++ { + for rz := 0; rz < superchunkSizeXZ; rz++ { cx, cz := superchunkToChunk(scx, scz, rx, rz) ch <- XZPos{cx, cz} } -- cgit v1.2.3-54-g00ecf