From cca2977a8fd2cc8bb195f091c2c25734db80423a Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 15 May 2013 21:13:36 -0700 Subject: [PATCH] And update locations using 128 as well. --- bravo/plugins/generators.py | 4 ++-- bravo/terrain/trees.py | 4 +++- bravo/tests/plugins/test_generators.py | 2 +- tools/simplexbench.py | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/bravo/plugins/generators.py b/bravo/plugins/generators.py index 083356d6..850b100c 100644 --- a/bravo/plugins/generators.py +++ b/bravo/plugins/generators.py @@ -338,7 +338,7 @@ def populate(self, chunk, seed): current_height > 63 and height > 63): for y in range(height - 3): chunk.set_block((x, y, z), blocks["stone"].slot) - for y in range(y, 128): + for y in range(y, CHUNK_HEIGHT // 2): chunk.set_block((x, y, z), blocks["air"].slot) name = "cliffs" @@ -406,7 +406,7 @@ def populate(self, chunk, seed): magx = (chunk.x * 16 + x) * xzfactor magz = (chunk.z * 16 + z) * xzfactor - for y in range(128): + for y in range(CHUNK_HEIGHT): if not chunk.get_block((x, y, z)): continue diff --git a/bravo/terrain/trees.py b/bravo/terrain/trees.py index 0eb660c7..b98ce83f 100644 --- a/bravo/terrain/trees.py +++ b/bravo/terrain/trees.py @@ -7,6 +7,8 @@ from zope.interface import Interface, implements from bravo.blocks import blocks +from bravo.chunk import CHUNK_HEIGHT + PHI = (sqrt(5) - 1) * 0.5 IPHI = (sqrt(5) + 1) * 0.5 @@ -37,7 +39,7 @@ def dist_to_mat(cord, vec, matidxlist, world, invert=False, limit=None): x = int(curcord[0]) y = int(curcord[1]) z = int(curcord[2]) - if not 0 <= y < 128: + if not 0 <= y < CHUNK_HEIGHT: break block = world.sync_get_block((x, y, z)) diff --git a/bravo/tests/plugins/test_generators.py b/bravo/tests/plugins/test_generators.py index de53dfec..72f54264 100644 --- a/bravo/tests/plugins/test_generators.py +++ b/bravo/tests/plugins/test_generators.py @@ -25,7 +25,7 @@ def test_boring(self): plugin.populate(self.chunk, 0) for x, y, z in product(xrange(16), xrange(CHUNK_HEIGHT), xrange(16)): - if y < 128: + if y < CHUNK_HEIGHT // 2: self.assertEqual(self.chunk.get_block((x, y, z)), bravo.blocks.blocks["stone"].slot) else: diff --git a/tools/simplexbench.py b/tools/simplexbench.py index 0f15cbe9..d218bad2 100755 --- a/tools/simplexbench.py +++ b/tools/simplexbench.py @@ -4,11 +4,12 @@ from time import time from bravo.simplex import set_seed, simplex2, simplex3, octaves2, octaves3 +from bravo.chunk import CHUNK_HEIGHT print "Be patient; this benchmark takes a minute or so to run each test." chunk2d = 16 * 16 -chunk3d = chunk2d * 128 +chunk3d = chunk2d * CHUNK_HEIGHT set_seed(time())