From ff17731cf82f9213978c8c4cf221beef1cb4b456 Mon Sep 17 00:00:00 2001 From: David Vierra Date: Sun, 11 Jan 2015 13:28:05 -1000 Subject: [PATCH] iterateChunks has a radius parameter, not diameter --- src/mcedit2/worldview/iso.py | 2 +- src/mcedit2/worldview/worldview.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mcedit2/worldview/iso.py b/src/mcedit2/worldview/iso.py index 2420a2d..645fb4a 100644 --- a/src/mcedit2/worldview/iso.py +++ b/src/mcedit2/worldview/iso.py @@ -100,7 +100,7 @@ class IsoWorldView(WorldView): h = abs(br[1] - tl[1]) d = max(w, h) + 2 - return iterateChunks(center[0], center[2], d) + return iterateChunks(center[0], center[2], d / 2) def rotateView(self, yrot, xrot): self.yrot = yrot diff --git a/src/mcedit2/worldview/worldview.py b/src/mcedit2/worldview/worldview.py index c453e52..7d5a1ff 100644 --- a/src/mcedit2/worldview/worldview.py +++ b/src/mcedit2/worldview/worldview.py @@ -453,7 +453,7 @@ class WorldView(QGLWidget): def makeChunkIter(self): x, y, z = self.viewCenter() - return iterateChunks(x, z, 1 + max(self.width() * self.scale, self.height() * self.scale) // 16) + return iterateChunks(x, z, 1 + max(self.width() * self.scale, self.height() * self.scale) // 32) def requestChunk(self): if self._chunkIter is None: @@ -636,14 +636,14 @@ def findBlockFace(level, point): return Vector(*blockPosition), face -def iterateChunks(x, z, diameter): +def iterateChunks(x, z, radius): """ Yields a list of chunk positions starting from the center and going outward in a square spiral pattern. :param x: center block position :param z: center block position - :param diameter: diameter, in chunks - :type diameter: int + :param radius: radius, in chunks + :type radius: int :return: :rtype: """ @@ -664,7 +664,7 @@ def iterateChunks(x, z, diameter): yield (cx, cz) step += 1 - if step > diameter: + if step > radius * 2: raise StopIteration dir = -dir