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/examples/emeraldfinder/main.go | 6 +++--- mcmap/examples/mapper/main.go | 14 +++++++------- mcmap/examples/replace/main.go | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'mcmap/examples') diff --git a/mcmap/examples/emeraldfinder/main.go b/mcmap/examples/emeraldfinder/main.go index d92ad3c..3249a35 100644 --- a/mcmap/examples/emeraldfinder/main.go +++ b/mcmap/examples/emeraldfinder/main.go @@ -36,9 +36,9 @@ chunkLoop: os.Exit(1) } - for y := 0; y < 256; y++ { - for x := 0; x < 16; x++ { - for z := 0; z < 16; z++ { + for y := 0; y < mcmap.ChunkSizeY; y++ { + for x := 0; x < mcmap.ChunkSizeXZ; x++ { + for z := 0; z < mcmap.ChunkSizeXZ; z++ { blk := chunk.Block(x, y, z) if blk.ID == mcmap.BlkEmeraldOre { absx, absz := mcmap.ChunkToBlock(cx, cz, x, z) diff --git a/mcmap/examples/mapper/main.go b/mcmap/examples/mapper/main.go index 2cbcefb..2b21648 100644 --- a/mcmap/examples/mapper/main.go +++ b/mcmap/examples/mapper/main.go @@ -27,8 +27,8 @@ func main() { } xmin, xmax, zmin, zmax := region.MaxDims() - w := (xmax - xmin) * 16 - h := (zmax - zmin) * 16 + w := (xmax - xmin) * mcmap.ChunkSizeXZ + h := (zmax - zmin) * mcmap.ChunkSizeXZ img := image.NewRGBA(image.Rect(0, 0, w, h)) chunkLoop: @@ -44,19 +44,19 @@ chunkLoop: os.Exit(1) } - for x := 0; x < 16; x++ { + for x := 0; x < mcmap.ChunkSizeXZ; x++ { scanZ: - for z := 0; z < 16; z++ { + for z := 0; z < mcmap.ChunkSizeXZ; z++ { ax, az := mcmap.ChunkToBlock(cx, cz, x, z) - for y := 255; y >= 0; y-- { + for y := mcmap.ChunkSizeY; y >= 0; y-- { blk := chunk.Block(x, y, z) c, ok := colors[blk.ID] if ok { - img.Set(ax-(xmin*16), az-(zmin*16), c) + img.Set(ax-(xmin*mcmap.ChunkSizeXZ), az-(zmin*mcmap.ChunkSizeXZ), c) continue scanZ } } - img.Set(ax-(xmin*16), az-(zmin*16), rgb(0x000000)) + img.Set(ax-(xmin*mcmap.ChunkSizeXZ), az-(zmin*mcmap.ChunkSizeXZ), rgb(0x000000)) } } diff --git a/mcmap/examples/replace/main.go b/mcmap/examples/replace/main.go index e5fff78..87dd677 100644 --- a/mcmap/examples/replace/main.go +++ b/mcmap/examples/replace/main.go @@ -37,9 +37,9 @@ chunkLoop: } modified := false - for y := 0; y < 256; y++ { - for x := 0; x < 16; x++ { - for z := 0; z < 16; z++ { + for y := 0; y < mcmap.ChunkSizeY; y++ { + for x := 0; x < mcmap.ChunkSizeXZ; x++ { + for z := 0; z < mcmap.ChunkSizeXZ; z++ { blk := chunk.Block(x, y, z) if blk.ID == mcmap.BlkBlockOfIron { blk.ID = mcmap.BlkBlockOfDiamond -- cgit v1.2.3-70-g09d2